From 55727c564111c92a660fdba0f9afee148c99e315 Mon Sep 17 00:00:00 2001 From: Tom Kennes Date: Wed, 10 May 2023 19:28:45 +0200 Subject: [PATCH] merging annotations globally and locally --- keda/templates/17-keda-podmonitor.yaml | 2 +- keda/templates/17-keda-servicemonitor.yaml | 2 +- keda/templates/26-metrics-podmonitor.yaml | 2 +- keda/templates/27-metrics-servicemonitor.yaml | 6 ++++-- keda/templates/33-webhooks-servicemonitor.yaml | 2 +- keda/values.yaml | 6 ++++++ 6 files changed, 14 insertions(+), 6 deletions(-) diff --git a/keda/templates/17-keda-podmonitor.yaml b/keda/templates/17-keda-podmonitor.yaml index fed1fc5e..08cfe79a 100644 --- a/keda/templates/17-keda-podmonitor.yaml +++ b/keda/templates/17-keda-podmonitor.yaml @@ -3,7 +3,7 @@ apiVersion: monitoring.coreos.com/v1 kind: PodMonitor metadata: name: {{ .Values.operator.name }} - {{- with .Values.additionalAnnotations }} + {{- with (mergeOverwrite (deepCopy .Values.additionalAnnotations) .Values.prometheus.operator.podMonitor.annotations) }} annotations: {{- toYaml . | nindent 4 }} {{- end }} diff --git a/keda/templates/17-keda-servicemonitor.yaml b/keda/templates/17-keda-servicemonitor.yaml index ea905658..ee982567 100644 --- a/keda/templates/17-keda-servicemonitor.yaml +++ b/keda/templates/17-keda-servicemonitor.yaml @@ -3,7 +3,7 @@ apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: name: {{ .Values.operator.name }} - {{- with .Values.additionalAnnotations }} + {{- with (mergeOverwrite (deepCopy .Values.additionalAnnotations) .Values.prometheus.operator.serviceMonitor.annotations) }} annotations: {{- toYaml . | nindent 4 }} {{- end }} diff --git a/keda/templates/26-metrics-podmonitor.yaml b/keda/templates/26-metrics-podmonitor.yaml index 2c23e0f4..cbc6c8bc 100644 --- a/keda/templates/26-metrics-podmonitor.yaml +++ b/keda/templates/26-metrics-podmonitor.yaml @@ -3,7 +3,7 @@ apiVersion: monitoring.coreos.com/v1 kind: PodMonitor metadata: name: {{ .Values.operator.name }}-metrics-apiserver - {{- with .Values.additionalAnnotations }} + {{- with (mergeOverwrite (deepCopy .Values.additionalAnnotations) .Values.prometheus.metricServer.podMonitor.annotations) }} annotations: {{- toYaml . | nindent 4 }} {{- end }} diff --git a/keda/templates/27-metrics-servicemonitor.yaml b/keda/templates/27-metrics-servicemonitor.yaml index 9002bc94..526768c9 100644 --- a/keda/templates/27-metrics-servicemonitor.yaml +++ b/keda/templates/27-metrics-servicemonitor.yaml @@ -3,9 +3,11 @@ apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: name: {{ .Values.operator.name }}-metrics-apiserver - {{- with .Values.additionalAnnotations }} + {{- with (mergeOverwrite (deepCopy .Values.additionalAnnotations) .Values.prometheus.metricServer.serviceMonitor.annotations) }} annotations: - {{- toYaml . | nindent 4 }} + {{- range $key, $value := . }} + {{ $key }}: {{ $value | quote }} + {{- end }} {{- end }} labels: app.kubernetes.io/name: {{ .Values.operator.name }} diff --git a/keda/templates/33-webhooks-servicemonitor.yaml b/keda/templates/33-webhooks-servicemonitor.yaml index 5bb12f4c..2eca993f 100644 --- a/keda/templates/33-webhooks-servicemonitor.yaml +++ b/keda/templates/33-webhooks-servicemonitor.yaml @@ -4,7 +4,7 @@ apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: name: {{ .Values.webhooks.name }} - {{- with .Values.additionalAnnotations }} + {{- with (mergeOverwrite (deepCopy .Values.additionalAnnotations) .Values.prometheus.webhooks.serviceMonitor.annotations) }} annotations: {{- toYaml . | nindent 4 }} {{- end }} diff --git a/keda/values.yaml b/keda/values.yaml index 4e96febb..a78a1c7d 100644 --- a/keda/values.yaml +++ b/keda/values.yaml @@ -369,6 +369,7 @@ prometheus: serviceMonitor: # Enables ServiceMonitor creation for the Prometheus Operator enabled: false + annotations: {} jobLabel: targetLabels: [] podTargetLabels: [] @@ -381,6 +382,7 @@ prometheus: podMonitor: # Enables PodMonitor creation for the Prometheus Operator enabled: false + annotations: {} interval: scrapeTimeout: namespace: @@ -392,6 +394,7 @@ prometheus: serviceMonitor: # Enables ServiceMonitor creation for the Prometheus Operator enabled: false + annotations: {} jobLabel: targetLabels: [] podTargetLabels: [] @@ -404,6 +407,7 @@ prometheus: podMonitor: # Enables PodMonitor creation for the Prometheus Operator enabled: false + annotations: {} interval: scrapeTimeout: namespace: @@ -429,6 +433,7 @@ prometheus: serviceMonitor: # Enables ServiceMonitor creation for the Prometheus webhooks enabled: false + annotations: {} jobLabel: targetLabels: [] podTargetLabels: [] @@ -441,6 +446,7 @@ prometheus: prometheusRules: # Enables PrometheusRules creation for the Prometheus Operator enabled: false + annotations: {} namespace: additionalLabels: {} alerts: []