From 6b2e6b0208f7f76150019acab7eb4b0a6fc570ae Mon Sep 17 00:00:00 2001 From: Adrian Coman <1664229+azun@users.noreply.github.com> Date: Fri, 22 Sep 2023 20:21:25 +0300 Subject: [PATCH 1/2] Fixed default datasourceName selection --- dashboards/apiserver.libsonnet | 3 ++- dashboards/controller-manager.libsonnet | 3 ++- dashboards/kubelet.libsonnet | 3 ++- dashboards/network-usage/cluster-total.libsonnet | 3 ++- dashboards/network-usage/namespace-by-pod.libsonnet | 3 ++- dashboards/network-usage/namespace-by-workload.libsonnet | 3 ++- dashboards/network-usage/pod-total.libsonnet | 3 ++- dashboards/network-usage/workload-total.libsonnet | 3 ++- dashboards/persistentvolumesusage.libsonnet | 3 ++- dashboards/proxy.libsonnet | 3 ++- dashboards/resources/cluster.libsonnet | 2 +- dashboards/resources/multi-cluster.libsonnet | 2 +- dashboards/resources/namespace.libsonnet | 2 +- dashboards/resources/node.libsonnet | 2 +- dashboards/resources/pod.libsonnet | 2 +- dashboards/resources/workload-namespace.libsonnet | 2 +- dashboards/resources/workload.libsonnet | 2 +- dashboards/scheduler.libsonnet | 3 ++- dashboards/windows.libsonnet | 3 ++- 19 files changed, 31 insertions(+), 19 deletions(-) diff --git a/dashboards/apiserver.libsonnet b/dashboards/apiserver.libsonnet index e1d38c934..3e63842d9 100644 --- a/dashboards/apiserver.libsonnet +++ b/dashboards/apiserver.libsonnet @@ -205,7 +205,8 @@ local singlestat = grafana.singlestat; ).addTemplate( { current: { - text: 'default', + selected: true, + text: $._config.datasourceName, value: $._config.datasourceName, }, hide: 0, diff --git a/dashboards/controller-manager.libsonnet b/dashboards/controller-manager.libsonnet index e56010cd9..6b846b18e 100644 --- a/dashboards/controller-manager.libsonnet +++ b/dashboards/controller-manager.libsonnet @@ -135,7 +135,8 @@ local singlestat = grafana.singlestat; ).addTemplate( { current: { - text: 'default', + selected: true, + text: $._config.datasourceName, value: $._config.datasourceName, }, hide: 0, diff --git a/dashboards/kubelet.libsonnet b/dashboards/kubelet.libsonnet index 6069686c6..c2a0c1e3a 100644 --- a/dashboards/kubelet.libsonnet +++ b/dashboards/kubelet.libsonnet @@ -293,7 +293,8 @@ local statPanel = grafana.statPanel; ).addTemplate( { current: { - text: 'default', + selected: true, + text: $._config.datasourceName, value: $._config.datasourceName, }, hide: 0, diff --git a/dashboards/network-usage/cluster-total.libsonnet b/dashboards/network-usage/cluster-total.libsonnet index 52e0503e8..a20d0dd72 100644 --- a/dashboards/network-usage/cluster-total.libsonnet +++ b/dashboards/network-usage/cluster-total.libsonnet @@ -360,7 +360,8 @@ local annotation = grafana.annotation; .addTemplate( { current: { - text: 'default', + selected: true, + text: $._config.datasourceName, value: $._config.datasourceName, }, hide: 0, diff --git a/dashboards/network-usage/namespace-by-pod.libsonnet b/dashboards/network-usage/namespace-by-pod.libsonnet index 4ef52bae4..e10512131 100644 --- a/dashboards/network-usage/namespace-by-pod.libsonnet +++ b/dashboards/network-usage/namespace-by-pod.libsonnet @@ -357,7 +357,8 @@ local singlestat = grafana.singlestat; .addTemplate( { current: { - text: 'default', + selected: true, + text: $._config.datasourceName, value: $._config.datasourceName, }, hide: 0, diff --git a/dashboards/network-usage/namespace-by-workload.libsonnet b/dashboards/network-usage/namespace-by-workload.libsonnet index 310107d6a..f6e93cb59 100644 --- a/dashboards/network-usage/namespace-by-workload.libsonnet +++ b/dashboards/network-usage/namespace-by-workload.libsonnet @@ -386,7 +386,8 @@ local annotation = grafana.annotation; .addTemplate( { current: { - text: 'default', + selected: true, + text: $._config.datasourceName, value: $._config.datasourceName, }, hide: 0, diff --git a/dashboards/network-usage/pod-total.libsonnet b/dashboards/network-usage/pod-total.libsonnet index d9815abf5..a994c6b1e 100644 --- a/dashboards/network-usage/pod-total.libsonnet +++ b/dashboards/network-usage/pod-total.libsonnet @@ -256,7 +256,8 @@ local singlestat = grafana.singlestat; .addTemplate( { current: { - text: 'default', + selected: true, + text: $._config.datasourceName, value: $._config.datasourceName, }, hide: 0, diff --git a/dashboards/network-usage/workload-total.libsonnet b/dashboards/network-usage/workload-total.libsonnet index 5bff78686..46a204e6b 100644 --- a/dashboards/network-usage/workload-total.libsonnet +++ b/dashboards/network-usage/workload-total.libsonnet @@ -269,7 +269,8 @@ local annotation = grafana.annotation; .addTemplate( { current: { - text: 'default', + selected: true, + text: $._config.datasourceName, value: $._config.datasourceName, }, hide: 0, diff --git a/dashboards/persistentvolumesusage.libsonnet b/dashboards/persistentvolumesusage.libsonnet index a5bdd7e59..63f9deeef 100644 --- a/dashboards/persistentvolumesusage.libsonnet +++ b/dashboards/persistentvolumesusage.libsonnet @@ -114,7 +114,8 @@ local gauge = promgrafonnet.gauge; ).addTemplate( { current: { - text: 'default', + selected: true, + text: $._config.datasourceName, value: $._config.datasourceName, }, hide: 0, diff --git a/dashboards/proxy.libsonnet b/dashboards/proxy.libsonnet index 84198c133..57081bada 100644 --- a/dashboards/proxy.libsonnet +++ b/dashboards/proxy.libsonnet @@ -142,7 +142,8 @@ local singlestat = grafana.singlestat; ).addTemplate( { current: { - text: 'default', + selected: true, + text: $._config.datasourceName, value: $._config.datasourceName, }, hide: 0, diff --git a/dashboards/resources/cluster.libsonnet b/dashboards/resources/cluster.libsonnet index 01e0c3168..11851980d 100644 --- a/dashboards/resources/cluster.libsonnet +++ b/dashboards/resources/cluster.libsonnet @@ -131,7 +131,7 @@ local template = grafana.template; g.dashboard( '%(dashboardNamePrefix)sCompute Resources / Cluster' % $._config.grafanaK8s, uid=($._config.grafanaDashboardIDs['k8s-resources-cluster.json']), - datasource_regex=$._config.datasourceFilterRegex, + datasource_regex=$._config.datasourceFilterRegex, datasource=$._config.datasourceName, ) .addRow( (g.row('Headlines') + diff --git a/dashboards/resources/multi-cluster.libsonnet b/dashboards/resources/multi-cluster.libsonnet index 1843b46ac..525920e83 100644 --- a/dashboards/resources/multi-cluster.libsonnet +++ b/dashboards/resources/multi-cluster.libsonnet @@ -14,7 +14,7 @@ local g = import 'github.com/grafana/jsonnet-libs/grafana-builder/grafana.libson g.dashboard( '%(dashboardNamePrefix)sCompute Resources / Multi-Cluster' % $._config.grafanaK8s, uid=($._config.grafanaDashboardIDs['k8s-resources-multicluster.json']), - datasource_regex=$._config.datasourceFilterRegex, + datasource_regex=$._config.datasourceFilterRegex, datasource=$._config.datasourceName, ).addRow( (g.row('Headlines') + { diff --git a/dashboards/resources/namespace.libsonnet b/dashboards/resources/namespace.libsonnet index 2f0f979ca..3c0cb7b77 100644 --- a/dashboards/resources/namespace.libsonnet +++ b/dashboards/resources/namespace.libsonnet @@ -132,7 +132,7 @@ local template = grafana.template; g.dashboard( '%(dashboardNamePrefix)sCompute Resources / Namespace (Pods)' % $._config.grafanaK8s, uid=($._config.grafanaDashboardIDs['k8s-resources-namespace.json']), - datasource_regex=$._config.datasourceFilterRegex, + datasource_regex=$._config.datasourceFilterRegex, datasource=$._config.datasourceName, ) .addRow( (g.row('Headlines') + diff --git a/dashboards/resources/node.libsonnet b/dashboards/resources/node.libsonnet index 0f7fd2dd9..6ea6806d1 100644 --- a/dashboards/resources/node.libsonnet +++ b/dashboards/resources/node.libsonnet @@ -39,7 +39,7 @@ local template = grafana.template; g.dashboard( '%(dashboardNamePrefix)sCompute Resources / Node (Pods)' % $._config.grafanaK8s, uid=($._config.grafanaDashboardIDs['k8s-resources-node.json']), - datasource_regex=$._config.datasourceFilterRegex, + datasource_regex=$._config.datasourceFilterRegex, datasource=$._config.datasourceName, ) .addRow( g.row('CPU Usage') diff --git a/dashboards/resources/pod.libsonnet b/dashboards/resources/pod.libsonnet index 86b0e9c9f..704eb1a8c 100644 --- a/dashboards/resources/pod.libsonnet +++ b/dashboards/resources/pod.libsonnet @@ -103,7 +103,7 @@ local template = grafana.template; g.dashboard( '%(dashboardNamePrefix)sCompute Resources / Pod' % $._config.grafanaK8s, uid=($._config.grafanaDashboardIDs['k8s-resources-pod.json']), - datasource_regex=$._config.datasourceFilterRegex, + datasource_regex=$._config.datasourceFilterRegex, datasource=$._config.datasourceName, ) .addRow( g.row('CPU Usage') diff --git a/dashboards/resources/workload-namespace.libsonnet b/dashboards/resources/workload-namespace.libsonnet index f2dc4d8a4..53773335f 100644 --- a/dashboards/resources/workload-namespace.libsonnet +++ b/dashboards/resources/workload-namespace.libsonnet @@ -164,7 +164,7 @@ local template = grafana.template; g.dashboard( '%(dashboardNamePrefix)sCompute Resources / Namespace (Workloads)' % $._config.grafanaK8s, uid=($._config.grafanaDashboardIDs['k8s-resources-workloads-namespace.json']), - datasource_regex=$._config.datasourceFilterRegex, + datasource_regex=$._config.datasourceFilterRegex, datasource=$._config.datasourceName, ) .addRow( g.row('CPU Usage') diff --git a/dashboards/resources/workload.libsonnet b/dashboards/resources/workload.libsonnet index f538ed182..746a084c2 100644 --- a/dashboards/resources/workload.libsonnet +++ b/dashboards/resources/workload.libsonnet @@ -156,7 +156,7 @@ local template = grafana.template; g.dashboard( '%(dashboardNamePrefix)sCompute Resources / Workload' % $._config.grafanaK8s, uid=($._config.grafanaDashboardIDs['k8s-resources-workload.json']), - datasource_regex=$._config.datasourceFilterRegex, + datasource_regex=$._config.datasourceFilterRegex, datasource=$._config.datasourceName, ) .addRow( g.row('CPU Usage') diff --git a/dashboards/scheduler.libsonnet b/dashboards/scheduler.libsonnet index 63ad000ce..8566c23bc 100644 --- a/dashboards/scheduler.libsonnet +++ b/dashboards/scheduler.libsonnet @@ -130,7 +130,8 @@ local singlestat = grafana.singlestat; ).addTemplate( { current: { - text: 'default', + selected: true, + text: $._config.datasourceName, value: $._config.datasourceName, }, hide: 0, diff --git a/dashboards/windows.libsonnet b/dashboards/windows.libsonnet index c4097f6ca..d28cfb5d6 100644 --- a/dashboards/windows.libsonnet +++ b/dashboards/windows.libsonnet @@ -149,7 +149,8 @@ local g = import 'github.com/grafana/jsonnet-libs/grafana-builder/grafana.libson ).addTemplate( { current: { - text: 'default', + selected: true, + text: $._config.datasourceName, value: $._config.datasourceName, }, hide: 0, From 4a78534999c7fa392af869f22fe837f23bd894fc Mon Sep 17 00:00:00 2001 From: Adrian Coman <1664229+azun@users.noreply.github.com> Date: Mon, 25 Sep 2023 11:51:04 +0300 Subject: [PATCH 2/2] Fixed formatting --- dashboards/resources/cluster.libsonnet | 3 ++- dashboards/resources/multi-cluster.libsonnet | 3 ++- dashboards/resources/namespace.libsonnet | 3 ++- dashboards/resources/node.libsonnet | 3 ++- dashboards/resources/pod.libsonnet | 3 ++- dashboards/resources/workload-namespace.libsonnet | 3 ++- dashboards/resources/workload.libsonnet | 3 ++- 7 files changed, 14 insertions(+), 7 deletions(-) diff --git a/dashboards/resources/cluster.libsonnet b/dashboards/resources/cluster.libsonnet index 11851980d..f3f8b20d9 100644 --- a/dashboards/resources/cluster.libsonnet +++ b/dashboards/resources/cluster.libsonnet @@ -131,7 +131,8 @@ local template = grafana.template; g.dashboard( '%(dashboardNamePrefix)sCompute Resources / Cluster' % $._config.grafanaK8s, uid=($._config.grafanaDashboardIDs['k8s-resources-cluster.json']), - datasource_regex=$._config.datasourceFilterRegex, datasource=$._config.datasourceName, + datasource_regex=$._config.datasourceFilterRegex, + datasource=$._config.datasourceName, ) .addRow( (g.row('Headlines') + diff --git a/dashboards/resources/multi-cluster.libsonnet b/dashboards/resources/multi-cluster.libsonnet index 525920e83..b13276c3c 100644 --- a/dashboards/resources/multi-cluster.libsonnet +++ b/dashboards/resources/multi-cluster.libsonnet @@ -14,7 +14,8 @@ local g = import 'github.com/grafana/jsonnet-libs/grafana-builder/grafana.libson g.dashboard( '%(dashboardNamePrefix)sCompute Resources / Multi-Cluster' % $._config.grafanaK8s, uid=($._config.grafanaDashboardIDs['k8s-resources-multicluster.json']), - datasource_regex=$._config.datasourceFilterRegex, datasource=$._config.datasourceName, + datasource_regex=$._config.datasourceFilterRegex, + datasource=$._config.datasourceName, ).addRow( (g.row('Headlines') + { diff --git a/dashboards/resources/namespace.libsonnet b/dashboards/resources/namespace.libsonnet index 3c0cb7b77..01a9f06b7 100644 --- a/dashboards/resources/namespace.libsonnet +++ b/dashboards/resources/namespace.libsonnet @@ -132,7 +132,8 @@ local template = grafana.template; g.dashboard( '%(dashboardNamePrefix)sCompute Resources / Namespace (Pods)' % $._config.grafanaK8s, uid=($._config.grafanaDashboardIDs['k8s-resources-namespace.json']), - datasource_regex=$._config.datasourceFilterRegex, datasource=$._config.datasourceName, + datasource_regex=$._config.datasourceFilterRegex, + datasource=$._config.datasourceName, ) .addRow( (g.row('Headlines') + diff --git a/dashboards/resources/node.libsonnet b/dashboards/resources/node.libsonnet index 6ea6806d1..55ac10b5d 100644 --- a/dashboards/resources/node.libsonnet +++ b/dashboards/resources/node.libsonnet @@ -39,7 +39,8 @@ local template = grafana.template; g.dashboard( '%(dashboardNamePrefix)sCompute Resources / Node (Pods)' % $._config.grafanaK8s, uid=($._config.grafanaDashboardIDs['k8s-resources-node.json']), - datasource_regex=$._config.datasourceFilterRegex, datasource=$._config.datasourceName, + datasource_regex=$._config.datasourceFilterRegex, + datasource=$._config.datasourceName, ) .addRow( g.row('CPU Usage') diff --git a/dashboards/resources/pod.libsonnet b/dashboards/resources/pod.libsonnet index 704eb1a8c..6e8832de4 100644 --- a/dashboards/resources/pod.libsonnet +++ b/dashboards/resources/pod.libsonnet @@ -103,7 +103,8 @@ local template = grafana.template; g.dashboard( '%(dashboardNamePrefix)sCompute Resources / Pod' % $._config.grafanaK8s, uid=($._config.grafanaDashboardIDs['k8s-resources-pod.json']), - datasource_regex=$._config.datasourceFilterRegex, datasource=$._config.datasourceName, + datasource_regex=$._config.datasourceFilterRegex, + datasource=$._config.datasourceName, ) .addRow( g.row('CPU Usage') diff --git a/dashboards/resources/workload-namespace.libsonnet b/dashboards/resources/workload-namespace.libsonnet index 53773335f..d8b062c89 100644 --- a/dashboards/resources/workload-namespace.libsonnet +++ b/dashboards/resources/workload-namespace.libsonnet @@ -164,7 +164,8 @@ local template = grafana.template; g.dashboard( '%(dashboardNamePrefix)sCompute Resources / Namespace (Workloads)' % $._config.grafanaK8s, uid=($._config.grafanaDashboardIDs['k8s-resources-workloads-namespace.json']), - datasource_regex=$._config.datasourceFilterRegex, datasource=$._config.datasourceName, + datasource_regex=$._config.datasourceFilterRegex, + datasource=$._config.datasourceName, ) .addRow( g.row('CPU Usage') diff --git a/dashboards/resources/workload.libsonnet b/dashboards/resources/workload.libsonnet index 746a084c2..a2581cc3d 100644 --- a/dashboards/resources/workload.libsonnet +++ b/dashboards/resources/workload.libsonnet @@ -156,7 +156,8 @@ local template = grafana.template; g.dashboard( '%(dashboardNamePrefix)sCompute Resources / Workload' % $._config.grafanaK8s, uid=($._config.grafanaDashboardIDs['k8s-resources-workload.json']), - datasource_regex=$._config.datasourceFilterRegex, datasource=$._config.datasourceName, + datasource_regex=$._config.datasourceFilterRegex, + datasource=$._config.datasourceName, ) .addRow( g.row('CPU Usage')