split nextcloud chart components into separate files
This commit is contained in:
36
helm/nextcloud/templates/_helpers.tpl
Normal file
36
helm/nextcloud/templates/_helpers.tpl
Normal file
@@ -0,0 +1,36 @@
|
||||
{{- define "helm_keep_annotation" -}}
|
||||
"helm.sh/resource-policy": keep
|
||||
{{- end -}}
|
||||
|
||||
{{/* Generated Postgres Config */}}
|
||||
{{ define "POSTGRES_NAME" }}{{ printf "%s-postgres" .Release.Name | lower }}{{ end }}
|
||||
{{ define "POSTGRES_DB" }}nextcloud{{ end }}
|
||||
{{ define "DATABASE_HOST" }}{{ .Release.Name }}-postgres{{ end }}
|
||||
{{ define "POSTGRES_USER" }}postgres{{ end }}
|
||||
|
||||
{{/* Postgres password lookup - uses existing password if possible */}}
|
||||
{{ define "POSTGRES_PASSWORD" -}}
|
||||
{{- $POSTGRES_SECRETS := (lookup "v1" "Secret" .Release.Namespace ( include "POSTGRES_NAME" . )).data -}}
|
||||
{{- printf (ternary (dict "POSTGRES_PASSWORD" (randAlphaNum 64 | b64enc)) $POSTGRES_SECRETS (not $POSTGRES_SECRETS)).POSTGRES_PASSWORD -}}
|
||||
{{- end }}
|
||||
|
||||
{{/* Generated Nextcloud Config */}}
|
||||
{{ define "NEXTCLOUD_NAME" }}{{ printf "%s-nextcloud" .Release.Name | lower }}{{ end }}
|
||||
{{ define "ADMIN_USER" }}admin{{ end }}
|
||||
|
||||
{{/* Nextcloud admin password lookup - uses existing password if possible */}}
|
||||
{{- define "NEXTCLOUD_ADMIN_PASSWORD" -}}
|
||||
{{/* ternary (create a dict with random NEXTCLOUD_ADMIN_PASSWORD) (actual dictionary) (test whether NEXTCLOUD_SECRETS exists) */}}
|
||||
{{- $NEXTCLOUD_SECRETS := (lookup "v1" "Secret" .Release.Namespace ( include "NEXTCLOUD_NAME" . )).data -}}
|
||||
{{- printf (ternary (dict "NEXTCLOUD_ADMIN_PASSWORD" (randAlphaNum 64 | b64enc)) $NEXTCLOUD_SECRETS (not $NEXTCLOUD_SECRETS)).NEXTCLOUD_ADMIN_PASSWORD -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/* Generated Redis Config */}}
|
||||
{{ define "REDIS_NAME" }}{{ printf "%s-redis" .Release.Name | lower }}{{ end }}
|
||||
{{ define "REDIS_HOST" }}{{ .Release.Name }}-redis{{ end }}
|
||||
|
||||
{{/* Redis password lookup - uses existing password if possible */}}
|
||||
{{- define "REDIS_PASSWORD" -}}
|
||||
{{- $REDIS_SECRETS := (lookup "v1" "Secret" .Release.Namespace ( include "REDIS_NAME" . )).data -}}
|
||||
{{- printf (ternary (dict "REDIS_PASSWORD" (randAlphaNum 64 | b64enc)) $REDIS_SECRETS (not $REDIS_SECRETS)).REDIS_PASSWORD -}}
|
||||
{{- end -}}
|
||||
Reference in New Issue
Block a user