WIP: can deploy?

This commit is contained in:
2026-07-29 00:30:37 -04:00
parent 8f5c499ee2
commit 4a6732798a
31 changed files with 803 additions and 739 deletions
+33
View File
@@ -0,0 +1,33 @@
{{/*
Secret initializer and data maintainer
This helper will initialize the secret data with "initial" value if the secret is not found in the secret object.
IF the secret is found in the secret object, it will use the set value from the secret object thereby maintaining the secret data.
*/}}
{{- define "helper.secrets" -}}
{{- $secretObj := (lookup "v1" "Secret" .release.Namespace .component.name) | default dict }}
{{- range $key, $value := .component.secrets }}
{{- if empty $value -}}
{{- $secretData := (get $secretObj "data") | default dict }}
{{- $secret := (get $secretData $key) | default ("initial" | b64enc) }}
{{ $key }}: {{ $secret | quote }}
{{- else }}
{{ $key }}: {{ $value | b64enc | quote }}
{{- end -}}
{{- end }}
{{- end -}}
{{- range $system, $settings := .Values.components -}}
{{ if $settings.secrets }}
---
apiVersion: v1
kind: Secret
metadata:
name: {{ $settings.name }}
labels:
{{ include "helper.metaLabels" (dict "component" $settings "values" $.Values) | indent 4 }}
type: Opaque
data:
{{- include "helper.secrets" (dict "component" $settings "release" $.Release) }}
{{- end }}
{{- end }}