feat(service-monitor): support bearer token authentication on metrics endpoint #719

Merged
hiteshnayak305 merged 5 commits from feat/secure-metrics-endpoint into main 2024-11-30 13:59:29 +00:00
2 changed files with 27 additions and 1 deletions
Showing only changes of commit a8984b9a98 - Show all commits

View File

@ -278,7 +278,7 @@ https
{{- if not (hasKey .Values.gitea.config.metrics "ENABLED") -}}
{{- $_ := set .Values.gitea.config.metrics "ENABLED" .Values.gitea.metrics.enabled -}}
{{- end -}}
{{- if not (hasKey .Values.gitea.config.metrics "TOKEN") -}}
{{- if and (not (hasKey .Values.gitea.config.metrics "TOKEN")) (.Values.gitea.metrics.token) -}}
{{- $_ := set .Values.gitea.config.metrics "TOKEN" .Values.gitea.metrics.token -}}
{{- end -}}
{{- /* redis queue */ -}}

View File

@ -17,3 +17,29 @@ tests:
value: |-
ENABLED=true
TOKEN=somepassword
- it: metrics token is empty
template: templates/gitea/config.yaml
set:
gitea:
metrics:
enabled: true
token: ""
asserts:
- documentIndex: 0
equal:
path: stringData.metrics
value: |-
ENABLED=true
- it: metrics token is nil
template: templates/gitea/config.yaml
set:
gitea:
metrics:
enabled: true
token:
asserts:
- documentIndex: 0
equal:
path: stringData.metrics
value: |-
ENABLED=true