Skip to content
This repository has been archived by the owner on Apr 17, 2024. It is now read-only.

Commit

Permalink
Merge pull request #4 from openinsight-proj/remove_unused_code
Browse files Browse the repository at this point in the history
remove unused code
  • Loading branch information
Frapschen authored Apr 16, 2024
2 parents ac74cd8 + 652194b commit 62239bf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 91 deletions.
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ gen-dashboards: remove-dashbaords
docker run --rm -v $$(pwd)/dashboards:/dashboards -v $$(pwd)/hack:/hack -it python:3.11.9 /bin/sh -c \
'cd hack && pip install -r requirements.txt && python sync_grafana_dashboards.py'

.PHONY: build-image-darwin
build-image-darwin:
docker buildx build --platform linux/amd64 -t release-ci.daocloud.io/insight/grafana_plugins_init:dev .

build-image-liunx:
.PHONY: build-image-linux
build-image-linux:
docker buildx build --platform linux/amd64 -t release-ci.daocloud.io/insight/grafana_plugins_init:dev .
90 changes: 0 additions & 90 deletions hack/sync_grafana_dashboards.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,6 @@ class LiteralStr(str):
pass


# def change_style(style, representer):
# def new_representer(dumper, data):
# scalar = representer(dumper, data)
# scalar.style = style
# return scalar
#
# return new_representer


# Source files list
charts = [
{
Expand Down Expand Up @@ -242,61 +233,6 @@ class LiteralStr(str):
"prometheus-remote-write.json"
]

# Additional conditions map
# condition_map = {
# 'grafana-coredns-k8s': '(index .Values "dashboards" "coreDns")',
# 'etcd': '(index .Values "dashboards" "kubeEtcd")',
# 'apiserver': '(index .Values "dashboards" "kubeApiServer")',
# 'controller-manager': '(index .Values "dashboards" "kubeControllerManager")',
# 'kubelet': '(index .Values "dashboards" "kubelet")',
# 'proxy': '(index .Values "dashboards" "kubeProxy")',
# 'scheduler': '(index .Values "dashboards" "kubeScheduler")',
# 'node-rsrc-use': '(index .Values "dashboards" "prometheus-node-exporter")',
# 'node-cluster-rsrc-use': '(index .Values "dashboards" "prometheus-node-exporter")',
# 'victoriametrics-cluster': '(index .Values "dashboards" "vmcluster")',
# 'victoriametrics': '(index .Values "dashboards" "vmsingle")',
# 'vmalert': '(index .Values "dashboards" "vmalert")',
# 'vmagent': '(index .Values "dashboards" "vmagent")',
# 'fluent-bit': '(index .Values "dashboards" "fluentBit")',
# 'agent-otel-collector': '(index .Values "dashboards" "agentOtelCollector")',
# 'otel-collector': '(index .Values "dashboards" "otelCollector")',
# 'nodes-darwin': '(index .Values "dashboards" "nodes-darwin")',
# 'jaeger-collector': '(index .Values "dashboards" "jaegerCollector")',
# 'tracing-debug': '(index .Values "dashboards" "tracingDebug")',
# 'insight-logging': '(index .Values "dashboards" "insightLogging")'
# }

# standard header
# header = '''{{- /*
# Generated from '%(name)s' from %(url)s
# Do not change in-place! In order to change this file first read following link:
# https://gitlab.daocloud.cn/ndx/engineering/insight/insight/-/tree/main/hack
# */ -}}
# {{- %(condition)s }}
# apiVersion: integreatly.org/v1alpha1
# kind: GrafanaDashboard
# metadata:
# namespace: {{ .Release.Namespace }}
# name: {{ printf "%%s-%%s" (include "dashboard.fullname" $) "%(name)s" | trunc 63 | trimSuffix "-" | trimSuffix "." }}
# labels:
# {{ include "dashboard.common.labels" $ | indent 4 }}
# {{- if (index $ "Values" "dashboards" "label") }}
# {{ (index $ "Values" "dashboards" "label") }}: "1"
# {{- end }}
# {{- if (index $ "Values" "dashboards" "additionalDashboardLabels") }}
# {{- range $key, $val := (index .Values "dashboards" "additionalDashboardLabels") }}
# {{ $key }}: {{ $val | quote }}
# {{- end }}
# {{- end }}
# app: {{ include "dashboard.name" $ }}-grafana-operator
# {{- if (index $ "Values" "dashboards" "additionalDashboardAnnotations") }}
# annotations:
# {{- range $key, $val := (index .Values "dashboards" "additionalDashboardAnnotations") }}
# {{ $key }}: {{ $val | quote }}
# {{- end }}
# {{- end }}
# spec:
# '''

templating_cluster_name = '''{
"allValue": null,
Expand Down Expand Up @@ -330,32 +266,6 @@ class LiteralStr(str):
}'''


# def init_yaml_styles():
# represent_literal_str = change_style('|', SafeRepresenter.represent_str)
# yaml.add_representer(LiteralStr, represent_literal_str)


# def escape(s):
# return s.replace("{{", "{{`{{").replace("}}", "}}`}}").replace("{{`{{", "{{`{{`}}").replace("}}`}}", "{{`}}`}}")
#
#
# def unescape(s):
# return s.replace("\{\{", "{{").replace("\}\}", "}}")


# def yaml_str_repr(struct, indent=2):
# """represent yaml as a string"""
# text = yaml.dump(
# struct,
# width=1000, # to disable line wrapping
# default_flow_style=False # to disable multiple items on single line
# )
# text = escape(text) # escape {{ and }} for helm
# text = unescape(text) # unescape \{\{ and \}\} for templating
# text = textwrap.indent(text, ' ' * indent)
# return text


def convert_cluster_name_to_linkUrl(key, content_struct):
try:
if key == 'rows':
Expand Down

0 comments on commit 62239bf

Please sign in to comment.