52 lines
2.2 KiB
YAML
52 lines
2.2 KiB
YAML
{{- $adminToken := "" }}
|
|
{{- if and (eq .Values.vaultwarden.admin.enabled true) (not .Values.vaultwarden.admin.existingSecret) }}
|
|
{{- $adminToken = .Values.vaultwarden.admin.token | default (randAlphaNum 48) | b64enc | quote }}
|
|
{{- end -}}
|
|
|
|
{{- $databaseUrl := "" }}
|
|
{{- if and (ne .Values.database.type "sqlite") (not .Values.database.existingSecret) }}
|
|
{{- $databaseUrl = required "External databases need either URL or existing secret" .Values.database.url | b64enc | quote }}
|
|
{{- end -}}
|
|
|
|
{{- $smtpUser := "" }}
|
|
{{- if and (eq .Values.vaultwarden.smtp.enabled true ) (not .Values.vaultwarden.smtp.existingSecret) (.Values.vaultwarden.smtp.user) }}
|
|
{{- $smtpUser = .Values.vaultwarden.smtp.user | b64enc | quote }}
|
|
{{- end -}}
|
|
|
|
{{- $yubicoClientId := "" }}
|
|
{{- if and (eq .Values.vaultwarden.yubico.enabled true ) (not .Values.vaultwarden.yubico.existingSecret) }}
|
|
{{- $yubicoClientId = required "Yubico Client ID required" .Values.vaultwarden.yubico.clientId | toString | b64enc | quote }}
|
|
{{- end -}}
|
|
|
|
{{- $pushId := "" }}
|
|
{{- if and (eq .Values.vaultwarden.push.enabled true ) (not .Values.vaultwarden.push.existingSecret) }}
|
|
{{- $pushId = required "Push Installation ID required" .Values.vaultwarden.push.installationId | toString | b64enc | quote }}
|
|
{{- end -}}
|
|
|
|
{{- if or (ne $adminToken "") (ne $databaseUrl "") (ne $smtpUser "" ) (ne $yubicoClientId "") (ne $pushId "") }}
|
|
apiVersion: v1
|
|
kind: Secret
|
|
metadata:
|
|
name: {{ include "vaultwarden.fullname" . }}
|
|
labels:
|
|
{{- include "vaultwarden.labels" . | nindent 4 }}
|
|
data:
|
|
{{- if ne $adminToken "" }}
|
|
admin-token: {{ $adminToken }}
|
|
{{- end }}
|
|
{{- if ne $databaseUrl "" }}
|
|
database-url: {{ $databaseUrl }}
|
|
{{- end }}
|
|
{{- if ne $smtpUser "" }}
|
|
smtp-user: {{ $smtpUser }}
|
|
smtp-password: {{ required "Must specify SMTP password" .Values.vaultwarden.smtp.password | b64enc | quote }}
|
|
{{- end }}
|
|
{{- if ne $yubicoClientId "" }}
|
|
yubico-client-id: {{ $yubicoClientId }}
|
|
yubico-secret-key: {{ required "Yubico Secret Key required" .Values.vaultwarden.yubico.secretKey | b64enc | quote }}
|
|
{{- end }}
|
|
{{- if ne $pushId "" }}
|
|
push-id: {{ $pushId }}
|
|
push-key: {{ required "Push Installation Key required" .Values.vaultwarden.push.installationKey | b64enc | quote }}
|
|
{{- end }}
|
|
{{- end }} |