Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[kube-prometheus-stack] Fix IO panels in Cluster Overview #3902

Merged
merged 1 commit into from
Oct 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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: 51.7.0
version: 51.8.0
appVersion: v0.68.0
kubeVersion: ">=1.19.0-0"
home: https://github.com/prometheus-operator/kube-prometheus
Expand Down
17 changes: 17 additions & 0 deletions charts/kube-prometheus-stack/hack/sync_grafana_dashboards.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,18 @@ def yaml_str_repr(struct, indent=2):
return text


def replace_nested_key(data, key, value, replace):
if isinstance(data, dict):
return {
k: replace if k == key and v == value else replace_nested_key(v, key, value, replace)
for k, v in data.items()
}
elif isinstance(data, list):
return [replace_nested_key(v, key, value, replace) for v in data]
else:
return data


def patch_dashboards_json(content, multicluster_key):
try:
content_struct = json.loads(content)
Expand All @@ -115,6 +127,11 @@ def patch_dashboards_json(content, multicluster_key):
variable['hide'] = ':multicluster:'
overwrite_list.append(variable)
content_struct['templating']['list'] = overwrite_list

# Replace decimals=-1 with decimals= (nil value)
# ref: https://github.com/kubernetes-monitoring/kubernetes-mixin/pull/859
content_struct = replace_nested_key(content_struct, "decimals", -1, None)

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

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.