Files
charts/bitnami/keycloak/templates/servicemonitor.yaml
msvechla 43577c3f2b [bitnami/keycloak] fix: consider httpRelativePath for metrics (#36219)
* [bitnami/keycloak] fix: consider httpRelativePath for metrics

When a relative path is set, this path is used as a prefix to the
metrics path: https://www.keycloak.org/server/management-interface#_relative_path

This issue was introduced with the recent metrics refactorings.

Signed-off-by: Marius Svechla <m.svechla@gmail.com>

* Update CHANGELOG.md

Signed-off-by: Bitnami Bot <bitnami.bot@broadcom.com>

---------

Signed-off-by: Marius Svechla <m.svechla@gmail.com>
Signed-off-by: Bitnami Bot <bitnami.bot@broadcom.com>
Co-authored-by: Bitnami Bot <bitnami.bot@broadcom.com>
2025-09-11 13:16:58 +02:00

59 lines
3.0 KiB
YAML

{{- /*
Copyright Broadcom, Inc. All Rights Reserved.
SPDX-License-Identifier: APACHE-2.0
*/}}
{{- if and .Values.metrics.enabled .Values.metrics.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ template "common.names.fullname" . }}
namespace: {{ default (include "common.names.namespace" .) .Values.metrics.serviceMonitor.namespace }}
{{- $labels := include "common.tplvalues.merge" (dict "values" (list .Values.metrics.serviceMonitor.labels .Values.commonLabels) "context" .) }}
labels: {{- include "common.labels.standard" (dict "customLabels" $labels "context" .) | nindent 4 }}
app.kubernetes.io/component: keycloak
app.kubernetes.io/part-of: keycloak
{{- if or .Values.metrics.serviceMonitor.annotations .Values.commonAnnotations }}
{{- $annotations := include "common.tplvalues.merge" (dict "values" (list .Values.metrics.serviceMonitor.annotations .Values.commonAnnotations) "context" .) }}
annotations: {{- include "common.tplvalues.render" (dict "value" $annotations "context" .) | nindent 4 }}
{{- end }}
spec:
jobLabel: {{ .Values.metrics.serviceMonitor.jobLabel | quote }}
endpoints:
- port: tcp-metrics
path: "{{ trimSuffix "/" .Values.httpRelativePath }}/metrics"
{{- if .Values.tls.enabled }}
scheme: https
{{- if .Values.metrics.serviceMonitor.tlsConfig }}
tlsConfig: {{- include "common.tplvalues.render" (dict "value" .Values.metrics.serviceMonitor.tlsConfig "context" .) | nindent 8 }}
{{- else if .Values.tls.autoGenerated.enabled }}
tlsConfig:
insecureSkipVerify: true
{{- end }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.interval }}
interval: {{ .Values.metrics.serviceMonitor.interval }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.scrapeTimeout }}
scrapeTimeout: {{ .Values.metrics.serviceMonitor.scrapeTimeout }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.honorLabels }}
honorLabels: {{ .Values.metrics.serviceMonitor.honorLabels }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.metricRelabelings }}
metricRelabelings: {{- include "common.tplvalues.render" (dict "value" .Values.metrics.serviceMonitor.metricRelabelings "context" .) | nindent 8 }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.relabelings }}
relabelings: {{- include "common.tplvalues.render" (dict "value" .Values.metrics.serviceMonitor.relabelings "context" .) | nindent 8 }}
{{- end }}
namespaceSelector:
matchNames:
- {{ include "common.names.namespace" . | quote }}
selector:
matchLabels: {{- include "common.labels.matchLabels" (dict "customLabels" .Values.commonLabels "context" .) | nindent 6 }}
{{- if .Values.metrics.serviceMonitor.selector }}
{{- include "common.tplvalues.render" (dict "value" .Values.metrics.serviceMonitor.selector "context" .) | nindent 6 }}
{{- end }}
app.kubernetes.io/component: metrics
{{- end }}