From 5d155cbdf9142de92f2b6ff2a6e2070037ac515d Mon Sep 17 00:00:00 2001 From: Tom Kennes Date: Tue, 9 May 2023 12:41:12 +0200 Subject: [PATCH 1/5] adding correct annotations for svcms and fixing sa Signed-off-by: Tom Kennes --- keda/templates/01-serviceaccount.yaml | 2 +- keda/templates/17-keda-servicemonitor.yaml | 2 +- keda/templates/27-metrics-servicemonitor.yaml | 2 +- keda/templates/33-webhooks-servicemonitor.yaml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/keda/templates/01-serviceaccount.yaml b/keda/templates/01-serviceaccount.yaml index 6610f3c9..06db4e8b 100644 --- a/keda/templates/01-serviceaccount.yaml +++ b/keda/templates/01-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/17-keda-servicemonitor.yaml b/keda/templates/17-keda-servicemonitor.yaml index f093a506..579b1475 100644 --- a/keda/templates/17-keda-servicemonitor.yaml +++ b/keda/templates/17-keda-servicemonitor.yaml @@ -4,7 +4,7 @@ kind: ServiceMonitor metadata: name: {{ .Values.operator.name }} annotations: - {{- toYaml .Values.additionalAnnotations | nindent 4 }} + {{- toYaml .Values.prometheus.operator.serviceMonitor.additionalAnnotations | nindent 4 }} labels: app.kubernetes.io/name: {{ .Values.operator.name }} {{- include "keda.labels" . | indent 4 }} diff --git a/keda/templates/27-metrics-servicemonitor.yaml b/keda/templates/27-metrics-servicemonitor.yaml index 8eff6b60..e02d493b 100644 --- a/keda/templates/27-metrics-servicemonitor.yaml +++ b/keda/templates/27-metrics-servicemonitor.yaml @@ -4,7 +4,7 @@ kind: ServiceMonitor metadata: name: {{ .Values.operator.name }}-metrics-apiserver annotations: - {{- toYaml .Values.additionalAnnotations | nindent 4 }} + {{- toYaml .Values.prometheus.metricServer.serviceMonitor.additionalAnnotations | nindent 4 }} labels: app.kubernetes.io/name: {{ .Values.operator.name }} {{- include "keda.labels" . | indent 4 }} diff --git a/keda/templates/33-webhooks-servicemonitor.yaml b/keda/templates/33-webhooks-servicemonitor.yaml index b0fcb126..f5a99aba 100644 --- a/keda/templates/33-webhooks-servicemonitor.yaml +++ b/keda/templates/33-webhooks-servicemonitor.yaml @@ -5,7 +5,7 @@ kind: ServiceMonitor metadata: name: {{ .Values.webhooks.name }} annotations: - {{- toYaml .Values.additionalAnnotations | nindent 4 }} + {{- toYaml .Values.prometheus.webhooks.serviceMonitor.additionalAnnotations | nindent 4 }} labels: app.kubernetes.io/name: {{ .Values.webhooks.name }} {{- include "keda.labels" . | indent 4 }} From 285a67d14463074fbcd6dc72820c2ba3e2513fa2 Mon Sep 17 00:00:00 2001 From: Tom Kennes Date: Tue, 9 May 2023 12:59:34 +0200 Subject: [PATCH 2/5] fixing annotations style for svcms Signed-off-by: Tom Kennes --- keda/templates/17-keda-podmonitor.yaml | 4 +++- keda/templates/17-keda-servicemonitor.yaml | 4 +++- keda/templates/26-metrics-podmonitor.yaml | 4 +++- keda/templates/27-metrics-servicemonitor.yaml | 4 +++- keda/templates/33-webhooks-servicemonitor.yaml | 4 +++- keda/values.yaml | 5 +++++ 6 files changed, 20 insertions(+), 5 deletions(-) diff --git a/keda/templates/17-keda-podmonitor.yaml b/keda/templates/17-keda-podmonitor.yaml index 30986ae6..3abe1784 100644 --- a/keda/templates/17-keda-podmonitor.yaml +++ b/keda/templates/17-keda-podmonitor.yaml @@ -3,8 +3,10 @@ apiVersion: monitoring.coreos.com/v1 kind: PodMonitor metadata: name: {{ .Values.operator.name }} + {{- with .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/17-keda-servicemonitor.yaml b/keda/templates/17-keda-servicemonitor.yaml index 579b1475..08ce17c6 100644 --- a/keda/templates/17-keda-servicemonitor.yaml +++ b/keda/templates/17-keda-servicemonitor.yaml @@ -3,8 +3,10 @@ apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: name: {{ .Values.operator.name }} + {{- with .Values.prometheus.operator.serviceMonitor.annotations }} annotations: - {{- toYaml .Values.prometheus.operator.serviceMonitor.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/26-metrics-podmonitor.yaml b/keda/templates/26-metrics-podmonitor.yaml index bfcbfb06..41290fdd 100644 --- a/keda/templates/26-metrics-podmonitor.yaml +++ b/keda/templates/26-metrics-podmonitor.yaml @@ -3,8 +3,10 @@ apiVersion: monitoring.coreos.com/v1 kind: PodMonitor metadata: name: {{ .Values.operator.name }}-metrics-apiserver + {{- with .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/27-metrics-servicemonitor.yaml b/keda/templates/27-metrics-servicemonitor.yaml index e02d493b..dda3f2d5 100644 --- a/keda/templates/27-metrics-servicemonitor.yaml +++ b/keda/templates/27-metrics-servicemonitor.yaml @@ -3,8 +3,10 @@ apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: name: {{ .Values.operator.name }}-metrics-apiserver + {{- with .Values.prometheus.metricServer.serviceMonitor.annotations }} annotations: - {{- toYaml .Values.prometheus.metricServer.serviceMonitor.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/33-webhooks-servicemonitor.yaml b/keda/templates/33-webhooks-servicemonitor.yaml index f5a99aba..c9e68df5 100644 --- a/keda/templates/33-webhooks-servicemonitor.yaml +++ b/keda/templates/33-webhooks-servicemonitor.yaml @@ -4,8 +4,10 @@ apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: name: {{ .Values.webhooks.name }} + {{- with .Values.prometheus.webhooks.serviceMonitor.annotations }} annotations: - {{- toYaml .Values.prometheus.webhooks.serviceMonitor.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 4e96febb..96486255 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: [] From ccb72432940ebc9456b87a09b83f90af3f3efd76 Mon Sep 17 00:00:00 2001 From: Tom Kennes Date: Tue, 9 May 2023 13:26:57 +0200 Subject: [PATCH 3/5] removing additionalAnnotations per pod/svc monitor Signed-off-by: Tom Kennes --- 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 | 2 +- keda/templates/33-webhooks-servicemonitor.yaml | 2 +- keda/values.yaml | 5 ----- 6 files changed, 5 insertions(+), 10 deletions(-) diff --git a/keda/templates/17-keda-podmonitor.yaml b/keda/templates/17-keda-podmonitor.yaml index 3abe1784..fed1fc5e 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.prometheus.operator.podMonitor.annotations }} + {{- with .Values.additionalAnnotations }} annotations: {{- toYaml . | nindent 4 }} {{- end }} diff --git a/keda/templates/17-keda-servicemonitor.yaml b/keda/templates/17-keda-servicemonitor.yaml index 08ce17c6..ea905658 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.prometheus.operator.serviceMonitor.annotations }} + {{- with .Values.additionalAnnotations }} annotations: {{- toYaml . | nindent 4 }} {{- end }} diff --git a/keda/templates/26-metrics-podmonitor.yaml b/keda/templates/26-metrics-podmonitor.yaml index 41290fdd..2c23e0f4 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.prometheus.metricServer.podMonitor.annotations }} + {{- with .Values.additionalAnnotations }} annotations: {{- toYaml . | nindent 4 }} {{- end }} diff --git a/keda/templates/27-metrics-servicemonitor.yaml b/keda/templates/27-metrics-servicemonitor.yaml index dda3f2d5..9002bc94 100644 --- a/keda/templates/27-metrics-servicemonitor.yaml +++ b/keda/templates/27-metrics-servicemonitor.yaml @@ -3,7 +3,7 @@ apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: name: {{ .Values.operator.name }}-metrics-apiserver - {{- with .Values.prometheus.metricServer.serviceMonitor.annotations }} + {{- with .Values.additionalAnnotations }} annotations: {{- toYaml . | nindent 4 }} {{- end }} diff --git a/keda/templates/33-webhooks-servicemonitor.yaml b/keda/templates/33-webhooks-servicemonitor.yaml index c9e68df5..5bb12f4c 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.prometheus.webhooks.serviceMonitor.annotations }} + {{- with .Values.additionalAnnotations }} annotations: {{- toYaml . | nindent 4 }} {{- end }} diff --git a/keda/values.yaml b/keda/values.yaml index 96486255..4e96febb 100644 --- a/keda/values.yaml +++ b/keda/values.yaml @@ -369,7 +369,6 @@ prometheus: serviceMonitor: # Enables ServiceMonitor creation for the Prometheus Operator enabled: false - annotations: {} jobLabel: targetLabels: [] podTargetLabels: [] @@ -382,7 +381,6 @@ prometheus: podMonitor: # Enables PodMonitor creation for the Prometheus Operator enabled: false - annotations: {} interval: scrapeTimeout: namespace: @@ -394,7 +392,6 @@ prometheus: serviceMonitor: # Enables ServiceMonitor creation for the Prometheus Operator enabled: false - annotations: {} jobLabel: targetLabels: [] podTargetLabels: [] @@ -407,7 +404,6 @@ prometheus: podMonitor: # Enables PodMonitor creation for the Prometheus Operator enabled: false - annotations: {} interval: scrapeTimeout: namespace: @@ -433,7 +429,6 @@ prometheus: serviceMonitor: # Enables ServiceMonitor creation for the Prometheus webhooks enabled: false - annotations: {} jobLabel: targetLabels: [] podTargetLabels: [] From 604bc7e0b817ea36a13e7f015242b5d1babbddbf Mon Sep 17 00:00:00 2001 From: Tom Kennes Date: Wed, 10 May 2023 19:28:45 +0200 Subject: [PATCH 4/5] merging annotations globally and locally Signed-off-by: Tom Kennes --- 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: [] From 7c43d45ec8251188c2404a35ced9cd0513e4c7dc Mon Sep 17 00:00:00 2001 From: Tom Kennes Date: Fri, 9 Jun 2023 13:21:15 +0200 Subject: [PATCH 5/5] addingn unnecessary documentation Signed-off-by: Tom Kennes --- keda/values.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/keda/values.yaml b/keda/values.yaml index c7785c9d..4f29c0b5 100644 --- a/keda/values.yaml +++ b/keda/values.yaml @@ -368,6 +368,7 @@ prometheus: serviceMonitor: # Enables ServiceMonitor creation for the Prometheus Operator enabled: false + # Annotations specific for the servicemonitor of the metricServer annotations: {} jobLabel: targetLabels: [] @@ -382,6 +383,7 @@ prometheus: podMonitor: # Enables PodMonitor creation for the Prometheus Operator enabled: false + # Annotations specific for the podmnitor of the metricServer annotations: {} interval: scrapeTimeout: @@ -394,6 +396,7 @@ prometheus: serviceMonitor: # Enables ServiceMonitor creation for the Prometheus Operator enabled: false + # Annotations specific for the servicemonitor of the operator annotations: {} jobLabel: targetLabels: [] @@ -434,6 +437,7 @@ prometheus: serviceMonitor: # Enables ServiceMonitor creation for the Prometheus webhooks enabled: false + # Annotations specific for the servicemonitor of the webhooks annotations: {} jobLabel: targetLabels: []