diff --git a/keda/templates/manager/podmonitor.yaml b/keda/templates/manager/podmonitor.yaml index bb83d08a..7deafeb6 100644 --- a/keda/templates/manager/podmonitor.yaml +++ b/keda/templates/manager/podmonitor.yaml @@ -3,8 +3,10 @@ apiVersion: monitoring.coreos.com/v1 kind: PodMonitor metadata: name: {{ .Values.operator.name }} + {{- with (mergeOverwrite (deepCopy .Values.additionalAnnotations) .Values.prometheus.operator.podMonitor.annotations) }} annotations: - {{- toYaml .Values.additionalAnnotations | nindent 4 }} + {{- toYaml . | nindent 4 }} + {{- end }} labels: app.kubernetes.io/name: {{ .Values.operator.name }} {{- include "keda.labels" . | indent 4 }} diff --git a/keda/templates/manager/servicemonitor.yaml b/keda/templates/manager/servicemonitor.yaml index 78be93d3..176dd664 100644 --- a/keda/templates/manager/servicemonitor.yaml +++ b/keda/templates/manager/servicemonitor.yaml @@ -3,8 +3,10 @@ apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: name: {{ .Values.operator.name }} + {{- with (mergeOverwrite (deepCopy .Values.additionalAnnotations) .Values.prometheus.operator.serviceMonitor.annotations) }} annotations: - {{- toYaml .Values.additionalAnnotations | nindent 4 }} + {{- toYaml . | nindent 4 }} + {{- end }} labels: app.kubernetes.io/name: {{ .Values.operator.name }} {{- include "keda.labels" . | indent 4 }} diff --git a/keda/templates/metrics-server/podmonitor.yaml b/keda/templates/metrics-server/podmonitor.yaml index 40476abd..5ed65b8f 100644 --- a/keda/templates/metrics-server/podmonitor.yaml +++ b/keda/templates/metrics-server/podmonitor.yaml @@ -3,8 +3,10 @@ apiVersion: monitoring.coreos.com/v1 kind: PodMonitor metadata: name: {{ .Values.operator.name }}-metrics-apiserver + {{- with (mergeOverwrite (deepCopy .Values.additionalAnnotations) .Values.prometheus.metricServer.podMonitor.annotations) }} annotations: - {{- toYaml .Values.additionalAnnotations | nindent 4 }} + {{- toYaml . | nindent 4 }} + {{- end }} labels: app.kubernetes.io/name: {{ .Values.operator.name }} {{- include "keda.labels" . | indent 4 }} diff --git a/keda/templates/metrics-server/servicemonitor.yaml b/keda/templates/metrics-server/servicemonitor.yaml index b007f4f3..14e3a7ce 100644 --- a/keda/templates/metrics-server/servicemonitor.yaml +++ b/keda/templates/metrics-server/servicemonitor.yaml @@ -3,8 +3,12 @@ apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: name: {{ .Values.operator.name }}-metrics-apiserver + {{- with (mergeOverwrite (deepCopy .Values.additionalAnnotations) .Values.prometheus.metricServer.serviceMonitor.annotations) }} annotations: - {{- toYaml .Values.additionalAnnotations | nindent 4 }} + {{- range $key, $value := . }} + {{ $key }}: {{ $value | quote }} + {{- end }} + {{- end }} labels: app.kubernetes.io/name: {{ .Values.operator.name }} {{- include "keda.labels" . | indent 4 }} diff --git a/keda/templates/serviceaccount.yaml b/keda/templates/serviceaccount.yaml index 6610f3c9..06db4e8b 100644 --- a/keda/templates/serviceaccount.yaml +++ b/keda/templates/serviceaccount.yaml @@ -11,7 +11,7 @@ metadata: {{- if or .Values.podIdentity.azureWorkload.enabled .Values.podIdentity.aws.irsa.enabled .Values.serviceAccount.annotations .Values.podIdentity.gcp.enabled }} annotations: {{- if .Values.additionalAnnotations }} - {{- toYaml .Values.additionalAnnotations | indent 4 }} + {{- toYaml .Values.additionalAnnotations | nindent 4 }} {{- end }} {{- if .Values.podIdentity.azureWorkload.enabled }} {{- if .Values.podIdentity.azureWorkload.clientId }} diff --git a/keda/templates/webhooks/servicemonitor.yaml b/keda/templates/webhooks/servicemonitor.yaml index 8baff86b..404db02d 100644 --- a/keda/templates/webhooks/servicemonitor.yaml +++ b/keda/templates/webhooks/servicemonitor.yaml @@ -4,8 +4,10 @@ apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: name: {{ .Values.webhooks.name }} + {{- with (mergeOverwrite (deepCopy .Values.additionalAnnotations) .Values.prometheus.webhooks.serviceMonitor.annotations) }} annotations: - {{- toYaml .Values.additionalAnnotations | nindent 4 }} + {{- toYaml . | nindent 4 }} + {{- end }} labels: app.kubernetes.io/name: {{ .Values.webhooks.name }} {{- include "keda.labels" . | indent 4 }} diff --git a/keda/values.yaml b/keda/values.yaml index 1d61163e..4f29c0b5 100644 --- a/keda/values.yaml +++ b/keda/values.yaml @@ -368,6 +368,8 @@ prometheus: serviceMonitor: # Enables ServiceMonitor creation for the Prometheus Operator enabled: false + # Annotations specific for the servicemonitor of the metricServer + annotations: {} jobLabel: targetLabels: [] podTargetLabels: [] @@ -381,6 +383,8 @@ prometheus: podMonitor: # Enables PodMonitor creation for the Prometheus Operator enabled: false + # Annotations specific for the podmnitor of the metricServer + annotations: {} interval: scrapeTimeout: namespace: @@ -392,6 +396,8 @@ prometheus: serviceMonitor: # Enables ServiceMonitor creation for the Prometheus Operator enabled: false + # Annotations specific for the servicemonitor of the operator + annotations: {} jobLabel: targetLabels: [] podTargetLabels: [] @@ -405,6 +411,7 @@ prometheus: podMonitor: # Enables PodMonitor creation for the Prometheus Operator enabled: false + annotations: {} interval: scrapeTimeout: namespace: @@ -430,6 +437,8 @@ prometheus: serviceMonitor: # Enables ServiceMonitor creation for the Prometheus webhooks enabled: false + # Annotations specific for the servicemonitor of the webhooks + annotations: {} jobLabel: targetLabels: [] podTargetLabels: [] @@ -443,6 +452,7 @@ prometheus: prometheusRules: # Enables PrometheusRules creation for the Prometheus Operator enabled: false + annotations: {} namespace: additionalLabels: {} alerts: []