helm_website/templates/secrets.yaml

35 lines
1.1 KiB
YAML
Raw Normal View History

2024-11-20 18:16:42 +01:00
{{- $webhook_secret := .Values.updater.webhook_secret }}
{{- $apiUsername := .Values.updater.apiUsername }}
{{- $apiPassword := .Values.updater.apiPassword }}
2024-12-08 10:57:44 +01:00
{{- $secretName := printf "%s-webhook-secret" .Release.Name }}
2024-12-08 10:56:23 +01:00
{{- $secretData := (lookup "v1" "Secret" .Release.Namespace $secretName).data }}
2024-12-08 10:56:23 +01:00
{{- if $secretData }}
{{- $webhook_secret = index $secretData "WEBHOOK_SECRET" | b64dec }}
{{- $apiUsername = index $secretData "API_USERNAME" | b64dec }}
{{- $apiPassword = index $secretData "API_PASSWORD" | b64dec }}
{{- else }}
{{- if not $webhook_secret }}
{{- $webhook_secret = randAlphaNum 10 }}
{{- end }}
{{- if not $apiUsername}}
{{- $apiUsername = randAlphaNum 10 }}
{{- end }}
{{- if not $apiPassword}}
{{- $apiPassword = randAlphaNum 10 }}
{{- end }}
{{- end}}
apiVersion: v1
kind: Secret
metadata:
2024-12-08 10:56:23 +01:00
name: {{ $secretName }}
namespace: {{ .Release.Namespace }}
type: Opaque
data:
WEBHOOK_SECRET: {{ $webhook_secret | b64enc }}
API_USERNAME: {{ $apiUsername | b64enc }}
API_PASSWORD: {{ $apiPassword | b64enc }}
2024-12-08 10:56:23 +01:00
SCRIPT_NAME: {{ "/.webhook" | b64enc }}