[bitnami/cassandra] Use common password manager to handle passwords (#29560)

* [bitnami/cassandra] Use common password manager to handle passwords

Signed-off-by: Léo Colombaro <git@colombaro.fr>

* Update CHANGELOG.md

Signed-off-by: Bitnami Containers <bitnami-bot@vmware.com>

* Update CHANGELOG.md

Signed-off-by: Bitnami Containers <bitnami-bot@vmware.com>

---------

Signed-off-by: Léo Colombaro <git@colombaro.fr>
Signed-off-by: Bitnami Containers <bitnami-bot@vmware.com>
Co-authored-by: Bitnami Containers <bitnami-bot@vmware.com>
This commit is contained in:
Léo Colombaro
2024-09-26 08:42:02 +00:00
committed by GitHub
co-authored by Bitnami Containers
parent ab5bc9156d
commit 2f3e793a6b
4 changed files with 21 additions and 39 deletions
+14 -3
View File
@@ -1,8 +1,16 @@
# Changelog
## 12.0.1 (2024-09-10)
## 12.0.2 (2024-09-26)
* [bitnami/cassandra] Release 12.0.1 ([#29339](https://github.com/bitnami/charts/pull/29339))
* [bitnami/cassandra] Use common password manager to handle passwords ([#29560](https://github.com/bitnami/charts/pull/29560))
## <small>12.0.1 (2024-09-10)</small>
* [bitnami/cassandra] Release 12.0.1 (#29339) ([0349ba2](https://github.com/bitnami/charts/commit/0349ba298f17cef36647d887f74cc9600be00be5)), closes [#29339](https://github.com/bitnami/charts/issues/29339)
## 12.0.0 (2024-09-10)
* [bitnami/cassandra] Release 12.0.0 (#29305) ([a1acd8f](https://github.com/bitnami/charts/commit/a1acd8f74562ec3d85d0ee11e6d22c9d426699df)), closes [#29305](https://github.com/bitnami/charts/issues/29305)
## <small>11.4.2 (2024-09-04)</small>
@@ -10,8 +18,11 @@
## <small>11.4.1 (2024-09-03)</small>
* [bitnami/cassandra] feat: :sparkles: Allow setting initdb scripts in values (#29172) ([0aaac20](https://github.com/bitnami/charts/commit/0aaac209548b8c38af586322dbda2e86e8830600)), closes [#29172](https://github.com/bitnami/charts/issues/29172)
* [bitnami/cassandra] test: :white_check_mark: Improve ginkgo testing reliability (#29177) ([28cf5f7](https://github.com/bitnami/charts/commit/28cf5f7b8e48370b31d79ed596fd26697ac4a0dc)), closes [#29177](https://github.com/bitnami/charts/issues/29177)
## 11.4.0 (2024-09-03)
* [bitnami/cassandra] feat: :sparkles: Allow setting initdb scripts in values (#29172) ([0aaac20](https://github.com/bitnami/charts/commit/0aaac209548b8c38af586322dbda2e86e8830600)), closes [#29172](https://github.com/bitnami/charts/issues/29172)
* Update README.md (#29126) ([0d5e4f8](https://github.com/bitnami/charts/commit/0d5e4f85cd10e48fcf53dc6a9d69b2f4a4c8ae34)), closes [#29126](https://github.com/bitnami/charts/issues/29126)
## <small>11.3.14 (2024-08-28)</small>
+1 -1
View File
@@ -32,4 +32,4 @@ maintainers:
name: cassandra
sources:
- https://github.com/bitnami/charts/tree/main/bitnami/cassandra
version: 12.0.1
version: 12.0.2
+3 -32
View File
@@ -250,42 +250,13 @@ Return true if a TLS credentials secret object should be created
{{- end -}}
{{/*
Returns the available value for certain key in an existing secret (if it exists),
otherwise it generates a random value.
Get the password to use to access Cassandra
*/}}
{{- define "getValueFromSecret" }}
{{- $len := (default 16 .Length) | int -}}
{{- $obj := (lookup "v1" "Secret" .Namespace .Name).data -}}
{{- if $obj }}
{{- index $obj .Key | b64dec -}}
{{- else -}}
{{- randAlphaNum $len -}}
{{- end -}}
{{- end }}
{{- define "cassandra.password" -}}
{{- if .Values.dbUser.password }}
{{- .Values.dbUser.password }}
{{- else if (not .Values.dbUser.forcePassword) }}
{{- include "getValueFromSecret" (dict "Namespace" (include "common.names.namespace" .) "Name" (include "common.names.fullname" .) "Length" 10 "Key" "cassandra-password") -}}
{{- else }}
{{- if (and (empty .Values.dbUser.password) .Values.dbUser.forcePassword) }}
{{ required "A Cassandra Password is required!" .Values.dbUser.password }}
{{- end }}
{{- end -}}
{{- define "cassandra.keystore.password" -}}
{{- if .Values.tls.keystorePassword }}
{{- .Values.tls.keystorePassword }}
{{- else }}
{{- include "getValueFromSecret" (dict "Namespace" (include "common.names.namespace" .) "Name" (printf "%s-%s" (include "common.names.fullname" .) "tls-pass" | trunc 63 | trimSuffix "-") "Length" 10 "Key" "keystore-password") -}}
{{- end }}
{{- end -}}
{{- define "cassandra.truststore.password" -}}
{{- if .Values.tls.truststorePassword }}
{{- .Values.tls.truststorePassword }}
{{- else }}
{{- include "getValueFromSecret" (dict "Namespace" (include "common.names.namespace" .) "Name" (printf "%s-%s" (include "common.names.fullname" .) "tls-pass" | trunc 63 | trimSuffix "-") "Length" 10 "Key" "truststore-password") -}}
{{- include "common.secrets.passwords.manage" (dict "secret" (include "common.names.fullname" .) "key" "cassandra-password" "providedValues" (list "dbUser.password") "context" $) -}}
{{- end }}
{{- end -}}
@@ -15,7 +15,7 @@ metadata:
{{- end }}
type: Opaque
data:
cassandra-password: {{ include "cassandra.password" . | b64enc | quote }}
cassandra-password: {{ include "cassandra.password" . }}
{{ end }}
{{- if and (or .Values.tls.keystorePassword .Values.tls.truststorePassword .Values.tls.autoGenerated) (not .Values.tls.passwordsSecret) (not .Values.tls.tlsEncryptionSecretName) }}
---
@@ -31,9 +31,9 @@ metadata:
type: Opaque
data:
{{- if or .Values.tls.keystorePassword .Values.tls.autoGenerated }}
keystore-password: {{ include "cassandra.keystore.password" . | b64enc | quote }}
keystore-password: {{ include "common.secrets.passwords.manage" (dict "secret" (printf "%s-%s" (include "common.names.fullname" .) "tls-pass" | trunc 63 | trimSuffix "-") "key" "keystore-password" "providedValues" (list "tls.keystorePassword") "context" $) }}
{{- end }}
{{- if or .Values.tls.truststorePassword .Values.tls.autoGenerated }}
truststore-password: {{ include "cassandra.truststore.password" . | b64enc | quote }}
truststore-password: {{ include "common.secrets.passwords.manage" (dict "secret" (printf "%s-%s" (include "common.names.fullname" .) "tls-pass" | trunc 63 | trimSuffix "-") "key" "truststore-password" "providedValues" (list "tls.truststorePassword") "context" $) }}
{{- end }}
{{- end }}