Skip to content

Commit

Permalink
Delete duplicated pfcon.valueOrLookupOrRandom
Browse files Browse the repository at this point in the history
  • Loading branch information
jennydaman committed Nov 25, 2024
1 parent 4e0f351 commit bbaa57c
Showing 1 changed file with 0 additions and 24 deletions.
24 changes: 0 additions & 24 deletions charts/pfcon/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -62,27 +62,3 @@ Create the name of the service account to use
{{ .Values.storage.existingClaim | default (printf "%s-storebase" .Release.Name) }}
{{- end }}

{{/*
Helper function to use a value. If the value is unset, try looking up the previous value
from a secret. If the secret does not exist, generate a random value with a specified length.
*/}}
{{- define "pfcon.valueOrLookupOrRandom" -}}
{{- if .value -}}
{{- .value | b64enc | quote -}}
{{- else -}}
{{- $length := .length | default 32 -}}
{{- $name := .name -}}
{{- if (not $name) -}}
{{- fail (printf "valueOrLookupOrRandom was not called with required parameter 'name'. Given parameters: %s" (keys .)) -}}
{{- end -}}
{{- with (lookup "v1" "Secret" .root.Release.Namespace .secret) -}}
{{- if (hasKey .data $name) -}}
{{- (index .data $name) | quote -}}
{{- else -}}
{{- randAlphaNum $length | b64enc | quote -}}
{{- end -}}
{{- else -}}
{{- randAlphaNum $length | b64enc | quote -}}
{{- end -}}
{{- end -}}
{{- end -}}

0 comments on commit bbaa57c

Please sign in to comment.