[bitnami/redis-cluster] Set usePasswordFiles=true by default (#32118)

* [bitnami/redis-cluster] Set `usePasswordFiles=true` by default

Signed-off-by: Miguel Ruiz <miguel.ruiz@broadcom.com>

* Update CHANGELOG.md

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

* Update README.md with readme-generator-for-helm

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

* Update CHANGELOG.md

Signed-off-by: Bitnami Bot <bitnami.bot@broadcom.com>

* Refactor REDISCLI_AUTH references and usePasswordFiles

Signed-off-by: Miguel Ruiz <miguel.ruiz@broadcom.com>

* Fix REDISCLI_AUTH

Signed-off-by: Miguel Ruiz <miguel.ruiz@broadcom.com>

* Update CHANGELOG.md

Signed-off-by: Bitnami Bot <bitnami.bot@broadcom.com>

* Fix cluster-init

Signed-off-by: Miguel Ruiz <miguel.ruiz@broadcom.com>

---------

Signed-off-by: Miguel Ruiz <miguel.ruiz@broadcom.com>
Signed-off-by: Bitnami Containers <bitnami-bot@vmware.com>
Signed-off-by: Bitnami Bot <bitnami.bot@broadcom.com>
Co-authored-by: Bitnami Containers <bitnami-bot@vmware.com>
Co-authored-by: Bitnami Bot <bitnami.bot@broadcom.com>
This commit is contained in:
Miguel Ruiz
2025-04-07 17:02:28 +02:00
committed by GitHub
parent f8d5d0c2ff
commit 2e2ac61c4c
14 changed files with 88 additions and 67 deletions

View File

@@ -1,8 +1,12 @@
# Changelog
## 11.4.6 (2025-03-22)
## 11.5.0 (2025-04-07)
* [bitnami/redis-cluster] Release 11.4.6 ([#32560](https://github.com/bitnami/charts/pull/32560))
* [bitnami/redis-cluster] Set `usePasswordFiles=true` by default ([#32118](https://github.com/bitnami/charts/pull/32118))
## <small>11.4.6 (2025-03-22)</small>
* [bitnami/redis-cluster] Release 11.4.6 (#32560) ([e433131](https://github.com/bitnami/charts/commit/e43313143d767e4cd8fa744a5b868ff3341ead47)), closes [#32560](https://github.com/bitnami/charts/issues/32560)
## <small>11.4.5 (2025-03-13)</small>

View File

@@ -33,4 +33,4 @@ maintainers:
name: redis-cluster
sources:
- https://github.com/bitnami/charts/tree/main/bitnami/redis-cluster
version: 11.4.6
version: 11.5.0

View File

@@ -457,7 +457,7 @@ See [#15075](https://github.com/bitnami/charts/issues/15075)
| `password` | Redis&reg; password (ignored if existingSecret set) | `""` |
| `existingSecret` | Name of existing secret object (for password authentication) | `""` |
| `existingSecretPasswordKey` | Name of key containing password to be retrieved from the existing secret | `""` |
| `usePasswordFile` | Mount passwords as files instead of environment variables | `false` |
| `usePasswordFiles` | Mount passwords as files instead of environment variables | `true` |
| `tls.enabled` | Enable TLS support for replication traffic | `false` |
| `tls.authClients` | Require clients to authenticate or not | `true` |
| `tls.autoGenerated` | Generate automatically self-signed TLS certificates | `false` |

View File

@@ -4,8 +4,8 @@ APP VERSION: {{ .Chart.AppVersion }}
Did you know there are enterprise versions of the Bitnami catalog? For enhanced secure software supply chain features, unlimited pulls from Docker, LTS support, or application customization, see Bitnami Premium or Tanzu Application Catalog. See https://www.arrow.com/globalecs/na/vendors/bitnami for more information.
{{- $secretName := include "redis-cluster.secretName" . -}}
{{- $secretPasswordKey := include "redis-cluster.secretPasswordKey" . -}}
{{- $secretName := include "redis-cluster.secretName" . }}
{{- $secretPasswordKey := include "redis-cluster.secretPasswordKey" . }}
** Please be patient while the chart is being deployed **
@@ -49,10 +49,10 @@ To connect to your Redis&reg; server from outside the cluster check the followin
helm upgrade --namespace {{ .Release.Namespace }} {{ .Release.Name }} --set "cluster.externalAccess.enabled=true,cluster.externalAccess.service.type=LoadBalancer{{- $root := . }}{{ $count := .Values.cluster.nodes | int }}{{ range $i, $v := until $count }},cluster.externalAccess.service.loadBalancerIP[{{ $i }}]=load-balancerip-{{- $i }}{{- end }}" oci://registry-1.docker.io/bitnamicharts/redis-cluster
Where loadbalancer-ip-i are the LoadBalancerIPs provided by the cluster.
{{- else -}}
{{- if .Values.cluster.init -}}
{{- else }}
{{- if .Values.cluster.init }}
INFO: The Job to create the cluster will be created.
{{- end -}}
{{- end }}
To connect to your database from outside the cluster execute the following commands:
@@ -64,9 +64,9 @@ To connect to your Redis&reg; server from outside the cluster check the followin
You have deployed a Redis&reg; Cluster accessible only from within you Kubernetes Cluster.
{{- if .Values.cluster.init -}}
{{- if .Values.cluster.init }}
INFO: The Job to create the cluster will be created.
{{- end -}}
{{- end }}
To connect to your Redis&reg; cluster:
@@ -101,21 +101,21 @@ redis-cli -c -h {{ template "common.names.fullname" . }}{{ if .Values.usePasswor
Note: Since NetworkPolicy is enabled, only pods with label
{{ template "common.names.fullname" . }}-client=true"
will be able to connect to redis.
{{- end -}}
{{- end -}}
{{- end }}
{{- end }}
{{- include "redis-cluster.validateValues" . }}
{{- include "redis-cluster.checkRollingTags" . }}
{{- include "common.warnings.rollingTag" .Values.volumePermissions.image }}
{{- include "common.warnings.rollingTag" .Values.sysctlImage }}
{{- if and .Values.usePassword (not .Values.existingSecret) -}}
{{- if and .Values.usePassword (not .Values.existingSecret) }}
{{- $requiredPassword := dict "valueKey" "password" "secret" $secretName "field" $secretPasswordKey "context" $ -}}
{{- $requiredPasswordError := include "common.validations.values.single.empty" $requiredPassword -}}
{{- $requiredPassword := dict "valueKey" "password" "secret" $secretName "field" $secretPasswordKey "context" $ }}
{{- $requiredPasswordError := include "common.validations.values.single.empty" $requiredPassword }}
{{- include "common.errors.upgrade.passwords.empty" (dict "validationErrors" (list $requiredPasswordError) "context" $) -}}
{{- end -}}
{{- include "common.errors.upgrade.passwords.empty" (dict "validationErrors" (list $requiredPasswordError) "context" $) }}
{{- end }}
{{- end }}
{{- include "common.warnings.resources" (dict "sections" (list "metrics" "redis" "sysctlImage" "updateJob" "volumePermissions") "context" $) }}
{{- include "common.warnings.modifiedImages" (dict "images" (list .Values.image .Values.volumePermissions.image .Values.metrics.image .Values.sysctlImage) "context" $) }}

View File

@@ -42,4 +42,4 @@ spec:
namespaceSelector:
matchNames:
- {{ include "common.names.namespace" . }}
{{- end -}}
{{- end }}

View File

@@ -22,7 +22,7 @@ spec:
{{- end }}
{{- if or .Values.pdb.maxUnavailable (not .Values.pdb.minAvailable) }}
maxUnavailable: {{ .Values.pdb.maxUnavailable | default 1 }}
{{- end }}
{{- end }}
{{- $podLabels := include "common.tplvalues.merge" ( dict "values" ( list .Values.redis.podLabels .Values.commonLabels ) "context" . ) }}
selector:
matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 6 }}

View File

@@ -3,7 +3,7 @@ Copyright Broadcom, Inc. All Rights Reserved.
SPDX-License-Identifier: APACHE-2.0
*/}}
{{- if .Values.rbac.create -}}
{{- if .Values.rbac.create }}
apiVersion: {{ include "common.capabilities.rbac.apiVersion" . }}
kind: Role
metadata:
@@ -19,8 +19,8 @@ rules:
resources: ['podsecuritypolicies']
verbs: ['use']
resourceNames: [{{ template "common.names.fullname" . }}]
{{- end -}}
{{- end }}
{{- if .Values.rbac.role.rules }}
{{- toYaml .Values.rbac.role.rules | nindent 2 }}
{{- end -}}
{{- end -}}
{{- end }}
{{- end }}

View File

@@ -3,7 +3,7 @@ Copyright Broadcom, Inc. All Rights Reserved.
SPDX-License-Identifier: APACHE-2.0
*/}}
{{- if .Values.rbac.create -}}
{{- if .Values.rbac.create }}
apiVersion: {{ include "common.capabilities.rbac.apiVersion" . }}
kind: RoleBinding
metadata:
@@ -20,4 +20,4 @@ roleRef:
subjects:
- kind: ServiceAccount
name: {{ template "redis-cluster.serviceAccountName" . }}
{{- end -}}
{{- end }}

View File

@@ -3,7 +3,7 @@ Copyright Broadcom, Inc. All Rights Reserved.
SPDX-License-Identifier: APACHE-2.0
*/}}
{{- if .Values.serviceAccount.create -}}
{{- if .Values.serviceAccount.create }}
apiVersion: v1
kind: ServiceAccount
metadata:
@@ -15,4 +15,4 @@ metadata:
annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $) | nindent 4 }}
{{- end }}
automountServiceAccountToken: {{ .Values.serviceAccount.automountServiceAccountToken }}
{{- end -}}
{{- end }}

