diff --git a/deploy/charts/version-checker/README.md b/deploy/charts/version-checker/README.md index a53940b4..03b7716c 100644 --- a/deploy/charts/version-checker/README.md +++ b/deploy/charts/version-checker/README.md @@ -23,6 +23,7 @@ A Helm chart for version-checker | additionalLabels | object | `{}` | Additional Labels to apply to Service and Deployment/Pod Objects | | affinity | object | `{}` | Set affinity | | dashboards.enabled | bool | `false` | Deploy Grafana Dashboard(s) for version-checker | +| dashboards.annotations | object | `{}` | Additional annotations to add to the Grafana Dashboard resources | | dashboards.grafana | string | `""` | Grafana instance to associate the Dashboard with when using GrafanaOperator | | dashboards.labels | object | `{}` | Additional labels to add to the Grafana Dashboard | | docker.password | string | `nil` | Password to authenticate with docker registry | diff --git a/deploy/charts/version-checker/templates/dashboards.yaml b/deploy/charts/version-checker/templates/dashboards.yaml index 96a31e01..994aa814 100644 --- a/deploy/charts/version-checker/templates/dashboards.yaml +++ b/deploy/charts/version-checker/templates/dashboards.yaml @@ -10,6 +10,10 @@ metadata: {{- if .Values.dashboards.labels }} {{ .Values.dashboards.labels | toYaml | nindent 4}} {{- end }} + {{- if .Values.dashboards.annotations }} + annotations: + {{- .Values.dashboards.annotations | toYaml | nindent 4}} + {{- end }} data: internal.json: |- {{- .Files.Get "dashboards/internal.json" | nindent 4 }} @@ -25,8 +29,12 @@ metadata: labels: {{- include "version-checker.labels" . | nindent 4 }} {{- if .Values.dashboards.labels }} - {{- .Values.dashboards.labels | toYaml }} + {{- .Values.dashboards.labels | toYaml | nindent 4}} {{- end }} + {{- if .Values.dashboards.annotations }} + annotations: + {{- .Values.dashboards.annotations | toYaml | nindent 4}} + {{- end }} spec: instanceSelector: matchLabels: @@ -43,8 +51,12 @@ metadata: labels: {{- include "version-checker.labels" . | nindent 4 }} {{- if .Values.dashboards.labels }} - {{- .Values.dashboards.labels | toYaml }} + {{- .Values.dashboards.labels | toYaml | nindent 4}} {{- end }} + {{- if .Values.dashboards.annotations }} + annotations: + {{- .Values.dashboards.annotations | toYaml | nindent 4}} + {{- end }} spec: instanceSelector: matchLabels: diff --git a/deploy/charts/version-checker/tests/dashboards_test.yaml b/deploy/charts/version-checker/tests/dashboards_test.yaml index 8c8f58ea..9bd0f63a 100644 --- a/deploy/charts/version-checker/tests/dashboards_test.yaml +++ b/deploy/charts/version-checker/tests/dashboards_test.yaml @@ -21,10 +21,12 @@ tests: - isNotEmpty: path: .data["internal.json"] - - it: works w/ custom labels + - it: works w/ custom labels and annotations set: dashboards.labels: grafana: "123" + dashboards.annotations: + grafana_folder: "version-checker" asserts: - isKind: of: ConfigMap @@ -33,8 +35,14 @@ tests: - equal: path: metadata.labels.grafana value: "123" + - equal: + path: metadata.annotations.grafana_folder + value: "version-checker" - it: Works w/ GrafanaDashboard + set: + dashboards.annotations: + grafana_folder: "version-checker" capabilities: apiVersions: - grafana.integreatly.org/v1beta1/GrafanaDashboard @@ -62,6 +70,9 @@ tests: - equal: path: spec.configMapRef.name value: version-checker-dashboards + - equal: + path: metadata.annotations.grafana_folder + value: "version-checker" - documentSelector: path: metadata.name diff --git a/deploy/charts/version-checker/values.yaml b/deploy/charts/version-checker/values.yaml index 9ff718ee..46ce5364 100644 --- a/deploy/charts/version-checker/values.yaml +++ b/deploy/charts/version-checker/values.yaml @@ -216,6 +216,8 @@ prometheus: dashboards: # -- Deploy Grafana Dashboard(s) for version-checker enabled: false + # -- Additional annotations to add to the Grafana Dashboard resources + annotations: {} # -- Additional labels to add to the Grafana Dashboard labels: {} # -- Grafana instance to associate the Dashboard with when using GrafanaOperator