From 6bf9e46ecb47f51078d218e5231a50c50af6ac56 Mon Sep 17 00:00:00 2001 From: Benoitsob Date: Sun, 7 Apr 2024 13:57:50 +0200 Subject: [PATCH] [charts/redis-ha] Allows changes on command/args/env redis container (#238) * Allows changes on command/args/env redis container Signed-off-by: Benoit Sobrie * Bumped version Signed-off-by: Benoit Sobrie * Allows custom command/args/env on redis container Signed-off-by: Benoit Sobrie * Bumped version Signed-off-by: Benoit Sobrie * Upgrade kind action Signed-off-by: Aaron Layfield --------- Signed-off-by: Benoit Sobrie Signed-off-by: Aaron Layfield Co-authored-by: Aaron Layfield --- .github/workflows/test.yaml | 2 +- charts/redis-ha/Chart.yaml | 2 +- charts/redis-ha/README.md | 3 +++ .../redis-ha/templates/redis-ha-statefulset.yaml | 16 ++++++++++++++-- charts/redis-ha/values.yaml | 9 +++++++++ 5 files changed, 28 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index a6f748b..b2ac336 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -45,7 +45,7 @@ jobs: fi - name: Create kind cluster - uses: helm/kind-action@v1.2.0 + uses: helm/kind-action@v1.9.0 if: steps.list-changed.outputs.changed == 'true' with: node_image: "kindest/node:${{ matrix.kubernetesVersion }}" diff --git a/charts/redis-ha/Chart.yaml b/charts/redis-ha/Chart.yaml index e9b3b50..241c065 100644 --- a/charts/redis-ha/Chart.yaml +++ b/charts/redis-ha/Chart.yaml @@ -5,7 +5,7 @@ keywords: - redis - keyvalue - database -version: 4.26.4 +version: 4.26.5 appVersion: 7.2.4 description: This Helm chart provides a highly available Redis implementation with a master/slave configuration and uses Sentinel sidecars for failover management icon: https://upload.wikimedia.org/wikipedia/en/thumb/6/6b/Redis_Logo.svg/1200px-Redis_Logo.svg.png diff --git a/charts/redis-ha/README.md b/charts/redis-ha/README.md index c1a7694..136bd98 100644 --- a/charts/redis-ha/README.md +++ b/charts/redis-ha/README.md @@ -75,6 +75,9 @@ The following table lists the configurable parameters of the Redis chart and the | `serviceLabels` | Labels to set on Redis HA service | `{}` | | `rbac.create` | Create and use RBAC resources | `true` | | `redis.port` | Port to access the redis service | `6379` | +| `redis.customCommand` | Allows overriding the redis container command | `[]` | +| `redis.customArgs` | Allows overriding the redis container arguments | `[]` | +| `redis.envFrom` | Load environment variables from ConfigMap/Secret |``| | `redis.tlsPort` | TLS Port to access the redis service |``| | `redis.tlsReplication` | Configures redis with tls-replication parameter, if true sets "tls-replication yes" in redis.conf |``| | `redis.authClients` | It is possible to disable client side certificates authentication when "authClients" is set to "no" |``| diff --git a/charts/redis-ha/templates/redis-ha-statefulset.yaml b/charts/redis-ha/templates/redis-ha-statefulset.yaml index c17f1d2..610358c 100644 --- a/charts/redis-ha/templates/redis-ha-statefulset.yaml +++ b/charts/redis-ha/templates/redis-ha-statefulset.yaml @@ -251,9 +251,17 @@ spec: image: {{ .Values.image.repository }}:{{ .Values.image.tag }} imagePullPolicy: {{ .Values.image.pullPolicy }} command: - - redis-server + {{- if .Values.redis.customCommand }} +{{ toYaml .Values.redis.customCommand | indent 10 }} + {{- else }} + - redis-server + {{- end }} args: - - /data/conf/redis.conf + {{- if .Values.redis.customArgs }} +{{ toYaml .Values.redis.customArgs | indent 10 }} + {{- else }} + - /data/conf/redis.conf + {{- end }} securityContext: {{ toYaml .Values.containerSecurityContext | nindent 10 }} {{- if .Values.auth }} env: @@ -267,6 +275,10 @@ spec: {{- end }} key: {{ .Values.authKey }} {{- end }} + {{- if .Values.redis.envFrom }} + envFrom: +{{ toYaml .Values.redis.envFrom | indent 10 }} + {{- end }} livenessProbe: initialDelaySeconds: {{ .Values.redis.livenessProbe.initialDelaySeconds }} periodSeconds: {{ .Values.redis.livenessProbe.periodSeconds }} diff --git a/charts/redis-ha/values.yaml b/charts/redis-ha/values.yaml index 5a872cd..671a37e 100644 --- a/charts/redis-ha/values.yaml +++ b/charts/redis-ha/values.yaml @@ -264,6 +264,15 @@ redis: port: 6379 masterGroupName: "mymaster" # must match ^[\\w-\\.]+$) and can be templated + customCommand: [] + # - bash + customArgs: [] + # - "custom-startup.sh" + + envFrom: [] + # - secretRef: + # name: add-env-secret + ## Configures redis with tls-port parameter # tlsPort: 6385