View File

@@ -122,6 +122,9 @@ spec:
if [[ "$pod_index" == "0" ]]; then
export REDIS_CLUSTER_CREATOR="yes"
export REDIS_CLUSTER_REPLICAS="{{ .Values.cluster.replicas }}"
{{- if .Values.usePassword }}
export REDISCLI_AUTH={{ ternary "`cat $REDIS_PASSWORD_FILE`" "$REDIS_PASSWORD" .Values.usePasswordFiles }}
{{- end }}
fi
{{- end }}
/opt/bitnami/scripts/redis-cluster/entrypoint.sh /opt/bitnami/scripts/redis-cluster/run.sh
@@ -139,6 +142,9 @@ spec:
if [[ "$pod_index" == "0" ]]; then
export REDIS_CLUSTER_CREATOR="yes"
export REDIS_CLUSTER_REPLICAS="{{ .Values.cluster.replicas }}"
{{- if .Values.usePassword }}
export REDISCLI_AUTH={{ ternary "`cat $REDIS_PASSWORD_FILE`" "$REDIS_PASSWORD" .Values.usePasswordFiles }}
{{- end }}
fi
{{- end }}
/opt/bitnami/scripts/redis-cluster/entrypoint.sh /opt/bitnami/scripts/redis-cluster/run.sh
@@ -161,12 +167,7 @@ spec:
value: "{{ $count := .Values.cluster.nodes | int }}{{ range $i, $v := until $count }}{{ include "common.names.fullname" $ }}-{{ $i }}.{{ template "common.names.fullname" $ }}-headless {{ end }}"
{{- end }}
{{- if .Values.usePassword }}
- name: REDISCLI_AUTH
valueFrom:
secretKeyRef:
name: {{ template "redis-cluster.secretName" . }}
key: {{ template "redis-cluster.secretPasswordKey" . }}
{{- if .Values.usePasswordFile }}
{{- if .Values.usePasswordFiles }}
- name: REDIS_PASSWORD_FILE
value: "/opt/bitnami/redis/secrets/redis-password"
{{- else }}
@@ -279,7 +280,7 @@ spec:
volumeMounts:
- name: scripts
mountPath: /scripts
{{- if .Values.usePasswordFile }}
{{- if and .Values.usePassword .Values.usePasswordFiles }}
- name: redis-password
mountPath: /opt/bitnami/redis/secrets/
{{- end }}
@@ -324,7 +325,7 @@ spec:
- /bin/bash
- -c
- |
{{- if .Values.usePasswordFile }}
{{- if and .Values.usePassword .Values.usePasswordFiles }}
export REDIS_PASSWORD="$(< "${REDIS_PASSWORD_FILE}")"
{{- end }}
redis_exporter{{- range $key, $value := .Values.metrics.extraArgs }} --{{ $key }}={{ $value }}{{- end }}
@@ -336,16 +337,17 @@ spec:
value: {{ template "common.names.fullname" . }}
- name: REDIS_ADDR
value: {{ printf "%s://127.0.0.1:%g" (ternary "rediss" "redis" .Values.tls.enabled) .Values.redis.containerPorts.redis | quote }}
{{- if and .Values.usePassword (not .Values.usePasswordFile) }}
{{- if .Values.usePassword }}
{{- if .Values.usePasswordFiles }}
- name: REDIS_PASSWORD_FILE
value: "/opt/bitnami/redis/secrets/redis-password"
{{- else }}
- name: REDIS_PASSWORD
valueFrom:
secretKeyRef:
name: {{ template "redis-cluster.secretName" . }}
key: {{ template "redis-cluster.secretPasswordKey" . }}
{{- end }}
{{- if .Values.usePasswordFile }}
- name: REDIS_PASSWORD_FILE
value: "/opt/bitnami/redis/secrets/redis-password"
{{- end }}
{{- if .Values.tls.enabled }}
- name: REDIS_EXPORTER_TLS_CLIENT_KEY_FILE
@@ -360,12 +362,12 @@ spec:
{{- if .Values.metrics.extraEnvVars }}
{{- include "common.tplvalues.render" (dict "value" .Values.metrics.extraEnvVars "context" $) | nindent 12 }}
{{- end }}
{{- if or .Values.usePasswordFile .Values.tls.enabled }}
{{- if or (and .Values.usePassword .Values.usePasswordFiles ) .Values.tls.enabled }}
volumeMounts:
- name: empty-dir
mountPath: /tmp
subPath: tmp-dir
{{- if .Values.usePasswordFile }}
{{- if and .Values.usePassword .Values.usePasswordFiles }}
- name: redis-password
mountPath: /opt/bitnami/redis/secrets/
{{- end }}
@@ -442,7 +444,7 @@ spec:
configMap:
name: {{ include "common.names.fullname" . }}-scripts
defaultMode: 0755
{{- if .Values.usePasswordFile }}
{{- if and .Values.usePassword .Values.usePasswordFiles }}
- name: redis-password
secret:
secretName: {{ include "redis-cluster.secretName" . }}
@@ -505,11 +507,11 @@ spec:
{{- if .Values.persistence.matchLabels }}
matchLabels:
{{- toYaml .Values.persistence.matchLabels | nindent 12 }}
{{- end -}}
{{- end }}
{{- if .Values.persistence.matchExpressions }}
matchExpressions:
{{- toYaml .Values.persistence.matchExpressions | nindent 12 }}
{{- end -}}
{{- end }}
{{- end }}
{{- end }}
{{- end }}

