my-apps/charts/semaphore/templates/secret-admin.yaml
2026-04-13 13:51:19 +03:00

30 lines
1.1 KiB
YAML

{{- if and (not .Values.admin.existingSecret) (.Values.admin.create) }}
---
apiVersion: v1
kind: Secret
metadata:
name: {{ include "semaphoreui.fullname" . }}-admin
namespace: {{ .Release.Namespace }}
labels:
{{- include "semaphoreui.labels" . | nindent 4 }}
{{- if .Values.labels }}
{{- toYaml .Values.labels | nindent 4 }}
{{- end }}
{{- if .Values.annotations }}
annotations:
{{- toYaml .Values.annotations | nindent 4 }}
{{- end }}
type: Opaque
data:
{{- $adminSecretName := printf "%s-admin" (include "semaphoreui.fullname" .) }}
{{- $adminSecretObj := (lookup "v1" "Secret" .Release.Namespace $adminSecretName) | default dict }}
{{- $adminSecretData := (get $adminSecretObj "data") | default dict }}
{{- $adminPassword := (get $adminSecretData .Values.admin.passwordKey) | default (randAlphaNum 32) }}
{{ .Values.admin.fullnameKey }}: {{ .Values.admin.fullname | b64enc }}
{{ .Values.admin.usernameKey }}: {{ .Values.admin.username | b64enc }}
{{ .Values.admin.passwordKey }}: {{ .Values.admin.password | default ($adminPassword) | b64enc }}
{{ .Values.admin.emailKey }}: {{ .Values.admin.email | b64enc }}
{{- end }}