1 {{/* vim: set filetype=mustache: */}}
3 Validate Cassandra required passwords are not empty.
6 {{ include "common.validations.values.cassandra.passwords" (dict "secret" "secretName" "subchart" false "context" $) }}
8 - secret - String - Required. Name of the secret where Cassandra values are stored, e.g: "cassandra-passwords-secret"
9 - subchart - Boolean - Optional. Whether Cassandra is used as subchart or not. Default: false
11 {{- define "common.validations.values.cassandra.passwords" -}}
12 {{- $existingSecret := include "common.cassandra.values.existingSecret" . -}}
13 {{- $enabled := include "common.cassandra.values.enabled" . -}}
14 {{- $dbUserPrefix := include "common.cassandra.values.key.dbUser" . -}}
15 {{- $valueKeyPassword := printf "%s.password" $dbUserPrefix -}}
17 {{- if and (or (not $existingSecret) (eq $existingSecret "\"\"")) (eq $enabled "true") -}}
18 {{- $requiredPasswords := list -}}
20 {{- $requiredPassword := dict "valueKey" $valueKeyPassword "secret" .secret "field" "cassandra-password" -}}
21 {{- $requiredPasswords = append $requiredPasswords $requiredPassword -}}
23 {{- include "common.validations.values.multiple.empty" (dict "required" $requiredPasswords "context" .context) -}}
29 Auxiliary function to get the right value for existingSecret.
32 {{ include "common.cassandra.values.existingSecret" (dict "context" $) }}
34 - subchart - Boolean - Optional. Whether Cassandra is used as subchart or not. Default: false
36 {{- define "common.cassandra.values.existingSecret" -}}
38 {{- .context.Values.cassandra.dbUser.existingSecret | quote -}}
40 {{- .context.Values.dbUser.existingSecret | quote -}}
45 Auxiliary function to get the right value for enabled cassandra.
48 {{ include "common.cassandra.values.enabled" (dict "context" $) }}
50 {{- define "common.cassandra.values.enabled" -}}
52 {{- printf "%v" .context.Values.cassandra.enabled -}}
54 {{- printf "%v" (not .context.Values.enabled) -}}
59 Auxiliary function to get the right value for the key dbUser
62 {{ include "common.cassandra.values.key.dbUser" (dict "subchart" "true" "context" $) }}
64 - subchart - Boolean - Optional. Whether Cassandra is used as subchart or not. Default: false
66 {{- define "common.cassandra.values.key.dbUser" -}}