Skip to content

Commit ea463ec

Browse files
Add custom authorization support for ServiceMonitor (#407)
Add support for custom authorization configuration in ServiceMonitor to allow users to configure authorization when API keys are configured externally. The authorization field in metrics.serviceMonitor takes precedence over automatic API key detection from apiKey and readOnlyApiKey. This change adds: - authorization field to metrics.serviceMonitor in values.yaml - Support for custom authorization in servicemonitor.yaml template - Documentation and example in values.yaml Co-authored-by: DovnarAlexander <[email protected]>
1 parent 49270d9 commit ea463ec

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

charts/qdrant/templates/servicemonitor.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ spec:
2828
relabelings:
2929
{{ tpl (toYaml .Values.metrics.serviceMonitor.relabelings | indent 8) . }}
3030
{{- end }}
31-
{{- if .Values.readOnlyApiKey }}
31+
{{- if .Values.metrics.serviceMonitor.authorization }}
32+
authorization:
33+
{{ tpl (toYaml .Values.metrics.serviceMonitor.authorization | indent 8) . }}
34+
{{- else if .Values.readOnlyApiKey }}
3235
authorization:
3336
type: Bearer
3437
credentials:

charts/qdrant/values.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,15 @@ metrics:
217217
## ref: https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api.md#relabelconfig
218218
##
219219
relabelings: []
220+
## Authorization to apply to the metrics endpoint for the cases when the API key(s) are configured externally
221+
## ref: https://prometheus-operator.dev/docs/api-reference/api/#monitoring.coreos.com/v1.SafeAuthorization
222+
##
223+
authorization: {}
224+
# authorization:
225+
# type: Bearer
226+
# credentials:
227+
# name: external-secret-with-api-key
228+
# key: api-key
220229

221230
serviceAccount:
222231
annotations: {}

0 commit comments

Comments
 (0)