mirror of
https://github.com/bitnami/charts.git
synced 2026-08-10 14:15:55 +08:00
[bitnami/redis] Fix Redis sentinel synchronization and user creation permission error (#4820)
* Fixed race condition for sentinel synchronization and missing nil check * Added check for sentinel to add publishNotReadyAddresses * Added missing nil check for non-sentinel deployment * [bitnami/redis] Update components versions Signed-off-by: Bitnami Containers <containers@bitnami.com> Co-authored-by: Bitnami Containers <containers@bitnami.com>
This commit is contained in:
co-authored by
Bitnami Containers
parent
2d3be4e547
commit
a6c17cf6fa
@@ -19,4 +19,4 @@ name: redis
|
||||
sources:
|
||||
- https://github.com/bitnami/bitnami-docker-redis
|
||||
- http://redis.io/
|
||||
version: 12.3.1
|
||||
version: 12.3.2
|
||||
|
||||
@@ -24,25 +24,14 @@ data:
|
||||
}
|
||||
|
||||
HEADLESS_SERVICE="{{ template "redis.fullname" . }}-headless.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}"
|
||||
REDIS_SERVICE="{{ template "redis.fullname" . }}.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}"
|
||||
|
||||
export REDIS_REPLICATION_MODE="slave"
|
||||
if [[ -z "$(getent ahosts "$HEADLESS_SERVICE" | grep -v "^$(hostname -i) ")" ]]; then
|
||||
if [[ ! -f /data/redisboot.lock ]]; then
|
||||
export REDIS_REPLICATION_MODE="master"
|
||||
else
|
||||
if is_boolean_yes "$REDIS_TLS_ENABLED"; then
|
||||
sentinel_info_command="redis-cli {{- if .Values.usePassword }} -a $REDIS_PASSWORD {{- end }} -h $HEADLESS_SERVICE -p {{ .Values.sentinel.port }} --tls --cert ${REDIS_TLS_CERT_FILE} --key ${REDIS_TLS_KEY_FILE} --cacert ${REDIS_TLS_CA_FILE} info"
|
||||
else
|
||||
sentinel_info_command="redis-cli {{- if .Values.usePassword }} -a $REDIS_PASSWORD {{- end }} -h $HEADLESS_SERVICE -p {{ .Values.sentinel.port }} info"
|
||||
fi
|
||||
if [[ ! ($($sentinel_info_command)) ]]; then
|
||||
export REDIS_REPLICATION_MODE="master"
|
||||
rm /data/redisboot.lock
|
||||
fi
|
||||
fi
|
||||
export REDIS_REPLICATION_MODE="master"
|
||||
fi
|
||||
|
||||
{{- if (eq (.Values.securityContext.runAsUser | int) 0) }}
|
||||
{{- if and .Values.securityContext.runAsUser (eq (.Values.securityContext.runAsUser | int) 0) }}
|
||||
useradd redis
|
||||
chown -R redis {{ .Values.slave.persistence.path }}
|
||||
{{- end }}
|
||||
@@ -68,9 +57,9 @@ data:
|
||||
fi
|
||||
|
||||
if is_boolean_yes "$REDIS_TLS_ENABLED"; then
|
||||
sentinel_info_command="redis-cli {{- if .Values.usePassword }} -a $REDIS_PASSWORD {{- end }} -h $HEADLESS_SERVICE -p {{ .Values.sentinel.port }} --tls --cert ${REDIS_TLS_CERT_FILE} --key ${REDIS_TLS_KEY_FILE} --cacert ${REDIS_TLS_CA_FILE} sentinel get-master-addr-by-name {{ .Values.sentinel.masterSet }}"
|
||||
sentinel_info_command="redis-cli {{- if .Values.usePassword }} -a $REDIS_PASSWORD {{- end }} -h $REDIS_SERVICE -p {{ .Values.sentinel.port }} --tls --cert ${REDIS_TLS_CERT_FILE} --key ${REDIS_TLS_KEY_FILE} --cacert ${REDIS_TLS_CA_FILE} sentinel get-master-addr-by-name {{ .Values.sentinel.masterSet }}"
|
||||
else
|
||||
sentinel_info_command="redis-cli {{- if .Values.usePassword }} -a $REDIS_PASSWORD {{- end }} -h $HEADLESS_SERVICE -p {{ .Values.sentinel.port }} sentinel get-master-addr-by-name {{ .Values.sentinel.masterSet }}"
|
||||
sentinel_info_command="redis-cli {{- if .Values.usePassword }} -a $REDIS_PASSWORD {{- end }} -h $REDIS_SERVICE -p {{ .Values.sentinel.port }} sentinel get-master-addr-by-name {{ .Values.sentinel.masterSet }}"
|
||||
fi
|
||||
REDIS_SENTINEL_INFO=($($sentinel_info_command))
|
||||
REDIS_MASTER_HOST=${REDIS_SENTINEL_INFO[0]}
|
||||
@@ -136,7 +125,6 @@ data:
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
touch /data/redisboot.lock
|
||||
{{- if .Values.slave.command }}
|
||||
exec {{ .Values.slave.command }} "${ARGS[@]}"
|
||||
{{- else }}
|
||||
@@ -194,6 +182,7 @@ data:
|
||||
}
|
||||
|
||||
HEADLESS_SERVICE="{{ template "redis.fullname" . }}-headless.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}"
|
||||
REDIS_SERVICE="{{ template "redis.fullname" . }}.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}"
|
||||
|
||||
if [[ -n $REDIS_PASSWORD_FILE ]]; then
|
||||
password_aux=`cat ${REDIS_PASSWORD_FILE}`
|
||||
@@ -215,19 +204,7 @@ data:
|
||||
|
||||
export REDIS_REPLICATION_MODE="slave"
|
||||
if [[ -z "$(getent ahosts "$HEADLESS_SERVICE" | grep -v "^$(hostname -i) ")" ]]; then
|
||||
if [[ ! -f /data/sentinelboot.lock ]]; then
|
||||
export REDIS_REPLICATION_MODE="master"
|
||||
else
|
||||
if is_boolean_yes "$REDIS_SENTINEL_TLS_ENABLED"; then
|
||||
sentinel_info_command="redis-cli {{- if .Values.usePassword }} -a $REDIS_PASSWORD {{- end }} -h $HEADLESS_SERVICE -p {{ .Values.sentinel.port }} --tls --cert ${REDIS_SENTINEL_TLS_CERT_FILE} --key ${REDIS_SENTINEL_TLS_KEY_FILE} --cacert ${REDIS_SENTINEL_TLS_CA_FILE} info"
|
||||
else
|
||||
sentinel_info_command="redis-cli {{- if .Values.usePassword }} -a $REDIS_PASSWORD {{- end }} -h $HEADLESS_SERVICE -p {{ .Values.sentinel.port }} info"
|
||||
fi
|
||||
if [[ ! ($($sentinel_info_command)) ]]; then
|
||||
export REDIS_REPLICATION_MODE="master"
|
||||
rm /data/sentinelboot.lock
|
||||
fi
|
||||
fi
|
||||
export REDIS_REPLICATION_MODE="master"
|
||||
fi
|
||||
|
||||
if [[ "$REDIS_REPLICATION_MODE" == "master" ]]; then
|
||||
@@ -235,9 +212,9 @@ data:
|
||||
REDIS_MASTER_PORT_NUMBER="{{ .Values.redisPort }}"
|
||||
else
|
||||
if is_boolean_yes "$REDIS_SENTINEL_TLS_ENABLED"; then
|
||||
sentinel_info_command="redis-cli {{- if .Values.usePassword }} -a $REDIS_PASSWORD {{- end }} -h $HEADLESS_SERVICE -p {{ .Values.sentinel.port }} --tls --cert ${REDIS_SENTINEL_TLS_CERT_FILE} --key ${REDIS_SENTINEL_TLS_KEY_FILE} --cacert ${REDIS_SENTINEL_TLS_CA_FILE} sentinel get-master-addr-by-name {{ .Values.sentinel.masterSet }}"
|
||||
sentinel_info_command="redis-cli {{- if .Values.usePassword }} -a $REDIS_PASSWORD {{- end }} -h $REDIS_SERVICE -p {{ .Values.sentinel.port }} --tls --cert ${REDIS_SENTINEL_TLS_CERT_FILE} --key ${REDIS_SENTINEL_TLS_KEY_FILE} --cacert ${REDIS_SENTINEL_TLS_CA_FILE} sentinel get-master-addr-by-name {{ .Values.sentinel.masterSet }}"
|
||||
else
|
||||
sentinel_info_command="redis-cli {{- if .Values.usePassword }} -a $REDIS_PASSWORD {{- end }} -h $HEADLESS_SERVICE -p {{ .Values.sentinel.port }} sentinel get-master-addr-by-name {{ .Values.sentinel.masterSet }}"
|
||||
sentinel_info_command="redis-cli {{- if .Values.usePassword }} -a $REDIS_PASSWORD {{- end }} -h $REDIS_SERVICE -p {{ .Values.sentinel.port }} sentinel get-master-addr-by-name {{ .Values.sentinel.masterSet }}"
|
||||
fi
|
||||
REDIS_SENTINEL_INFO=($($sentinel_info_command))
|
||||
REDIS_MASTER_HOST=${REDIS_SENTINEL_INFO[0]}
|
||||
@@ -295,12 +272,11 @@ data:
|
||||
ARGS+=("--tls-dh-params-file" "${REDIS_SENTINEL_TLS_DH_PARAMS_FILE}")
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
touch /data/sentinelboot.lock
|
||||
exec redis-server /opt/bitnami/redis-sentinel/etc/sentinel.conf --sentinel {{- if .Values.tls.enabled }} "${ARGS[@]}" {{- end }}
|
||||
{{- else }}
|
||||
start-master.sh: |
|
||||
#!/bin/bash
|
||||
{{- if (eq (.Values.securityContext.runAsUser | int) 0) }}
|
||||
{{- if and .Values.securityContext.runAsUser (eq (.Values.securityContext.runAsUser | int) 0) }}
|
||||
useradd redis
|
||||
chown -R redis {{ .Values.master.persistence.path }}
|
||||
{{- end }}
|
||||
@@ -351,7 +327,7 @@ data:
|
||||
{{- if .Values.cluster.enabled }}
|
||||
start-slave.sh: |
|
||||
#!/bin/bash
|
||||
{{- if (eq (.Values.securityContext.runAsUser | int) 0) }}
|
||||
{{- if and .Values.securityContext.runAsUser (eq (.Values.securityContext.runAsUser | int) 0) }}
|
||||
useradd redis
|
||||
chown -R redis {{ .Values.slave.persistence.path }}
|
||||
{{- end }}
|
||||
|
||||
@@ -11,6 +11,9 @@ metadata:
|
||||
spec:
|
||||
type: ClusterIP
|
||||
clusterIP: None
|
||||
{{- if .Values.sentinel.enabled }}
|
||||
publishNotReadyAddresses: true
|
||||
{{- end }}
|
||||
ports:
|
||||
- name: redis
|
||||
port: {{ .Values.redisPort }}
|
||||
|
||||
@@ -18,7 +18,7 @@ image:
|
||||
## Bitnami Redis image tag
|
||||
## ref: https://github.com/bitnami/bitnami-docker-redis#supported-tags-and-respective-dockerfile-links
|
||||
##
|
||||
tag: 6.0.9-debian-10-r38
|
||||
tag: 6.0.9-debian-10-r66
|
||||
## Specify a imagePullPolicy
|
||||
## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent'
|
||||
## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images
|
||||
@@ -60,7 +60,7 @@ sentinel:
|
||||
## Bitnami Redis image tag
|
||||
## ref: https://github.com/bitnami/bitnami-docker-redis-sentinel#supported-tags-and-respective-dockerfile-links
|
||||
##
|
||||
tag: 6.0.9-debian-10-r38
|
||||
tag: 6.0.9-debian-10-r66
|
||||
## Specify a imagePullPolicy
|
||||
## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent'
|
||||
## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images
|
||||
@@ -650,7 +650,7 @@ metrics:
|
||||
image:
|
||||
registry: docker.io
|
||||
repository: bitnami/redis-exporter
|
||||
tag: 1.13.1-debian-10-r32
|
||||
tag: 1.15.0-debian-10-r8
|
||||
pullPolicy: IfNotPresent
|
||||
## Optionally specify an array of imagePullSecrets.
|
||||
## Secrets must be manually created in the namespace.
|
||||
|
||||
@@ -18,7 +18,7 @@ image:
|
||||
## Bitnami Redis image tag
|
||||
## ref: https://github.com/bitnami/bitnami-docker-redis#supported-tags-and-respective-dockerfile-links
|
||||
##
|
||||
tag: 6.0.9-debian-10-r38
|
||||
tag: 6.0.9-debian-10-r66
|
||||
## Specify a imagePullPolicy
|
||||
## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent'
|
||||
## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images
|
||||
@@ -60,7 +60,7 @@ sentinel:
|
||||
## Bitnami Redis image tag
|
||||
## ref: https://github.com/bitnami/bitnami-docker-redis-sentinel#supported-tags-and-respective-dockerfile-links
|
||||
##
|
||||
tag: 6.0.9-debian-10-r38
|
||||
tag: 6.0.9-debian-10-r66
|
||||
## Specify a imagePullPolicy
|
||||
## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent'
|
||||
## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images
|
||||
@@ -651,7 +651,7 @@ metrics:
|
||||
image:
|
||||
registry: docker.io
|
||||
repository: bitnami/redis-exporter
|
||||
tag: 1.13.1-debian-10-r32
|
||||
tag: 1.15.0-debian-10-r8
|
||||
pullPolicy: IfNotPresent
|
||||
## Optionally specify an array of imagePullSecrets.
|
||||
## Secrets must be manually created in the namespace.
|
||||
|
||||
Reference in New Issue
Block a user