Skip to content

Commit

Permalink
[kube-prometheus-stack] Fix Grafana Deeplinks (#4087)
Browse files Browse the repository at this point in the history
* [kube-prometheus-stack] Fix Grafana Deeplinks

Signed-off-by: Jan-Otto Kröpke <[email protected]>

* Update Chart.yaml

Signed-off-by: Jan-Otto Kröpke <[email protected]>

---------

Signed-off-by: Jan-Otto Kröpke <[email protected]>
Signed-off-by: Jan-Otto Kröpke <[email protected]>
Co-authored-by: MH <[email protected]>
  • Loading branch information
jkroepke and zanhsieh authored Jan 16, 2024
1 parent 996078e commit ec71cad
Show file tree
Hide file tree
Showing 12 changed files with 26 additions and 11 deletions.
2 changes: 1 addition & 1 deletion charts/kube-prometheus-stack/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ name: kube-prometheus-stack
sources:
- https://github.com/prometheus-community/helm-charts
- https://github.com/prometheus-operator/kube-prometheus
version: 55.8.1
version: 55.8.2
appVersion: v0.70.0
kubeVersion: ">=1.19.0-0"
home: https://github.com/prometheus-operator/kube-prometheus
Expand Down
15 changes: 15 additions & 0 deletions charts/kube-prometheus-stack/hack/sync_grafana_dashboards.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,18 @@ def new_representer(dumper, data):
'k8s-resources-windows-pod': ' .Values.windowsMonitoring.enabled',
}

replacement_map = {
'var-namespace=$__cell_1': {
'replacement': 'var-namespace=${__data.fields.namespace}',
},
'var-type=$__cell_2': {
'replacement': 'var-type=${__data.fields.workload_type}',
},
'=$__cell': {
'replacement': '=${__value.text}',
},
}

# standard header
header = '''{{- /*
Generated from '%(name)s' from %(url)s
Expand Down Expand Up @@ -152,6 +164,9 @@ def patch_dashboards_json(content, multicluster_key):

content = json.dumps(content_struct, separators=(',', ':'))
content = content.replace('":multicluster:"', '`}}{{ if %s }}0{{ else }}2{{ end }}{{`' % multicluster_key,)

for line in replacement_map:
content = content.replace(line, replacement_map[line]['replacement'])
except (ValueError, KeyError):
pass

Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

0 comments on commit ec71cad

Please sign in to comment.