mirror of
https://github.com/bitnami/charts.git
synced 2026-02-20 03:58:02 +08:00
[bitnami/redis] Support specifying external master host to bootstrap from (#8816)
* [bitnami/redis] Support specifying external master host to bootstrap from Signed-off-by: Igor Wiedler <iwiedler@gitlab.com> Signed-off-by: John T Skarbek <jskarbek@gitlab.com> * [bitnami/redis] Ensure the first Pod asks externally when required * If we are using an external cluster, the first Pod need not query the internal service for who's primariy * This inserts an if block such that if the external replica is configured, we then tell redis to query this instead * Doing so allows the first Pod to come up properly, joining the existing cluster as desired * While we are here, let's correct a port number for Sentinel related to this configuration Signed-off-by: John T Skarbek <jskarbek@gitlab.com> * [bitnami/redis] build up readme to help others Signed-off-by: John T Skarbek <jskarbek@gitlab.com> * [bitnami/redis] correct port designation Signed-off-by: John T Skarbek <jskarbek@gitlab.com> * [bitnami/redis] note sentinel external master port Signed-off-by: Igor Wiedler <iwiedler@gitlab.com> * [bitnami/redis] Fix faulty rebase Signed-off-by: Igor Wiedler <iwiedler@gitlab.com> * [bitnami/redis] Bump chart version Signed-off-by: Igor Wiedler <iwiedler@gitlab.com> Co-authored-by: John T Skarbek <jskarbek@gitlab.com>
This commit is contained in:
@@ -7,7 +7,7 @@ Redis(TM) is an open source, advanced key-value store. It is often referred to a
|
||||
[Overview of ®edis(™)](http://redis.io)
|
||||
|
||||
Disclaimer: Redis is a registered trademark of Redis Labs Ltd. Any rights therein are reserved to Redis Labs Ltd. Any use by Bitnami is for referential purposes only and does not indicate any sponsorship, endorsement, or affiliation between Redis Labs Ltd.
|
||||
|
||||
|
||||
## TL;DR
|
||||
|
||||
```bash
|
||||
@@ -219,6 +219,9 @@ The command removes all the Kubernetes components associated with the chart and
|
||||
| `replica.extraEnvVars` | Array with extra environment variables to add to Redis™ replicas nodes | `[]` |
|
||||
| `replica.extraEnvVarsCM` | Name of existing ConfigMap containing extra env vars for Redis™ replicas nodes | `""` |
|
||||
| `replica.extraEnvVarsSecret` | Name of existing Secret containing extra env vars for Redis™ replicas nodes | `""` |
|
||||
| `replica.externalMaster.enabled` | Use external master for bootstrapping | `false` |
|
||||
| `replica.externalMaster.host` | External master host to bootstrap from | `""` |
|
||||
| `replica.externalMaster.port` | Port for Redis service external master host | `6379` |
|
||||
| `replica.containerPorts.redis` | Container port to open on Redis™ replicas nodes | `6379` |
|
||||
| `replica.startupProbe.enabled` | Enable startupProbe on Redis™ replicas nodes | `false` |
|
||||
| `replica.startupProbe.initialDelaySeconds` | Initial delay seconds for startupProbe | `20` |
|
||||
@@ -320,6 +323,9 @@ The command removes all the Kubernetes components associated with the chart and
|
||||
| `sentinel.extraEnvVars` | Array with extra environment variables to add to Redis™ Sentinel nodes | `[]` |
|
||||
| `sentinel.extraEnvVarsCM` | Name of existing ConfigMap containing extra env vars for Redis™ Sentinel nodes | `""` |
|
||||
| `sentinel.extraEnvVarsSecret` | Name of existing Secret containing extra env vars for Redis™ Sentinel nodes | `""` |
|
||||
| `sentinel.externalMaster.enabled` | Use external master for bootstrapping | `false` |
|
||||
| `sentinel.externalMaster.host` | External master host to bootstrap from | `""` |
|
||||
| `sentinel.externalMaster.port` | Port for Redis service external master host | `6379` |
|
||||
| `sentinel.containerPorts.sentinel` | Container port to open on Redis™ Sentinel nodes | `26379` |
|
||||
| `sentinel.startupProbe.enabled` | Enable startupProbe on Redis™ Sentinel nodes | `false` |
|
||||
| `sentinel.startupProbe.initialDelaySeconds` | Initial delay seconds for startupProbe | `20` |
|
||||
@@ -504,6 +510,27 @@ Bitnami will release a new chart updating its containers if a new version of the
|
||||
|
||||
To modify the application version used in this chart, specify a different version of the image using the `image.tag` parameter and/or a different repository using the `image.repository` parameter. Refer to the [chart documentation for more information on these parameters and how to use them with images from a private registry](https://docs.bitnami.com/kubernetes/infrastructure/redis/configuration/change-image-version/).
|
||||
|
||||
### Bootstrapping with an External Cluster
|
||||
|
||||
This chart is equipped with the ability to bring online a set of Pods that connect to an existing Redis deployment that lies outside of Kubernetes. This effectively creates a hybrid Redis Deployment where both Pods in Kubernetes and Instances such as Virtual Machines can partake in a single Redis Deployment. This is helpful in situations where one may be migrating Redis from Virtual Machines into Kubernetes, for example. To take advantage of this, use the following as an example configuration:
|
||||
|
||||
```yaml
|
||||
replica:
|
||||
externalMaster:
|
||||
enabled: true
|
||||
host: external-redis-0.internal
|
||||
sentinel:
|
||||
externalMaster:
|
||||
enabled: true
|
||||
host: external-redis-0.internal
|
||||
```
|
||||
|
||||
:warning: This is currently limited to clusters in which Sentinel and Redis run on the same node! :warning:
|
||||
|
||||
Please also note that the external sentinel must be listening on port `26379`, and this is currently not configurable.
|
||||
|
||||
Once the Kubernetes Redis Deployment is online and confirmed to be working with the existing cluster, the configuration can then be removed and the cluster will remain connected.
|
||||
|
||||
### External DNS
|
||||
|
||||
This chart is equipped to allow leveraging the ExternalDNS project. Doing so will enable ExternalDNS to publish the FQDN for each instance, in the format of `<pod-name>.<release-name>.<dns-suffix>`.
|
||||
|
||||
@@ -55,7 +55,13 @@ data:
|
||||
REDISPORT=$(get_port "$HOSTNAME" "REDIS")
|
||||
|
||||
HEADLESS_SERVICE="{{ template "common.names.fullname" . }}-headless.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}"
|
||||
REDIS_SERVICE="{{ template "common.names.fullname" . }}.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}"
|
||||
|
||||
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" . }}" "TCP_SENTINEL")
|
||||
validate_quorum() {
|
||||
if is_boolean_yes "$REDIS_SENTINEL_TLS_ENABLED"; then
|
||||
@@ -131,6 +137,11 @@ data:
|
||||
REDIS_MASTER_PORT_NUMBER=${REDIS_SENTINEL_INFO[1]}
|
||||
fi
|
||||
|
||||
if [[ -n "$REDIS_EXTERNAL_MASTER_HOST" ]]; then
|
||||
REDIS_MASTER_HOST="$REDIS_EXTERNAL_MASTER_HOST"
|
||||
REDIS_MASTER_PORT_NUMBER="${REDIS_EXTERNAL_MASTER_PORT}"
|
||||
fi
|
||||
|
||||
if [[ ! -f /opt/bitnami/redis/etc/replica.conf ]];then
|
||||
cp /opt/bitnami/redis/mounted-etc/replica.conf /opt/bitnami/redis/etc/replica.conf
|
||||
fi
|
||||
@@ -288,6 +299,11 @@ data:
|
||||
REDIS_MASTER_PORT_NUMBER=${REDIS_SENTINEL_INFO[1]}
|
||||
fi
|
||||
|
||||
if [[ -n "$REDIS_EXTERNAL_MASTER_HOST" ]]; then
|
||||
REDIS_MASTER_HOST="$REDIS_EXTERNAL_MASTER_HOST"
|
||||
REDIS_MASTER_PORT_NUMBER="${REDIS_EXTERNAL_MASTER_PORT}"
|
||||
fi
|
||||
|
||||
sentinel_conf_set "sentinel monitor" "{{ .Values.sentinel.masterSet }} "$REDIS_MASTER_HOST" "$REDIS_MASTER_PORT_NUMBER" {{ .Values.sentinel.quorum }}"
|
||||
|
||||
add_known_sentinel() {
|
||||
|
||||
@@ -162,6 +162,12 @@ spec:
|
||||
{{- end }}
|
||||
- name: REDIS_DATA_DIR
|
||||
value: {{ .Values.replica.persistence.path }}
|
||||
{{- if .Values.replica.externalMaster.enabled }}
|
||||
- name: REDIS_EXTERNAL_MASTER_HOST
|
||||
value: {{ .Values.replica.externalMaster.host | quote }}
|
||||
- name: REDIS_EXTERNAL_MASTER_PORT
|
||||
value: {{ .Values.replica.externalMaster.port | quote }}
|
||||
{{- end }}
|
||||
{{- if .Values.replica.extraEnvVars }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" .Values.replica.extraEnvVars "context" $ ) | nindent 12 }}
|
||||
{{- end }}
|
||||
@@ -319,6 +325,12 @@ spec:
|
||||
- name: REDIS_SENTINEL_PORT
|
||||
value: {{ .Values.sentinel.containerPorts.sentinel | quote }}
|
||||
{{- end }}
|
||||
{{- if .Values.sentinel.externalMaster.enabled }}
|
||||
- name: REDIS_EXTERNAL_MASTER_HOST
|
||||
value: {{ .Values.sentinel.externalMaster.host | quote }}
|
||||
- name: REDIS_EXTERNAL_MASTER_PORT
|
||||
value: {{ .Values.sentinel.externalMaster.port | quote }}
|
||||
{{- end }}
|
||||
{{- if .Values.sentinel.extraEnvVars }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" .Values.sentinel.extraEnvVars "context" $ ) | nindent 12 }}
|
||||
{{- end }}
|
||||
|
||||
@@ -514,6 +514,14 @@ replica:
|
||||
## @param replica.extraEnvVarsSecret Name of existing Secret containing extra env vars for Redis™ replicas nodes
|
||||
##
|
||||
extraEnvVarsSecret: ""
|
||||
## @param replica.externalMaster.enabled Use external master for bootstrapping
|
||||
## @param replica.externalMaster.host External master host to bootstrap from
|
||||
## @param replica.externalMaster.port Port for Redis service external master host
|
||||
##
|
||||
externalMaster:
|
||||
enabled: false
|
||||
host: ""
|
||||
port: 6379
|
||||
## @param replica.containerPorts.redis Container port to open on Redis™ replicas nodes
|
||||
##
|
||||
containerPorts:
|
||||
@@ -906,6 +914,13 @@ sentinel:
|
||||
## @param sentinel.extraEnvVarsSecret Name of existing Secret containing extra env vars for Redis™ Sentinel nodes
|
||||
##
|
||||
extraEnvVarsSecret: ""
|
||||
## @param sentinel.externalMaster.enabled Use external master for bootstrapping
|
||||
## @param sentinel.externalMaster.host External master host to bootstrap from
|
||||
## @param sentinel.externalMaster.port Port for Redis service external master host
|
||||
externalMaster:
|
||||
enabled: false
|
||||
host: ""
|
||||
port: 6379
|
||||
## @param sentinel.containerPorts.sentinel Container port to open on Redis™ Sentinel nodes
|
||||
##
|
||||
containerPorts:
|
||||
|
||||
Reference in New Issue
Block a user