bitnami / charts

Bitnami Helm Charts
https://bitnami.com
Other
8.8k stars 9.09k forks source link

[bitnami/redis] "externalMaster" option doesn't work if redis/sentinels and externalMaster ports are different or exposed outside. #16922

Open AlehYarmalovich opened 1 year ago

AlehYarmalovich commented 1 year ago

Name and Version

bitnami/redis 17.11.3

What architecture are you using?

amd64

What steps will reproduce the bug?

install helm chart with custom parameters

Are you using any custom parameters or values?

architecture: replication
useHostnames: false
sentinel:
  enabled: true
  quorum: 2
  masterSet: master
  downAfterMilliseconds: 2000
  failoverTimeout: 1000
  service:
    type: NodePort
    nodePorts:
      redis: 30310
      sentinel: 30420
  externalMaster:
    enabled: true
    host: xxx.xxx.xxx.xxx
    port: 30121
replica:
  externalMaster:
    enabled: true
    host: xxx.xxx.xxx.xxx
    port: 30111

What is the expected behavior?

 12:05:49.92 INFO  ==> about to run the command: timeout 220 redis-cli -h xxx.xxx.xxx.xxx -p 30420 sentinel get-master-addr-by-name master
Could not connect to Redis at xxx.xxx.xxx.xxx:30420: Connection refused
 12:06:09.97 INFO  ==> Configuring the node as master
1:C 25 May 2023 12:06:30.035 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
1:C 25 May 2023 12:06:30.035 # Redis version=7.0.11, bits=64, commit=00000000, modified=0, pid=1, just started
1:C 25 May 2023 12:06:30.035 # Configuration loaded
1:M 25 May 2023 12:06:30.036 * monotonic clock: POSIX clock_gettime
1:M 25 May 2023 12:06:30.037 * Running mode=standalone, port=6379.
1:M 25 May 2023 12:06:30.037 # Server initialized
1:M 25 May 2023 12:06:30.038 * Ready to accept connections

What do you see instead?

instead of:

if [ -n "$REDIS_EXTERNAL_MASTER_HOST" ]; then
     REDIS_SERVICE="$REDIS_EXTERNAL_MASTER_HOST"
else
    REDIS_SERVICE="{{ template "common.names.fullname" . }}.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}"
fi
SENTINEL_SERVICE_PORT=$(get_port "{{ include "common.names.fullname" . }}" "SENTINEL")

use:

if [ -n "$REDIS_EXTERNAL_MASTER_HOST" ]; then
     REDIS_SERVICE="$REDIS_EXTERNAL_MASTER_HOST"
     SENTINEL_SERVICE_PORT={{ .Values.sentinel.externalMaster.port | quote }}
else
    REDIS_SERVICE="{{ template "common.names.fullname" . }}.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}"
    SENTINEL_SERVICE_PORT=$(get_port "{{ include "common.names.fullname" . }}" "SENTINEL")
fi

I'll do a PR

Additional information

The port of the current installation is substituted into quorum_info_command and if they don't match the externalMaster port than the node is configuring as master. In the same time Sentinels join to external as well.

carrodher commented 1 year ago

Thanks for reporting this issue. Would you like to contribute by creating a PR to solve the issue? The Bitnami team will be happy to review it and provide feedback. Here you can find the contributing guidelines.

github-actions[bot] commented 1 year ago

This Issue has been automatically marked as "stale" because it has not had recent activity (for 15 days). It will be closed if no further activity occurs. Thanks for the feedback.

github-actions[bot] commented 1 year ago

Due to the lack of activity in the last 5 days since it was marked as "stale", we proceed to close this Issue. Do not hesitate to reopen it later if necessary.

AlehYarmalovich commented 1 year ago

Reopen