From 8b3ba7a215d4fe91c5eb776d4d48366e782adc5a Mon Sep 17 00:00:00 2001 From: Jorge Turrado Date: Mon, 24 Apr 2023 23:34:03 +0200 Subject: [PATCH 1/5] Breaking change: Remove deprecated prometheus metrics from MS Signed-off-by: Jorge Turrado --- keda/templates/manager/service.yaml | 4 ++++ keda/templates/metrics-server/deployment.yaml | 15 +++------------ keda/templates/metrics-server/podmonitor.yaml | 5 +++-- keda/templates/metrics-server/service.yaml | 19 +++++++++---------- .../metrics-server/servicemonitor.yaml | 2 +- keda/values.yaml | 3 +-- 6 files changed, 21 insertions(+), 27 deletions(-) diff --git a/keda/templates/manager/service.yaml b/keda/templates/manager/service.yaml index 0d9a3304..2b26ce9b 100644 --- a/keda/templates/manager/service.yaml +++ b/keda/templates/manager/service.yaml @@ -7,6 +7,10 @@ metadata: prometheus.io/port: {{ .Values.prometheus.operator.port | quote }} prometheus.io/path: "/metrics" {{- end }} + {{- toYaml .Values.additionalAnnotations | nindent 4 }} + {{- range $key, $value := .Values.service.annotations }} + {{ $key }}: {{ $value | quote }} + {{- end }} labels: app.kubernetes.io/name: {{ .Values.operator.name }} {{- include "keda.labels" . | indent 4 }} diff --git a/keda/templates/metrics-server/deployment.yaml b/keda/templates/metrics-server/deployment.yaml index 30a6554d..7e2faa95 100644 --- a/keda/templates/metrics-server/deployment.yaml +++ b/keda/templates/metrics-server/deployment.yaml @@ -107,18 +107,14 @@ spec: {{- end }} args: - /usr/local/bin/keda-adapter - - --port={{ .Values.service.portHttpTarget }} + - --port={{ .Values.prometheus.metricServer.port }} - --secure-port={{ .Values.service.portHttpsTarget }} - --logtostderr=true - --metrics-service-address={{ .Values.operator.name }}.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}:9666 - --client-ca-file={{ .Values.certificates.mountPath }}/ca.crt - --tls-cert-file={{ .Values.certificates.mountPath }}/tls.crt - --tls-private-key-file={{ .Values.certificates.mountPath }}/tls.key - - --cert-dir={{ .Values.certificates.mountPath }} - {{- if .Values.prometheus.metricServer.enabled }} - - --metrics-port={{ .Values.prometheus.metricServer.port }} - - --metrics-path={{ .Values.prometheus.metricServer.path }} - {{- end }} + - --cert-dir={{ .Values.certificates.mountPath }} - --v={{ .Values.logging.metricServer.level }} {{- range $key, $value := .Values.extraArgs.metricsAdapter }} - --{{ $key }}={{ $value }} @@ -127,14 +123,9 @@ spec: - containerPort: {{ .Values.service.portHttpsTarget }} name: https protocol: TCP - - containerPort: {{ .Values.service.portHttpTarget }} - name: http - protocol: TCP - {{- if .Values.prometheus.metricServer.enabled }} - containerPort: {{ .Values.prometheus.metricServer.port }} - name: metrics + name: {{ .Values.prometheus.metricServer.portName }} protocol: TCP - {{- end }} volumeMounts: - mountPath: {{ .Values.certificates.mountPath }} name: certificates diff --git a/keda/templates/metrics-server/podmonitor.yaml b/keda/templates/metrics-server/podmonitor.yaml index 93a741ef..5f325045 100644 --- a/keda/templates/metrics-server/podmonitor.yaml +++ b/keda/templates/metrics-server/podmonitor.yaml @@ -16,8 +16,9 @@ metadata: {{- end }} spec: podMetricsEndpoints: - - port: metrics - path: {{ .Values.prometheus.metricServer.path }} + - port: {{ .Values.prometheus.metricServer.portName }} + path: /metrics + honorLabels: true {{- with .Values.prometheus.metricServer.podMonitor.interval }} interval: {{ . }} {{- end }} diff --git a/keda/templates/metrics-server/service.yaml b/keda/templates/metrics-server/service.yaml index 5b64b952..2806a175 100644 --- a/keda/templates/metrics-server/service.yaml +++ b/keda/templates/metrics-server/service.yaml @@ -8,25 +8,24 @@ metadata: name: {{ .Values.operator.name }}-metrics-apiserver namespace: {{ .Release.Namespace }} annotations: - {{- toYaml .Values.additionalAnnotations | nindent 4 }} - {{- range $key, $value := .Values.service.annotations }} - {{ $key }}: {{ $value | quote }} - {{- end }} + {{- if and .Values.prometheus.metricServer.enabled ( not (or .Values.prometheus.metricServer.podMonitor.enabled .Values.prometheus.metricServer.serviceMonitor.enabled )) }} + prometheus.io/scrape: "true" + prometheus.io/port: {{ .Values.prometheus.metricServer.port | quote }} + prometheus.io/path: "/metrics" + {{- end }} + {{- toYaml .Values.additionalAnnotations | nindent 4 }} + {{- range $key, $value := .Values.service.annotations }} + {{ $key }}: {{ $value | quote }} + {{- end }} spec: ports: - name: https port: {{ .Values.service.portHttps }} targetPort: {{ .Values.service.portHttpsTarget }} protocol: TCP - - name: http - port: {{ .Values.service.portHttp }} - targetPort: {{ .Values.service.portHttpTarget }} - protocol: TCP - {{- if .Values.prometheus.metricServer.enabled }} - name: {{ .Values.prometheus.metricServer.portName }} port: {{ .Values.prometheus.metricServer.port }} targetPort: {{ .Values.prometheus.metricServer.port }} protocol: TCP - {{- end }} selector: app: {{ .Values.operator.name }}-metrics-apiserver diff --git a/keda/templates/metrics-server/servicemonitor.yaml b/keda/templates/metrics-server/servicemonitor.yaml index 450fdec9..b2598ac1 100644 --- a/keda/templates/metrics-server/servicemonitor.yaml +++ b/keda/templates/metrics-server/servicemonitor.yaml @@ -31,7 +31,7 @@ spec: {{- with .Values.prometheus.metricServer.serviceMonitor.targetPort }} targetPort: {{ . }} {{- end }} - path: {{ .Values.prometheus.metricServer.path }} + path: /metrics {{- with .Values.prometheus.metricServer.serviceMonitor.interval }} interval: {{ . }} {{- end }} diff --git a/keda/values.yaml b/keda/values.yaml index e7749300..20c02782 100644 --- a/keda/values.yaml +++ b/keda/values.yaml @@ -365,9 +365,8 @@ volumes: prometheus: metricServer: enabled: false - port: 9022 + port: 8080 portName: metrics - path: /metrics serviceMonitor: # Enables ServiceMonitor creation for the Prometheus Operator enabled: false From b7602d785b8ee03bcb043f7de889ad91158bcbb4 Mon Sep 17 00:00:00 2001 From: Jorge Turrado Date: Mon, 24 Apr 2023 23:35:37 +0200 Subject: [PATCH 2/5] update readme Signed-off-by: Jorge Turrado --- keda/README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/keda/README.md b/keda/README.md index 43d4572a..d3ba3642 100644 --- a/keda/README.md +++ b/keda/README.md @@ -149,9 +149,8 @@ their default values. | `service.portHttps` | HTTPS port for KEDA Metric Server service | `443` | | `service.portHttpsTarget` | HTTPS port for KEDA Metric Server container | `6443` | | `prometheus.metricServer.enabled` | Enable metric server Prometheus metrics expose | `false` | -| `prometheus.metricServer.port` | HTTP port used for exposing metrics server prometheus metrics | `9022` | +| `prometheus.metricServer.port` | HTTP port used for exposing metrics server prometheus metrics | `8088` | | `prometheus.metricServer.portName` | HTTP port name for exposing metrics server prometheus metrics | `metrics` | -| `prometheus.metricServer.path` | Path used for exposing metric server prometheus metrics | `/metrics` | | `prometheus.metricServer.podMonitor.enabled` | Enable monitoring for metric server using podMonitor crd (prometheus operator) | `false` | | `prometheus.metricServer.podMonitor.interval` | Scraping interval for metric server using podMonitor crd (prometheus operator) | `` | | `prometheus.metricServer.podMonitor.scrapeTimeout` | Scraping timeout for metric server using podMonitor crd (prometheus operator) | `` | From 41e4905c976f9ebbcc04e300115536861196f2da Mon Sep 17 00:00:00 2001 From: Jorge Turrado Date: Tue, 25 Apr 2023 08:32:18 +0200 Subject: [PATCH 3/5] remove unused values Signed-off-by: Jorge Turrado --- keda/README.md | 2 -- keda/values.yaml | 2 -- 2 files changed, 4 deletions(-) diff --git a/keda/README.md b/keda/README.md index d3ba3642..5bf0bff6 100644 --- a/keda/README.md +++ b/keda/README.md @@ -144,8 +144,6 @@ their default values. | `http.timeout` | The default HTTP timeout to use for all scalers that use raw HTTP clients (some scalers use SDKs to access target services. These have built-in HTTP clients, and the timeout does not necessarily apply to them) | `` | | `http.minTlsVersion` | The minimum TLS version to use for all scalers that use raw HTTP clients (some scalers use SDKs to access target services. These have built-in HTTP clients, and this value does not necessarily apply to them) | `` | | `service.annotations` | Annotations to add the KEDA Metric Server service | `{}` | -| `service.portHttp` | Service HTTP port for KEDA Metric Server service | `80` | -| `service.portHttpTarget` | Service HTTP port for KEDA Metric Server container | `8080` | | `service.portHttps` | HTTPS port for KEDA Metric Server service | `443` | | `service.portHttpsTarget` | HTTPS port for KEDA Metric Server container | `6443` | | `prometheus.metricServer.enabled` | Enable metric server Prometheus metrics expose | `false` | diff --git a/keda/values.yaml b/keda/values.yaml index 20c02782..85fd7596 100644 --- a/keda/values.yaml +++ b/keda/values.yaml @@ -269,8 +269,6 @@ podSecurityContext: service: type: ClusterIP - portHttp: 80 - portHttpTarget: 8080 portHttps: 443 portHttpsTarget: 6443 From a3b97a7242043bdd4d458097fbd4670044df8b0a Mon Sep 17 00:00:00 2001 From: Jorge Turrado Date: Fri, 26 May 2023 19:23:16 +0200 Subject: [PATCH 4/5] remove whitespaces Signed-off-by: Jorge Turrado --- keda/templates/metrics-server/deployment.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keda/templates/metrics-server/deployment.yaml b/keda/templates/metrics-server/deployment.yaml index 7e2faa95..d162090f 100644 --- a/keda/templates/metrics-server/deployment.yaml +++ b/keda/templates/metrics-server/deployment.yaml @@ -114,7 +114,7 @@ spec: - --client-ca-file={{ .Values.certificates.mountPath }}/ca.crt - --tls-cert-file={{ .Values.certificates.mountPath }}/tls.crt - --tls-private-key-file={{ .Values.certificates.mountPath }}/tls.key - - --cert-dir={{ .Values.certificates.mountPath }} + - --cert-dir={{ .Values.certificates.mountPath }} - --v={{ .Values.logging.metricServer.level }} {{- range $key, $value := .Values.extraArgs.metricsAdapter }} - --{{ $key }}={{ $value }} From 8da02996932f3505d67b020e934404d19f2559ea Mon Sep 17 00:00:00 2001 From: Jorge Turrado Date: Tue, 6 Jun 2023 09:27:00 +0200 Subject: [PATCH 5/5] remove honorNamespace Signed-off-by: Jorge Turrado --- keda/templates/metrics-server/podmonitor.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/keda/templates/metrics-server/podmonitor.yaml b/keda/templates/metrics-server/podmonitor.yaml index 5f325045..40476abd 100644 --- a/keda/templates/metrics-server/podmonitor.yaml +++ b/keda/templates/metrics-server/podmonitor.yaml @@ -18,7 +18,6 @@ spec: podMetricsEndpoints: - port: {{ .Values.prometheus.metricServer.portName }} path: /metrics - honorLabels: true {{- with .Values.prometheus.metricServer.podMonitor.interval }} interval: {{ . }} {{- end }}