From db87edae8abd7588f962089cf2cc1484c9d8187b Mon Sep 17 00:00:00 2001 From: Jia-wei Yu Date: Sat, 29 Jul 2023 19:26:35 +0800 Subject: [PATCH 1/6] feat: support external hostname Signed-off-by: Jia-wei Yu --- bitnami/redis-cluster/README.md | 1 + .../templates/redis-statefulset.yaml | 25 ++++++++++++++++++- bitnami/redis-cluster/values.yaml | 4 +++ 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/bitnami/redis-cluster/README.md b/bitnami/redis-cluster/README.md index 7af50d2c163ce9..54596062bd5364 100644 --- a/bitnami/redis-cluster/README.md +++ b/bitnami/redis-cluster/README.md @@ -272,6 +272,7 @@ The command removes all the Kubernetes components associated with the chart and | `cluster.nodes` | The number of master nodes should always be >= 3, otherwise cluster creation will fail | `6` | | `cluster.replicas` | Number of replicas for every master in the cluster | `1` | | `cluster.externalAccess.enabled` | Enable access to the Redis | `false` | +| `cluster.externalAccess.hostMode` | Set cluster preferred endpoint type as hostname | `false` | | `cluster.externalAccess.service.type` | Type for the services used to expose every Pod | `LoadBalancer` | | `cluster.externalAccess.service.port` | Port for the services used to expose every Pod | `6379` | | `cluster.externalAccess.service.loadBalancerIP` | Array of load balancer IPs for each Redis® node. Length must be the same as cluster.nodes | `[]` | diff --git a/bitnami/redis-cluster/templates/redis-statefulset.yaml b/bitnami/redis-cluster/templates/redis-statefulset.yaml index 2e79301b72c3a4..ce0d0e4cef5980 100644 --- a/bitnami/redis-cluster/templates/redis-statefulset.yaml +++ b/bitnami/redis-cluster/templates/redis-statefulset.yaml @@ -106,6 +106,26 @@ spec: args: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.args "context" $) | nindent 12 }} {{- else if .Values.redis.args }} args: {{- include "common.tplvalues.render" (dict "value" .Values.redis.args "context" $) | nindent 12 }} + {{- else if and .Values.cluster.externalAccess.enabled .Values.cluster.externalAccess.hostMode }} + args: + - | + # 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 + fi + pod_index=($(echo "$POD_NAME" | tr "-" "\n")) + pod_index="${pod_index[-1]}" + ips=($(echo "{{ .Values.cluster.externalAccess.service.loadBalancerIP }}" | cut -d [ -f2 | cut -d ] -f 1)) + export REDIS_CLUSTER_ANNOUNCE_HOST="${ips[$pod_index]}" + export REDIS_NODES="${ips[@]}" + export REDIS_CLUSTER_PREFERRED_ENDPOINT_TYPE=hostname + {{- if .Values.cluster.init }} + if [[ "$pod_index" == "0" ]]; then + export REDIS_CLUSTER_CREATOR="yes" + export REDIS_CLUSTER_REPLICAS="{{ .Values.cluster.replicas }}" + fi + {{- end }} + /opt/bitnami/scripts/redis-cluster/entrypoint.sh /opt/bitnami/scripts/redis-cluster/run.sh {{- else if .Values.cluster.externalAccess.enabled }} args: - | @@ -148,7 +168,10 @@ spec: valueFrom: fieldRef: fieldPath: metadata.name - {{- if .Values.cluster.externalAccess.enabled }} + {{- if and .Values.cluster.externalAccess.enabled .Values.cluster.externalAccess.hostMode }} + - name: REDIS_CLUSTER_DYNAMIC_IPS + value: "yes" + {{- else if .Values.cluster.externalAccess.enabled }} - name: REDIS_CLUSTER_DYNAMIC_IPS value: "no" {{- else }} diff --git a/bitnami/redis-cluster/values.yaml b/bitnami/redis-cluster/values.yaml index 742bf80564ad16..443b24c5ce61be 100644 --- a/bitnami/redis-cluster/values.yaml +++ b/bitnami/redis-cluster/values.yaml @@ -781,6 +781,10 @@ cluster: ## @param cluster.externalAccess.enabled Enable access to the Redis ## enabled: false + ## @param cluster.externalAccess.hostMode Set cluster preferred endpoint type as hostname + ## ref: https://github.com/redis/redis/pull/9530 + ## + hostMode: false service: ## @param cluster.externalAccess.service.type Type for the services used to expose every Pod ## At this moment only LoadBalancer is supported From fea931103b10ae107647e48dc3c8544e6052e9a3 Mon Sep 17 00:00:00 2001 From: Jia-wei Yu Date: Sat, 29 Jul 2023 23:58:57 +0800 Subject: [PATCH 2/6] bump version Signed-off-by: Jia-wei Yu --- bitnami/redis-cluster/Chart.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bitnami/redis-cluster/Chart.yaml b/bitnami/redis-cluster/Chart.yaml index aa033599fbffd5..04b5d2a5fe99a3 100644 --- a/bitnami/redis-cluster/Chart.yaml +++ b/bitnami/redis-cluster/Chart.yaml @@ -5,7 +5,7 @@ annotations: category: Database licenses: Apache-2.0 apiVersion: v2 -appVersion: 7.0.12 +appVersion: 7.0.13 dependencies: - name: common repository: oci://registry-1.docker.io/bitnamicharts @@ -25,4 +25,4 @@ maintainers: name: redis-cluster sources: - https://github.com/bitnami/charts/tree/main/bitnami/redis-cluster -version: 8.6.12 +version: 8.6.13 From 399a8b7011bfb8fa556916ce33801e16853bf77b Mon Sep 17 00:00:00 2001 From: Jia-wei Yu Date: Wed, 2 Aug 2023 08:00:46 +0800 Subject: [PATCH 3/6] fix: redis environment var Signed-off-by: Jia-wei Yu --- .../templates/redis-statefulset.yaml | 26 +++++-------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/bitnami/redis-cluster/templates/redis-statefulset.yaml b/bitnami/redis-cluster/templates/redis-statefulset.yaml index ce0d0e4cef5980..800e5f651a09a3 100644 --- a/bitnami/redis-cluster/templates/redis-statefulset.yaml +++ b/bitnami/redis-cluster/templates/redis-statefulset.yaml @@ -106,26 +106,6 @@ spec: args: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.args "context" $) | nindent 12 }} {{- else if .Values.redis.args }} args: {{- include "common.tplvalues.render" (dict "value" .Values.redis.args "context" $) | nindent 12 }} - {{- else if and .Values.cluster.externalAccess.enabled .Values.cluster.externalAccess.hostMode }} - args: - - | - # 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 - fi - pod_index=($(echo "$POD_NAME" | tr "-" "\n")) - pod_index="${pod_index[-1]}" - ips=($(echo "{{ .Values.cluster.externalAccess.service.loadBalancerIP }}" | cut -d [ -f2 | cut -d ] -f 1)) - export REDIS_CLUSTER_ANNOUNCE_HOST="${ips[$pod_index]}" - export REDIS_NODES="${ips[@]}" - export REDIS_CLUSTER_PREFERRED_ENDPOINT_TYPE=hostname - {{- if .Values.cluster.init }} - if [[ "$pod_index" == "0" ]]; then - export REDIS_CLUSTER_CREATOR="yes" - export REDIS_CLUSTER_REPLICAS="{{ .Values.cluster.replicas }}" - fi - {{- end }} - /opt/bitnami/scripts/redis-cluster/entrypoint.sh /opt/bitnami/scripts/redis-cluster/run.sh {{- else if .Values.cluster.externalAccess.enabled }} args: - | @@ -136,7 +116,11 @@ spec: pod_index=($(echo "$POD_NAME" | tr "-" "\n")) pod_index="${pod_index[-1]}" ips=($(echo "{{ .Values.cluster.externalAccess.service.loadBalancerIP }}" | cut -d [ -f2 | cut -d ] -f 1)) + {{- if .Values.cluster.externalAccess.hostMode }} + export REDIS_CLUSTER_ANNOUNCE_HOSTNAME="${ips[$pod_index]}" + {{- else }} export REDIS_CLUSTER_ANNOUNCE_IP="${ips[$pod_index]}" + {{- end }} export REDIS_NODES="${ips[@]}" {{- if .Values.cluster.init }} if [[ "$pod_index" == "0" ]]; then @@ -171,6 +155,8 @@ spec: {{- if and .Values.cluster.externalAccess.enabled .Values.cluster.externalAccess.hostMode }} - name: REDIS_CLUSTER_DYNAMIC_IPS value: "yes" + - name: REDIS_CLUSTER_PREFERRED_ENDPOINT_TYPE + value: "hostname" {{- else if .Values.cluster.externalAccess.enabled }} - name: REDIS_CLUSTER_DYNAMIC_IPS value: "no" From 4a492ab2d2093b4a6029bf7860b95014d8ce9aa5 Mon Sep 17 00:00:00 2001 From: Jia-wei Yu Date: Wed, 16 Aug 2023 21:01:02 +0800 Subject: [PATCH 4/6] chore: update chart version Signed-off-by: Jia-wei Yu --- bitnami/redis-cluster/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bitnami/redis-cluster/Chart.yaml b/bitnami/redis-cluster/Chart.yaml index 5b33ca764d69ae..54e569a8b3ff7c 100644 --- a/bitnami/redis-cluster/Chart.yaml +++ b/bitnami/redis-cluster/Chart.yaml @@ -32,4 +32,4 @@ maintainers: name: redis-cluster sources: - https://github.com/bitnami/charts/tree/main/bitnami/redis-cluster -version: 8.6.13 +version: 8.7.12 From 3f86665f6106513f20f7644b0bac3fd384ee7743 Mon Sep 17 00:00:00 2001 From: Jia-wei Yu Date: Wed, 16 Aug 2023 21:40:22 +0800 Subject: [PATCH 5/6] chore: app version Signed-off-by: Jia-wei Yu --- bitnami/redis-cluster/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bitnami/redis-cluster/Chart.yaml b/bitnami/redis-cluster/Chart.yaml index 54e569a8b3ff7c..ef66074a2cc664 100644 --- a/bitnami/redis-cluster/Chart.yaml +++ b/bitnami/redis-cluster/Chart.yaml @@ -12,7 +12,7 @@ annotations: - name: redis-exporter image: docker.io/bitnami/redis-exporter:1.52.0-debian-11-r17 apiVersion: v2 -appVersion: 7.2.0 +appVersion: 7.3.0 dependencies: - name: common repository: oci://registry-1.docker.io/bitnamicharts From 0d665b035ccd86fce8680c80cf2a8cbbb9fe78b7 Mon Sep 17 00:00:00 2001 From: Jia-wei Yu Date: Wed, 16 Aug 2023 21:43:23 +0800 Subject: [PATCH 6/6] chore: update version Signed-off-by: Jia-wei Yu --- bitnami/redis-cluster/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bitnami/redis-cluster/Chart.yaml b/bitnami/redis-cluster/Chart.yaml index ef66074a2cc664..19e15a85e367fa 100644 --- a/bitnami/redis-cluster/Chart.yaml +++ b/bitnami/redis-cluster/Chart.yaml @@ -32,4 +32,4 @@ maintainers: name: redis-cluster sources: - https://github.com/bitnami/charts/tree/main/bitnami/redis-cluster -version: 8.7.12 +version: 8.7.0