X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=kubernetes%2Fcommon%2Fcommon%2Ftemplates%2F_createPassword.tpl;h=bfa96daf64b875ab0d710b7fd14a68017418a2af;hb=1a8c01a011e0aedfe6ef1f57811429a9133be0ef;hp=938b0ee514bb1e593f62186279f867cfe733c8ef;hpb=5145c61e87e1d73935d395abfba6b9becb5d3b87;p=oom.git diff --git a/kubernetes/common/common/templates/_createPassword.tpl b/kubernetes/common/common/templates/_createPassword.tpl index 938b0ee514..bfa96daf64 100644 --- a/kubernetes/common/common/templates/_createPassword.tpl +++ b/kubernetes/common/common/templates/_createPassword.tpl @@ -29,11 +29,26 @@ {{- printf "%d" .Values.global.masterPassword -}} {{ else if .Values.masterPassword }} {{- printf "%d" .Values.masterPassword -}} + {{ else if eq "testRelease" (include "common.release" .) }} + {{/* Special case for chart liniting. DON"T NAME YOUR PRODUCTION RELEASE testRelease */}} + {{- printf "testRelease" -}} {{ else }} {{ fail "masterPassword not provided" }} {{ end }} {{- end -}} +{{- define "common._defaultPasswordStrength" -}} + {{ if .Values.passwordStrengthOverride }} + {{- printf "%s" .Values.passwordStrengthOverride -}} + {{ else if .Values.global.passwordStrength }} + {{- printf "%s" .Values.global.passwordStrength -}} + {{ else if .Values.passwordStrength }} + {{- printf "%s" .Values.passwordStrength -}} + {{ else }} + {{- printf "long" }} + {{ end }} +{{- end -}} + {{/* Generate a new password based on masterPassword. The new password is not random, it is derived from masterPassword, fully qualified chart name and @@ -56,7 +71,8 @@ {{- define "common.createPassword" -}} {{- $dot := default . .dot -}} {{- $uid := default "onap" .uid -}} - {{- $strength := default "long" .strength -}} + {{- $defaultStrength := include "common._defaultPasswordStrength" $dot | trim -}} + {{- $strength := default $defaultStrength .strength -}} {{- $mp := include "common.masterPassword" $dot -}} {{- derivePassword 1 $strength $mp (include "common.fullname" $dot) $uid -}} {{- end -}}