From c3f22bcff959957a0ef4ca934e27ac240a5db10a Mon Sep 17 00:00:00 2001 From: Milan Plzik Date: Mon, 30 Oct 2023 10:02:32 +0100 Subject: [PATCH] Fix Prometheus metrics handling for the operator. The current state of the Helm chart is slightly confusing, because: - There's no easy way to really disable prometheus metrics -- `--enable-prometheus-metrics` defaults to true anthe current code either emits `--enable-prometheus-metrics=true` or nothing at all (making it `true` once again). - The `http` container port is actually a `metrics` port (by convention from .e.g. webhook), but is present regardless of whether Prometheus metrics are enabled or not. To make it less confusing, this PR proposes renaming it. Signed-off-by: Milan Plzik --- keda/templates/manager/deployment.yaml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/keda/templates/manager/deployment.yaml b/keda/templates/manager/deployment.yaml index b993ae94..7f84cc0e 100644 --- a/keda/templates/manager/deployment.yaml +++ b/keda/templates/manager/deployment.yaml @@ -86,9 +86,9 @@ spec: - "--metrics-server-service-name={{ .Values.operator.name }}-metrics-apiserver" - "--webhooks-service-name={{ .Values.webhooks.name }}" - "--k8s-cluster-domain={{ .Values.clusterDomain }}" + - "--enable-prometheus-metrics={{ .Values.prometheus.operator.enabled }}" {{- if .Values.prometheus.operator.enabled }} - "--metrics-bind-address=:{{ .Values.prometheus.operator.port }}" - - "--enable-prometheus-metrics={{ .Values.prometheus.operator.enabled }}" {{- end }} {{- if .Values.opentelemetry.operator.enabled }} - "--enable-opentelemetry-metrics={{ .Values.opentelemetry.operator.enabled}}" @@ -116,9 +116,11 @@ spec: failureThreshold: {{ .Values.operator.readinessProbe.failureThreshold }} successThreshold: {{ .Values.operator.readinessProbe.successThreshold }} ports: - - containerPort: 8080 - name: http + {{- if .Values.prometheus.operator.enabled }} + - containerPort: {{ .Values.prometheus.operator.port }} + name: metrics protocol: TCP + {{- end }} env: - name: WATCH_NAMESPACE value: {{ .Values.watchNamespace | quote }}