mirror of
https://github.com/bitnami/charts.git
synced 2026-03-10 15:07:49 +08:00
[bitnami/common] Improve "common.secrets.passwords.manage" helper (#8861)
This commit is contained in:
committed by
GitHub
parent
12e4c3733e
commit
01477b42f2
@@ -2,7 +2,7 @@ annotations:
|
||||
category: Infrastructure
|
||||
apiVersion: v2
|
||||
# Please make sure that version and appVersion are always the same.
|
||||
appVersion: 1.11.0
|
||||
appVersion: 1.11.1
|
||||
description: A Library Helm Chart for grouping common logic between bitnami charts. This chart is not deployable by itself.
|
||||
home: https://github.com/bitnami/charts/tree/master/bitnami/common
|
||||
icon: https://bitnami.com/downloads/logos/bitnami-mark.png
|
||||
@@ -20,4 +20,4 @@ sources:
|
||||
- https://github.com/bitnami/charts
|
||||
- https://www.bitnami.com/
|
||||
type: library
|
||||
version: 1.11.0
|
||||
version: 1.11.1
|
||||
|
||||
@@ -81,10 +81,12 @@ Params:
|
||||
{{- $passwordLength := default 10 .length }}
|
||||
{{- $providedPasswordKey := include "common.utils.getKeyFromList" (dict "keys" .providedValues "context" $.context) }}
|
||||
{{- $providedPasswordValue := include "common.utils.getValueFromKey" (dict "key" $providedPasswordKey "context" $.context) }}
|
||||
{{- $secret := (lookup "v1" "Secret" $.context.Release.Namespace .secret) }}
|
||||
{{- if $secret }}
|
||||
{{- if index $secret.data .key }}
|
||||
{{- $password = index $secret.data .key }}
|
||||
{{- $secretData := (lookup "v1" "Secret" $.context.Release.Namespace .secret).data }}
|
||||
{{- if $secretData }}
|
||||
{{- if hasKey $secretData .key }}
|
||||
{{- $password = index $secretData .key }}
|
||||
{{- else }}
|
||||
{{- printf "\nPASSWORDS ERROR: The secret \"%s\" does not contain the key \"%s\"\n" .secret .key | fail -}}
|
||||
{{- end -}}
|
||||
{{- else if $providedPasswordValue }}
|
||||
{{- $password = $providedPasswordValue | toString | b64enc | quote }}
|
||||
@@ -98,7 +100,7 @@ Params:
|
||||
{{- $requiredPasswordError := include "common.validations.values.single.empty" $requiredPassword -}}
|
||||
{{- $passwordValidationErrors := list $requiredPasswordError -}}
|
||||
{{- include "common.errors.upgrade.passwords.empty" (dict "validationErrors" $passwordValidationErrors "context" $.context) -}}
|
||||
|
||||
|
||||
{{- if .strong }}
|
||||
{{- $subStr := list (lower (randAlpha 1)) (randNumeric 1) (upper (randAlpha 1)) | join "_" }}
|
||||
{{- $password = randAscii $passwordLength }}
|
||||
|
||||
Reference in New Issue
Block a user