2 {{/* vim: set filetype=mustache: */}}
4 Validate Redis® required passwords are not empty.
7 {{ include "common.validations.values.redis.passwords" (dict "secret" "secretName" "subchart" false "context" $) }}
9 - secret - String - Required. Name of the secret where redis values are stored, e.g: "redis-passwords-secret"
10 - subchart - Boolean - Optional. Whether redis is used as subchart or not. Default: false
12 {{- define "common.validations.values.redis.passwords" -}}
13 {{- $enabled := include "common.redis.values.enabled" . -}}
14 {{- $valueKeyPrefix := include "common.redis.values.keys.prefix" . -}}
15 {{- $standarizedVersion := include "common.redis.values.standarized.version" . }}
17 {{- $existingSecret := ternary (printf "%s%s" $valueKeyPrefix "auth.existingSecret") (printf "%s%s" $valueKeyPrefix "existingSecret") (eq $standarizedVersion "true") }}
18 {{- $existingSecretValue := include "common.utils.getValueFromKey" (dict "key" $existingSecret "context" .context) }}
20 {{- $valueKeyRedisPassword := ternary (printf "%s%s" $valueKeyPrefix "auth.password") (printf "%s%s" $valueKeyPrefix "password") (eq $standarizedVersion "true") }}
21 {{- $valueKeyRedisUseAuth := ternary (printf "%s%s" $valueKeyPrefix "auth.enabled") (printf "%s%s" $valueKeyPrefix "usePassword") (eq $standarizedVersion "true") }}
23 {{- if and (or (not $existingSecret) (eq $existingSecret "\"\"")) (eq $enabled "true") -}}
24 {{- $requiredPasswords := list -}}
26 {{- $useAuth := include "common.utils.getValueFromKey" (dict "key" $valueKeyRedisUseAuth "context" .context) -}}
27 {{- if eq $useAuth "true" -}}
28 {{- $requiredRedisPassword := dict "valueKey" $valueKeyRedisPassword "secret" .secret "field" "redis-password" -}}
29 {{- $requiredPasswords = append $requiredPasswords $requiredRedisPassword -}}
32 {{- include "common.validations.values.multiple.empty" (dict "required" $requiredPasswords "context" .context) -}}
37 Auxiliary function to get the right value for enabled redis.
40 {{ include "common.redis.values.enabled" (dict "context" $) }}
42 {{- define "common.redis.values.enabled" -}}
44 {{- printf "%v" .context.Values.redis.enabled -}}
46 {{- printf "%v" (not .context.Values.enabled) -}}
51 Auxiliary function to get the right prefix path for the values
54 {{ include "common.redis.values.key.prefix" (dict "subchart" "true" "context" $) }}
56 - subchart - Boolean - Optional. Whether redis is used as subchart or not. Default: false
58 {{- define "common.redis.values.keys.prefix" -}}
59 {{- if .subchart -}}redis.{{- else -}}{{- end -}}
63 Checks whether the redis chart's includes the standarizations (version >= 14)
66 {{ include "common.redis.values.standarized.version" (dict "context" $) }}
68 {{- define "common.redis.values.standarized.version" -}}
70 {{- $standarizedAuth := printf "%s%s" (include "common.redis.values.keys.prefix" .) "auth" -}}
71 {{- $standarizedAuthValues := include "common.utils.getValueFromKey" (dict "key" $standarizedAuth "context" .context) }}
73 {{- if $standarizedAuthValues -}}