Files
reposilite-charts/templates/_secrets.tpl
Markus Pesch 334a8b877b
All checks were successful
Helm / helm-lint (push) Successful in 6s
Helm / helm-unittest (push) Successful in 6s
Generate README / generate-parameters (push) Successful in 28s
Markdown linter / markdown-link-checker (push) Successful in 18s
Release / publish-chart (push) Successful in 8s
Markdown linter / markdown-lint (push) Successful in 28s
feat(secret): support annotations and labels for the basic auth secret
2025-09-29 22:54:44 +02:00

54 lines
2.5 KiB
Smarty

{{/* vim: set filetype=mustache: */}}
{{/* annotations */}}
{{- define "reposilite.secrets.prometheusBasicAuth.annotations" -}}
{{ include "reposilite.annotations" . }}
{{- if .Values.prometheus.metrics.secret.new.annotations }}
{{ toYaml .Values.prometheus.metrics.secret.new.annotations }}
{{- end }}
{{- end }}
{{/* labels */}}
{{- define "reposilite.secrets.prometheusBasicAuth.labels" -}}
{{ include "reposilite.labels" . }}
{{- if .Values.prometheus.metrics.secret.new.labels }}
{{ toYaml .Values.prometheus.metrics.secret.new.labels }}
{{- end }}
{{- end }}
{{/* names */}}
{{- define "reposilite.secrets.prometheusBasicAuth.name" -}}
{{- if and .Values.prometheus.metrics.secret.existing.enabled (gt (len .Values.prometheus.metrics.secret.existing.secretName) 0) }}
{{- print .Values.prometheus.metrics.secret.existing.secretName -}}
{{- else if and .Values.prometheus.metrics.secret.existing.enabled (eq (len .Values.prometheus.metrics.secret.existing.secretName) 0) }}
{{ fail "Name of the existing secret that contains the credentials for basic auth is not defined!" }}
{{- else if not .Values.prometheus.metrics.secret.existing.enabled }}
{{- printf "%s-basic-auth-credentials" (include "reposilite.fullname" $) -}}
{{- end }}
{{- end }}
{{/* secretKeyNames */}}
{{- define "reposilite.secrets.prometheusBasicAuth.passwordKey" -}}
{{- if and .Values.prometheus.metrics.secret.existing.enabled (gt (len .Values.prometheus.metrics.secret.existing.basicAuthPasswordKey) 0) -}}
{{- .Values.prometheus.metrics.secret.existing.basicAuthPasswordKey -}}
{{- else if and .Values.prometheus.metrics.secret.existing.enabled (eq (len .Values.prometheus.metrics.secret.existing.basicAuthPasswordKey) 0) }}
{{ fail "Name of the key in the secret that contains the password for basic auth is not defined!" }}
{{- else if and (not .Values.prometheus.metrics.secret.existing.enabled) }}
{{- print "password" -}}
{{- end }}
{{- end }}
{{- define "reposilite.secrets.prometheusBasicAuth.usernameKey" -}}
{{- if and .Values.prometheus.metrics.secret.existing.enabled (gt (len .Values.prometheus.metrics.secret.existing.basicAuthUsernameKey) 0) -}}
{{- .Values.prometheus.metrics.secret.existing.basicAuthUsernameKey -}}
{{- else if and .Values.prometheus.metrics.secret.existing.enabled (eq (len .Values.prometheus.metrics.secret.existing.basicAuthUsernameKey) 0) }}
{{ fail "Name of the key in the secret that contains the username for basic auth is not defined!" }}
{{- else if and (not .Values.prometheus.metrics.secret.existing.enabled) }}
{{- print "username" -}}
{{- end }}
{{- end }}