View File

@@ -19,11 +19,8 @@ data:
REDIS_STATUS_FILE=/tmp/.redis_cluster_check
{{- if .Values.usePasswordFile }}
password_aux=`cat ${REDIS_PASSWORD_FILE}`
export REDISCLI_AUTH=$password_aux
{{- else }}
if [ ! -z "$REDIS_PASSWORD" ]; then export REDISCLI_AUTH=$REDIS_PASSWORD; fi;
{{- if .Values.usePassword }}
export REDISCLI_AUTH={{ ternary "`cat $REDIS_PASSWORD_FILE`" "$REDIS_PASSWORD" .Values.usePasswordFiles }}
{{- end }}
response=$(
timeout -s 15 $1 \
@@ -81,11 +78,8 @@ data:
#!/bin/sh
set -e
{{- if .Values.usePasswordFile }}
password_aux=`cat ${REDIS_PASSWORD_FILE}`
export REDISCLI_AUTH=$password_aux
{{- else }}
if [ ! -z "$REDIS_PASSWORD" ]; then export REDISCLI_AUTH=$REDIS_PASSWORD; fi;
{{- if .Values.usePassword }}
export REDISCLI_AUTH={{ ternary "`cat $REDIS_PASSWORD_FILE`" "$REDIS_PASSWORD" .Values.usePasswordFiles }}
{{- end }}
response=$(
timeout -s 15 $1 \

View File

@@ -3,7 +3,7 @@ Copyright Broadcom, Inc. All Rights Reserved.
SPDX-License-Identifier: APACHE-2.0
*/}}
{{- if and .Values.usePassword (not .Values.existingSecret) -}}
{{- if and .Values.usePassword (not .Values.existingSecret) }}
apiVersion: v1
kind: Secret
metadata:
@@ -16,4 +16,4 @@ metadata:
type: Opaque
data:
redis-password: {{ include "redis-cluster.password" . | b64enc | quote }}
{{- end -}}
{{- end }}

