[bitnami/redis] Added support for hostname announcement in cluster setup (#26832)

* feat(): Added support for hostname announcement in cluster

Signed-off-by: Devesh Kumar <devesh.kumar@widas.in>

* fix(): Fixed typo in readme file

Signed-off-by: Devesh Kumar <devesh.kumar@widas.in>

---------

Signed-off-by: Devesh Kumar <devesh.kumar@widas.in>
Co-authored-by: Devesh Kumar <devesh.kumar@widas.in>
This commit is contained in:
Devesh Kumar
2023-03-15 13:41:38 +01:00
committed by GitHub
parent 93e5adeaf6
commit b393a6e7ec
3 changed files with 15 additions and 3 deletions

View File

@@ -87,10 +87,16 @@ redis_cluster_override_conf() {
# Always set the announce-ip to avoid issues when using proxies and traffic restrictions.
redis_conf_set cluster-announce-ip "$(get_machine_ip)"
fi
if ! is_empty_value "$REDIS_CLUSTER_ANNOUNCE_HOSTNAME"; then
redis_conf_set "cluster-announce-hostname" "$REDIS_CLUSTER_ANNOUNCE_HOSTNAME"
fi
if ! is_empty_value "$REDIS_CLUSTER_PREFERRED_ENDPOINT_TYPE"; then
redis_conf_set "cluster-preferred-endpoint-type" "$REDIS_CLUSTER_PREFERRED_ENDPOINT_TYPE"
fi
if is_boolean_yes "$REDIS_TLS_ENABLED"; then
redis_conf_set tls-cluster yes
redis_conf_set tls-replication yes
fi
fi
if ! is_empty_value "$REDIS_CLUSTER_ANNOUNCE_PORT"; then
redis_conf_set "cluster-announce-port" "$REDIS_CLUSTER_ANNOUNCE_PORT"
fi

View File

@@ -55,6 +55,8 @@ redis_cluster_env_vars=(
REDIS_CLUSTER_ANNOUNCE_IP
REDIS_CLUSTER_ANNOUNCE_PORT
REDIS_CLUSTER_ANNOUNCE_BUS_PORT
REDIS_CLUSTER_ANNOUNCE_HOSTNAME
REDIS_CLUSTER_PREFERRED_ENDPOINT_TYPE
REDIS_DNS_RETRIES
REDIS_NODES
REDIS_CLUSTER_SLEEP_BEFORE_DNS_LOOKUP
@@ -132,6 +134,8 @@ export REDIS_CLUSTER_DYNAMIC_IPS="${REDIS_CLUSTER_DYNAMIC_IPS:-yes}"
export REDIS_CLUSTER_ANNOUNCE_IP="${REDIS_CLUSTER_ANNOUNCE_IP:-}"
export REDIS_CLUSTER_ANNOUNCE_PORT="${REDIS_CLUSTER_ANNOUNCE_PORT:-}"
export REDIS_CLUSTER_ANNOUNCE_BUS_PORT="${REDIS_CLUSTER_ANNOUNCE_BUS_PORT:-}"
export REDIS_CLUSTER_ANNOUNCE_HOSTNAME="${REDIS_CLUSTER_ANNOUNCE_HOSTNAME:-}"
export REDIS_CLUSTER_PREFERRED_ENDPOINT_TYPE="${REDIS_CLUSTER_PREFERRED_ENDPOINT_TYPE:-ip}"
export REDIS_DNS_RETRIES="${REDIS_DNS_RETRIES:-120}"
export REDIS_NODES="${REDIS_NODES:-}"
export REDIS_CLUSTER_SLEEP_BEFORE_DNS_LOOKUP="${REDIS_CLUSTER_SLEEP_BEFORE_DNS_LOOKUP:-0}"

View File

@@ -180,8 +180,10 @@ The following env vars are supported for this container:
| `REDIS_CLUSTER_CREATOR` | Set to `yes` if the container will be the one on charge of initialize the cluster. This node will also be part of the cluster. |
| `REDIS_CLUSTER_REPLICAS` | Number of replicas for every master that the cluster will have. |
| `REDIS_NODES` | String delimited by spaces containing the hostnames of all of the nodes that will be part of the cluster |
| `REDIS_CLUSTER_ANNOUNCE_IP` | IP that the node should announce, used for non dynamic ip environents |
| `REDIS_CLUSTER_ANNOUNCE_PORT` | Port that the node should announce, used for non dynamic ip environents. |
| `REDIS_CLUSTER_ANNOUNCE_IP` | IP that the node should announce, used for non dynamic ip environments |
| `REDIS_CLUSTER_ANNOUNCE_PORT` | Port that the node should announce, used for non dynamic ip environments. |
| `REDIS_CLUSTER_ANNOUNCE_HOSTNAME` | Hostname that node should announce, used for non dynamic ip environments. |
| `REDIS_CLUSTER_PREFERRED_ENDPOINT_TYPE` | Preferred endpoint type which cluster should use, options- ip, hostname|
| `REDIS_CLUSTER_ANNOUNCE_BUS_PORT` | The cluster bus port to announce. |
| `REDIS_CLUSTER_DYNAMIC_IPS` | Set to `no` if your Redis(R) cluster will be created with statical IPs. Default: `yes` |
| `REDIS_TLS_ENABLED` | Whether to enable TLS for traffic or not. Defaults to `no`. |