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

fix: multi-cluster.libsonnet to support grafana dashboard join "byField" Selector #966

Merged
merged 3 commits into from
Oct 4, 2024

Conversation

danushadhitya
Copy link
Contributor

@danushadhitya danushadhitya commented Aug 19, 2024

Since, most of the selectors for the dashboard are overriden by custom variables.

File in path: dashboards/resources/multi-cluster.libsonnet does have the tranformation "byField" Selector hardcoded as "cluster" but whereas all other clustername selectors use the override variable "%(clusterLabel)s". This fork contains the change of converting hard-coded selector to over-ride selector which supports grafana dashboard.

Since, most of the selectors for the dashboard are overriden by custom variables. 

File in path: dashboards/resources/multi-cluster.libsonnet does have the tranformation "byField" Selector hardcoded as "cluster" but whereas all other clustername selectors use the override variable "%(clusterLabel)s". Apparently, this fork contains the change of converting hard-coded selector to over-ride selector.
@danushadhitya danushadhitya changed the title Update multi-cluster.libsonnet fix: multi-cluster.libsonnet to support grafana dashboard join "byField" Selector Aug 19, 2024
@n888
Copy link
Contributor

n888 commented Aug 19, 2024

Hi @danushadhitya, thank you for the PR.

I'm seeing an interpolation issue, which could be related to how withOptions fields are parsed, could you try this ?

byField: std.format('%s', $._config.clusterLabel)

@danushadhitya
Copy link
Contributor Author

danushadhitya commented Aug 20, 2024

Thanks for the comment @n888. I have fixed it now.

@n888
Copy link
Contributor

n888 commented Aug 21, 2024

LGTM

Local diff test with k8s_cluster_name clusterLabel:

index e6bb1b71..c3333fb2 100644
--- a/charts/grafana/mixin/dashboards/k8s-resources-multicluster.json
+++ b/charts/grafana/mixin/dashboards/k8s-resources-multicluster.json
@@ -354,7 +354,7 @@
                {
                   "id": "joinByField",
                   "options": {
-                     "byField": "cluster",
+                     "byField": "k8s_cluster_name",
                      "mode": "outer"
                   }
                },
@@ -542,7 +542,7 @@
                {
                   "id": "joinByField",
                   "options": {
-                     "byField": "cluster",
+                     "byField": "k8s_cluster_name",
                      "mode": "outer"
                   }
                },

@povilasv povilasv merged commit abe5031 into kubernetes-monitoring:master Oct 4, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants