Add extraEnvVars and preExec to sentinel node (#4985)

This commit is contained in:
Miguel Ángel Cabrera Miñagorri
2021-01-14 12:52:27 +01:00
committed by GitHub
parent c6fdb0e189
commit 849f801df8
6 changed files with 93 additions and 28 deletions
+1 -1
View File
@@ -25,4 +25,4 @@ name: redis
sources:
- https://github.com/bitnami/bitnami-docker-redis
- http://redis.io/
version: 12.4.0
version: 12.5.0
+31 -27
View File
@@ -28,11 +28,11 @@ You can choose any of the two Redis Helm charts for deploying a Redis cluster.
While [Redis Helm Chart](https://github.com/bitnami/charts/tree/master/bitnami/redis) will deploy a master-slave cluster using Redis Sentinel, the [Redis Cluster Helm Chart](https://github.com/bitnami/charts/tree/master/bitnami/redis-cluster) will deploy a Redis Cluster topology with sharding.
The main features of each chart are the following:
| Redis | Redis Cluster |
|-----------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------|
| Supports multiple databases | Supports only one database. Better if you have a big dataset |
| Single write point (single master) | Multiple write points (multiple masters) |
| ![Redis Topology](img/redis-topology.png) | ![Redis Cluster Topology](img/redis-cluster-topology.png) |
| Redis | Redis Cluster |
|:------------------------------------------|:-------------------------------------------------------------|
| Supports multiple databases | Supports only one database. Better if you have a big dataset |
| Single write point (single master) | Multiple write points (multiple masters) |
| ![Redis Topology](img/redis-topology.png) | ![Redis Cluster Topology](img/redis-cluster-topology.png) |
## Prerequisites
@@ -67,7 +67,7 @@ The command removes all the Kubernetes components associated with the chart and
The following table lists the configurable parameters of the Redis chart and their default values.
| Parameter | Description | Default |
|-----------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------|
|:----------------------------------------------|:----------------------------------------------------------------------------------------------------------------------------------------------------|:--------------------------------------------------------|
| `global.imageRegistry` | Global Docker image registry | `nil` |
| `global.imagePullSecrets` | Global Docker registry secret names as an array | `[]` (does not add image pull secrets to deployed pods) |
| `global.storageClass` | Global storage class for dynamic provisioning | `nil` |
@@ -138,27 +138,27 @@ The following table lists the configurable parameters of the Redis chart and the
| `master.persistence.size` | Size of data volume | `8Gi` |
| `master.persistence.matchLabels` | matchLabels persistent volume selector | `{}` |
| `master.persistence.matchExpressions` | matchExpressions persistent volume selector | `{}` |
| `master.persistence.volumes ` | Additional volumes without creating PVC | `{}` |
| `master.persistence.volumes ` | Additional volumes without creating PVC | `{}` |
| `master.statefulset.labels` | Additional labels for redis master StatefulSet | `{}` |
| `master.statefulset.annotations` | Additional annotations for redis master StatefulSet | `{}` |
| `master.statefulset.updateStrategy` | Update strategy for StatefulSet | onDelete |
| `master.statefulset.rollingUpdatePartition` | Partition update strategy | `nil` |
| `master.podLabels` | Additional labels for Redis master pod | {} |
| `master.podAnnotations` | Additional annotations for Redis master pod | {} |
| `master.extraEnvVars` | Additional Environment Variables passed to the pod of the master's stateful set set | `[]`
| `master.extraEnvVarCMs` | Additional Environment Variables ConfigMappassed to the pod of the master's stateful set set | `[]`
| `master.extraEnvVarsSecret` | Additional Environment Variables Secret passed to the master's stateful set | `[]`
| `podDisruptionBudget.enabled` | Pod Disruption Budget toggle | `false` |
| `podDisruptionBudget.minAvailable` | Minimum available pods | `1` |
| `podDisruptionBudget.maxUnavailable` | Maximum unavailable pods | `nil` |
| `master.extraEnvVars` | Additional Environment Variables passed to the pod of the master's stateful set set | `[]` |
| `master.extraEnvVarCMs` | Additional Environment Variables ConfigMappassed to the pod of the master's stateful set set | `[]` |
| `master.extraEnvVarsSecret` | Additional Environment Variables Secret passed to the master's stateful set | `[]` |
| `podDisruptionBudget.enabled` | Pod Disruption Budget toggle | `false` |
| `podDisruptionBudget.minAvailable` | Minimum available pods | `1` |
| `podDisruptionBudget.maxUnavailable` | Maximum unavailable pods | `nil` |
| `redisPort` | Redis port (in both master and slaves) | `6379` |
| `tls.enabled` | Enable TLS support for replication traffic | `false` |
| `tls.authClients` | Require clients to authenticate or not | `true` |
| `tls.certificatesSecret` | Name of the secret that contains the certificates | `nil` |
| `tls.certFilename` | Certificate filename | `nil` |
| `tls.certKeyFilename` | Certificate key filename | `nil` |
| `tls.certCAFilename` | CA Certificate filename |`nil` |
| `tls.dhParamsFilename` | DH params (in order to support DH based ciphers) |`nil` |
| `tls.enabled` | Enable TLS support for replication traffic | `false` |
| `tls.authClients` | Require clients to authenticate or not | `true` |
| `tls.certificatesSecret` | Name of the secret that contains the certificates | `nil` |
| `tls.certFilename` | Certificate filename | `nil` |
| `tls.certKeyFilename` | Certificate key filename | `nil` |
| `tls.certCAFilename` | CA Certificate filename | `nil` |
| `tls.dhParamsFilename` | DH params (in order to support DH based ciphers) | `nil` |
| `master.command` | Redis master entrypoint string. The command `redis-server` is executed if this is not provided. Note this is prepended with `exec` | `/run.sh` |
| `master.preExecCmds` | Text to inset into the startup script immediately prior to `master.command`. Use this if you need to run other ad-hoc commands as part of startup | `nil` |
| `master.configmap` | Additional Redis configuration for the master nodes (this value is evaluated as a template) | `nil` |
@@ -169,7 +169,7 @@ The following table lists the configurable parameters of the Redis chart and the
| `master.affinity` | Affinity settings for Redis master pod assignment | {} |
| `master.schedulerName` | Name of an alternate scheduler | `nil` |
| `master.service.type` | Kubernetes Service type (redis master) | `ClusterIP` |
| `master.service.externalTrafficPolicy` | External traffic policy (when service type is LoadBalancer) | `Cluster` |
| `master.service.externalTrafficPolicy` | External traffic policy (when service type is LoadBalancer) | `Cluster` |
| `master.service.port` | Kubernetes Service port (redis master) | `6379` |
| `master.service.nodePort` | Kubernetes Service nodePort (redis master) | `nil` |
| `master.service.annotations` | annotations for redis master service | {} |
@@ -200,7 +200,7 @@ The following table lists the configurable parameters of the Redis chart and the
| `volumePermissions.securityContext.*` | Security context of the init container | `{}` |
| `volumePermissions.securityContext.runAsUser` | UserID for the init container (when facing issues in OpenShift or uid unknown, try value "auto") | 0 |
| `slave.service.type` | Kubernetes Service type (redis slave) | `ClusterIP` |
| `slave.service.externalTrafficPolicy` | External traffic policy (when service type is LoadBalancer) | `Cluster` |
| `slave.service.externalTrafficPolicy` | External traffic policy (when service type is LoadBalancer) | `Cluster` |
| `slave.service.nodePort` | Kubernetes Service nodePort (redis slave) | `nil` |
| `slave.service.annotations` | annotations for redis slave service | {} |
| `slave.service.labels` | Additional labels for redis slave service | {} |
@@ -237,15 +237,15 @@ The following table lists the configurable parameters of the Redis chart and the
| `slave.statefulset.annotations` | Additional annotations for redis slave StatefulSet | `{}` |
| `slave.statefulset.updateStrategy` | Update strategy for StatefulSet | onDelete |
| `slave.statefulset.rollingUpdatePartition` | Partition update strategy | `nil` |
| `slave.extraEnvVars` | Additional Environment Variables passed to the pod of the slave's stateful set set | `[]`
| `slave.extraEnvVarCMs` | Additional Environment Variables ConfigMappassed to the pod of the slave's stateful set set | `[]`
| `masslaveter.extraEnvVarsSecret` | Additional Environment Variables Secret passed to the slave's stateful set | `[]`
| `slave.extraEnvVars` | Additional Environment Variables passed to the pod of the slave's stateful set set | `[]` |
| `slave.extraEnvVarCMs` | Additional Environment Variables ConfigMappassed to the pod of the slave's stateful set set | `[]` |
| `masslaveter.extraEnvVarsSecret` | Additional Environment Variables Secret passed to the slave's stateful set | `[]` |
| `slave.podLabels` | Additional labels for Redis slave pod | `master.podLabels` |
| `slave.podAnnotations` | Additional annotations for Redis slave pod | `master.podAnnotations` |
| `slave.schedulerName` | Name of an alternate scheduler | `nil` |
| `slave.resources` | Redis slave CPU/Memory resource requests/limits | `{}` |
| `slave.affinity` | Enable node/pod affinity for slaves | {} |
| `slave.tolerations` | Toleration labels for Redis slave pod assignment | [] |
| `slave.tolerations` | Toleration labels for Redis slave pod assignment | [] |
| `slave.spreadConstraints` | [Topology Spread Constraints](https://kubernetes.io/docs/concepts/workloads/pods/pod-topology-spread-constraints/) for Redis slave pod | {} |
| `slave.priorityClassName` | Redis Slave pod priorityClassName | `nil` |
| `sentinel.enabled` | Enable sentinel containers | `false` |
@@ -260,7 +260,7 @@ The following table lists the configurable parameters of the Redis chart and the
| `sentinel.configmap` | Additional Redis configuration for the sentinel nodes (this value is evaluated as a template) | `nil` |
| `sentinel.staticID` | Enable static IDs for sentinel replicas (If disabled IDs will be randomly generated on startup) | `false` |
| `sentinel.service.type` | Kubernetes Service type (redis sentinel) | `ClusterIP` |
| `sentinel.service.externalTrafficPolicy` | External traffic policy (when service type is LoadBalancer) | `Cluster` |
| `sentinel.service.externalTrafficPolicy` | External traffic policy (when service type is LoadBalancer) | `Cluster` |
| `sentinel.service.nodePort` | Kubernetes Service nodePort (redis sentinel) | `nil` |
| `sentinel.service.annotations` | annotations for redis sentinel service | {} |
| `sentinel.service.labels` | Additional labels for redis sentinel service | {} |
@@ -287,6 +287,10 @@ The following table lists the configurable parameters of the Redis chart and the
| `sentinel.image.tag` | Redis Sentinel Image tag | `{TAG_NAME}` |
| `sentinel.image.pullPolicy` | Image pull policy | `IfNotPresent` |
| `sentinel.image.pullSecrets` | Specify docker-registry secret names as an array | `nil` |
| `sentinel.extraEnvVars` | Additional Environment Variables passed to the pod of the sentinel node stateful set set | `[]` |
| `sentinel.extraEnvVarCMs` | Additional Environment Variables ConfigMappassed to the pod of the sentinel node stateful set set | `[]` |
| `sentinel.extraEnvVarsSecret` | Additional Environment Variables Secret passed to the sentinel node statefulset | `[]` |
| `sentinel.preExecCmds` | Text to inset into the startup script immediately prior to `sentinel.command`. Use this if you need to run other ad-hoc commands as part of startup | `nil` |
| `sysctlImage.enabled` | Enable an init container to modify Kernel settings | `false` |
| `sysctlImage.command` | sysctlImage command to execute | [] |
| `sysctlImage.registry` | sysctlImage Init container registry | `docker.io` |
@@ -272,6 +272,9 @@ data:
ARGS+=("--tls-dh-params-file" "${REDIS_SENTINEL_TLS_DH_PARAMS_FILE}")
{{- end }}
{{- end }}
{{- if .Values.sentinel.preExecCmds }}
{{ .Values.sentinel.preExecCmds | nindent 4 }}
{{- end }}
exec redis-server /opt/bitnami/redis-sentinel/etc/sentinel.conf --sentinel {{- if .Values.tls.enabled }} "${ARGS[@]}" {{- end }}
{{- else }}
start-master.sh: |
@@ -133,6 +133,20 @@ spec:
{{- end }}
- name: REDIS_DATA_DIR
value: {{ .Values.slave.persistence.path }}
{{- if .Values.sentinel.extraEnvVars }}
{{- include "redis.tplValue" (dict "value" .Values.sentinel.extraEnvVars "context" $) | nindent 12 }}
{{- end }}
{{- if or .Values.sentinel.extraEnvVarsCM .Values.sentinel.extraEnvVarsSecret }}
envFrom:
{{- if .Values.sentinel.extraEnvVarsCM }}
- configMapRef:
name: {{ .Values.sentinel.extraEnvVarsCM }}
{{- end }}
{{- if .Values.sentinel.extraEnvVarsSecret }}
- secretRef:
name: {{ .Values.sentinel.extraEnvVarsSecret }}
{{- end }}
{{- end }}
ports:
- name: redis
containerPort: {{ .Values.redisPort }}
+22
View File
@@ -137,6 +137,28 @@ sentinel:
annotations: {}
labels: {}
loadBalancerIP:
## Additional commands to run prior to starting Redis node with sentinel
##
preExecCmds: ""
## An array to add extra env var to the sentinel node configurations
## For example:
## extraEnvVars:
## - name: name
## value: value
## - name: other_name
## valueFrom:
## fieldRef:
## fieldPath: fieldPath
##
extraEnvVars: []
## ConfigMap with extra env vars:
##
extraEnvVarsCM: []
## Secret with extra env vars:
##
extraEnvVarsSecret: []
## Specifies the Kubernetes Cluster's Domain Name.
##
+22
View File
@@ -137,6 +137,28 @@ sentinel:
annotations: {}
labels: {}
loadBalancerIP:
## Additional commands to run prior to starting Redis node with sentinel
##
preExecCmds: ""
## An array to add extra env var to the sentinel node configurations
## For example:
## extraEnvVars:
## - name: name
## value: value
## - name: other_name
## valueFrom:
## fieldRef:
## fieldPath: fieldPath
##
extraEnvVars: []
## ConfigMap with extra env vars:
##
extraEnvVarsCM: []
## Secret with extra env vars:
##
extraEnvVarsSecret: []
## Specifies the Kubernetes Cluster's Domain Name.
##