From 0bd1bc1ad866305c89b106e893d6795adde25327 Mon Sep 17 00:00:00 2001 From: Alexey Kubrinsky Date: Mon, 5 Jun 2023 17:46:07 +0200 Subject: [PATCH] Fix servicemonitor relabeling Signed-off-by: Alexey Kubrinsky --- .github/workflows/ci-core.yml | 23 +++++++++++++++---- keda/templates/manager/servicemonitor.yaml | 6 ++--- .../metrics-server/servicemonitor.yaml | 6 ++--- keda/templates/webhooks/servicemonitor.yaml | 8 +++---- 4 files changed, 29 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci-core.yml b/.github/workflows/ci-core.yml index 746eeb2a..44b5521e 100644 --- a/.github/workflows/ci-core.yml +++ b/.github/workflows/ci-core.yml @@ -64,7 +64,7 @@ jobs: - name: Helm install uses: Azure/setup-helm@v3 - + - name: Create k8s ${{ matrix.kubernetesVersion }} Kind Cluster uses: helm/kind-action@main with: @@ -88,9 +88,9 @@ jobs: image: keda: tag: main - metricsApiServer: + metricsApiServer: tag: main - webhooks: + webhooks: tag: main podIdentity: azureWorkload: @@ -99,7 +99,7 @@ jobs: clientId: ${{ matrix.clientId }} podDisruptionBudget: operator: - maxUnavailable: 1 + maxUnavailable: 1 metricServer: maxUnavailable: 1 webhooks: @@ -109,10 +109,25 @@ jobs: enabled: true podMonitor: enabled: true + serviceMonitor: + enabled: true + relabellings: + - regex: (go_.*) + action: drop webhooks: enabled: true serviceMonitor: enabled: true + relabellings: + - regex: (go_.*) + action: drop + metricServer: + enabled: true + serviceMonitor: + enabled: true + relabellings: + - regex: (go_.*) + action: drop webhooks: failurePolicy: Fail certificates: diff --git a/keda/templates/manager/servicemonitor.yaml b/keda/templates/manager/servicemonitor.yaml index 76da6822..81517c31 100644 --- a/keda/templates/manager/servicemonitor.yaml +++ b/keda/templates/manager/servicemonitor.yaml @@ -20,11 +20,11 @@ spec: {{- end }} {{- with .Values.prometheus.operator.serviceMonitor.targetLabels }} targetLabels: - {{ toYaml . | indent 4 }} + {{- toYaml . | nindent 4 }} {{- end }} {{- with .Values.prometheus.operator.serviceMonitor.podTargetLabels }} podTargetLabels: - {{ toYaml . | indent 4 }} + {{- toYaml . | nindent 4 }} {{- end }} endpoints: - port: {{ .Values.prometheus.operator.serviceMonitor.port }} @@ -40,7 +40,7 @@ spec: {{- end }} {{- with .Values.prometheus.operator.serviceMonitor.relabellings }} relabelings: - {{ toYaml . | indent 6 }} + {{- toYaml . | nindent 6 }} {{- end }} namespaceSelector: matchNames: diff --git a/keda/templates/metrics-server/servicemonitor.yaml b/keda/templates/metrics-server/servicemonitor.yaml index 450fdec9..49167ea0 100644 --- a/keda/templates/metrics-server/servicemonitor.yaml +++ b/keda/templates/metrics-server/servicemonitor.yaml @@ -20,11 +20,11 @@ spec: {{- end }} {{- with .Values.prometheus.metricServer.serviceMonitor.targetLabels }} targetLabels: - {{ toYaml . | indent 4 }} + {{- toYaml . | nindent 4 }} {{- end }} {{- with .Values.prometheus.metricServer.serviceMonitor.podTargetLabels }} podTargetLabels: - {{ toYaml . | indent 4 }} + {{- toYaml . | nindent 4 }} {{- end }} endpoints: - port: {{ .Values.prometheus.metricServer.portName }} @@ -40,7 +40,7 @@ spec: {{- end }} {{- with .Values.prometheus.metricServer.serviceMonitor.relabellings }} relabelings: - {{ toYaml . | indent 6 }} + {{- toYaml . | nindent 6 }} {{- end }} namespaceSelector: matchNames: diff --git a/keda/templates/webhooks/servicemonitor.yaml b/keda/templates/webhooks/servicemonitor.yaml index b0fcb126..9c918ed2 100644 --- a/keda/templates/webhooks/servicemonitor.yaml +++ b/keda/templates/webhooks/servicemonitor.yaml @@ -21,11 +21,11 @@ spec: {{- end }} {{- with .Values.prometheus.webhooks.serviceMonitor.targetLabels }} targetLabels: - {{ toYaml . | indent 4 }} + {{- toYaml . | nindent 4 }} {{- end }} {{- with .Values.prometheus.webhooks.serviceMonitor.podTargetLabels }} podTargetLabels: - {{ toYaml . | indent 4 }} + {{- toYaml . | nindent 4 }} {{- end }} endpoints: - port: {{ .Values.prometheus.webhooks.serviceMonitor.port }} @@ -41,7 +41,7 @@ spec: {{- end }} {{- with .Values.prometheus.webhooks.serviceMonitor.relabellings }} relabelings: - {{ toYaml . | indent 6 }} + {{- toYaml . | nindent 6 }} {{- end }} namespaceSelector: matchNames: @@ -50,4 +50,4 @@ spec: matchLabels: app.kubernetes.io/name: {{ .Values.webhooks.name }} {{- end }} -{{- end }} \ No newline at end of file +{{- end }}