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

Add new label to show grafana dashboards in ODC #1294

Merged
merged 1 commit into from
Jul 22, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 14 additions & 1 deletion jsonnet/grafana.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@ local grafana = import 'github.com/prometheus-operator/kube-prometheus/jsonnet/k

function(params)
local cfg = params;

// List of dashboards which should be shown in OCP developer perspective.
local odcDashboards = [
'grafana-dashboard-k8s-resources-namespace',
'grafana-dashboard-k8s-resources-workloads-namespace',
'grafana-dashboard-k8s-resources-pod',
'grafana-dashboard-k8s-resources-workload',
];

grafana(cfg) {

consoleDashboardDefinitions: {
Expand All @@ -12,7 +21,11 @@ function(params)
d {
metadata+: {
namespace: 'openshift-config-managed',
labels+: { 'console.openshift.io/dashboard': 'true' },
labels+: {
'console.openshift.io/dashboard': 'true',
} + if std.count(odcDashboards, d.metadata.name) > 0 then {
'console.openshift.io/odc-dashboard': 'true',
} else {},
},
},
$.dashboardDefinitions.items,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8872,6 +8872,7 @@ metadata:
app.kubernetes.io/part-of: openshift-monitoring
app.kubernetes.io/version: 7.5.5
console.openshift.io/dashboard: "true"
console.openshift.io/odc-dashboard: "true"
name: grafana-dashboard-k8s-resources-namespace
namespace: openshift-config-managed
---
Expand Down Expand Up @@ -12267,6 +12268,7 @@ metadata:
app.kubernetes.io/part-of: openshift-monitoring
app.kubernetes.io/version: 7.5.5
console.openshift.io/dashboard: "true"
console.openshift.io/odc-dashboard: "true"
name: grafana-dashboard-k8s-resources-pod
namespace: openshift-config-managed
---
Expand Down Expand Up @@ -14248,6 +14250,7 @@ metadata:
app.kubernetes.io/part-of: openshift-monitoring
app.kubernetes.io/version: 7.5.5
console.openshift.io/dashboard: "true"
console.openshift.io/odc-dashboard: "true"
name: grafana-dashboard-k8s-resources-workload
namespace: openshift-config-managed
---
Expand Down Expand Up @@ -16394,6 +16397,7 @@ metadata:
app.kubernetes.io/part-of: openshift-monitoring
app.kubernetes.io/version: 7.5.5
console.openshift.io/dashboard: "true"
console.openshift.io/odc-dashboard: "true"
name: grafana-dashboard-k8s-resources-workloads-namespace
namespace: openshift-config-managed
---
Expand Down