View File

@@ -79,6 +79,10 @@ spec:
- |
. /opt/bitnami/scripts/libnet.sh
. /opt/bitnami/scripts/libos.sh
{{- if .Values.usePassword }}
export REDISCLI_AUTH={{ ternary "`cat $REDIS_PASSWORD_FILE`" "$REDIS_PASSWORD" .Values.usePasswordFiles }}
{{- end }}
# Backwards compatibility change
if ! [[ -f /opt/bitnami/redis/etc/redis.conf ]]; then
cp /opt/bitnami/redis/etc/redis-default.conf /opt/bitnami/redis/etc/redis.conf
@@ -209,12 +213,17 @@ spec:
- name: REDIS_CLUSTER_REPLICAS
value: {{ .Values.cluster.replicas | quote }}
{{- if .Values.usePassword }}
- name: REDISCLI_AUTH
{{- if .Values.usePasswordFiles }}
- name: REDIS_PASSWORD_FILE
value: "/opt/bitnami/redis/secrets/redis-password"
{{- else }}
- name: REDIS_PASSWORD
valueFrom:
secretKeyRef:
name: {{ template "redis-cluster.secretName" . }}
key: {{ template "redis-cluster.secretPasswordKey" . }}
{{- end }}
{{- end }}
{{- if .Values.updateJob.extraEnvVars }}
{{- include "common.tplvalues.render" (dict "value" .Values.updateJob.extraEnvVars "context" $) | nindent 12 }}
{{- end }}
@@ -234,11 +243,15 @@ spec:
{{- else if ne .Values.updateJob.resourcesPreset "none" }}
resources: {{- include "common.resources.preset" (dict "type" .Values.updateJob.resourcesPreset) | nindent 12 }}
{{- end }}
{{- if or .Values.tls.enabled .Values.updateJob.extraVolumeMounts }}
{{- if or .Values.tls.enabled (and .Values.usePassword .Values.usePasswordFiles) .Values.updateJob.extraVolumeMounts }}
volumeMounts:
- name: empty-dir
mountPath: /tmp
subPath: tmp-dir
{{- if and .Values.usePassword .Values.usePasswordFiles }}
- name: redis-password
mountPath: /opt/bitnami/redis/secrets/
{{- end }}
{{- if .Values.tls.enabled }}
- name: redis-certificates
mountPath: /opt/bitnami/redis/certs
@@ -249,18 +262,26 @@ spec:
{{- end }}
{{- end }}
restartPolicy: OnFailure
{{- if or .Values.tls.enabled .Values.updateJob.extraVolumes }}
{{- if or .Values.tls.enabled (and .Values.usePassword .Values.usePasswordFiles) .Values.updateJob.extraVolumes }}
volumes:
- name: empty-dir
emptyDir: {}
{{- if .Values.tls.enabled }}
{{- if and .Values.usePassword .Values.usePasswordFiles }}
- name: redis-password
secret:
secretName: {{ include "redis-cluster.secretName" . }}
items:
- key: {{ include "redis-cluster.secretPasswordKey" . }}
path: redis-password
{{- end }}
{{- if .Values.tls.enabled }}
- name: redis-certificates
secret:
secretName: {{ include "common.tplvalues.render" (dict "value" .Values.tls.certificatesSecret "context" $) }}
{{- end }}
{{- if .Values.updateJob.extraVolumes }}
{{- include "common.tplvalues.render" (dict "value" .Values.updateJob.extraVolumes "context" $) | nindent 6 }}
{{- end }}
{{- end }}
{{- if .Values.updateJob.extraVolumes }}
{{- include "common.tplvalues.render" (dict "value" .Values.updateJob.extraVolumes "context" $) | nindent 6 }}
{{- end }}
{{- end }}
{{- end }}

View File

@@ -268,9 +268,9 @@ existingSecret: ""
## @param existingSecretPasswordKey Name of key containing password to be retrieved from the existing secret
##
existingSecretPasswordKey: ""
## @param usePasswordFile Mount passwords as files instead of environment variables
## @param usePasswordFiles Mount passwords as files instead of environment variables
##
usePasswordFile: false
usePasswordFiles: true
##
## TLS configuration
##