Skip to content

Commit 33ca8b6

Browse files
authored
feat(redis): run Sentinel on the same image as the Redis pods (#4831)
## What this PR does The Redis application pins its Sentinels to `redis:6.2.6-alpine` (`packages/apps/redis/templates/redisfailover.yaml`), while the data pods run the version selected by `version` (`redis:8.4.0` for `v8`, `redis:7.4.7` for `v7`). The pin was added in fde96dd so that the freshworks-oss operator's new compiled-in default (`redis:7.2.4-alpine`) could not move the Sentinels silently on upgrade, and its comment asks for the bump to be made as a deliberate, separate change. This is that change. Redis 6.2 is end of life, and today every instance runs a Sentinel one or two major versions behind the Redis it monitors. With this change `spec.sentinel.image` is rendered from the same `files/versions.yaml` entry as `spec.redis.image`, so a `v8` instance runs Redis and Sentinel on `redis:8.4.0`, and a `v7` instance on `redis:7.4.7`. Nodes then pull one engine image per instance instead of two. The rollback concern behind the original pin was dump.rdb compatibility. It does not apply to Sentinel: a Sentinel pod stores no RDB or AOF, only a `sentinel.conf` on an `emptyDir` that the operator's `sentinel-config-copy` init container rewrites from the operator ConfigMap on every pod start. Rolling back the chart therefore starts the older Sentinel image from a clean config. The image stays explicit in the rendered RedisFailover, so an operator upgrade still cannot move it. Changes: - `templates/redisfailover.yaml`: `spec.sentinel.image` uses `redis.versionMap`, with the comment rewritten to say why it is pinned and why a rollback is safe. - `values.yaml` and `hack/update-versions.sh`: the `version` description says that Redis and Sentinel run the same image (`update-versions.sh` rewrites that line on `make update`, so it carries the same text). `README.md`, `values.schema.json`, `api/apps/v1alpha1/redis/types.go` and `packages/system/redis-rd/cozyrds/redis.yaml` are the `make generate` output for that description. - `tests/sentinel_image_test.yaml`: new helm-unittest suite; it asserts that the Sentinel and Redis images share the major version for `v8` and `v7`. The patterns pin the major version only, so a patch bump in `files/versions.yaml` needs no test change. - `hack/e2e-chainsaw/redis/chainsaw-test.yaml`: comment only. It described the Sentinel container's `timeout` as busybox (exit 143); the Sentinel now runs the Debian-based image with coreutils (exit 124). The checks only read "non-zero", so behaviour is unchanged. Upgrade behaviour: on the first reconcile after the upgrade, every Redis instance rolls its Sentinel Deployment once (the operator does not set a strategy, so the default `maxSurge: 1`, `maxUnavailable: 0` applies to 3 replicas). A new Sentinel pod starts from the initial config, the operator points it at the current master (`NewSentinelMonitor`, which also sets `auth-pass`), and only then does it pass the readiness probe that lets the next old pod go. The data pods are not touched. Not changed: Harbor's Redis (`packages/system/harbor/templates/redis.yaml`) keeps both images on `redis:6.2.6-alpine`. Its data pods are PVC-backed, so the rollback concern still applies there and it needs its own decision. Testing done: - `make generate` in `packages/apps/redis`: regenerated files committed; a second run leaves no diff. - `make test` in `packages/apps/redis` (helm-unittest v1.1.2): 50 passed. With the template change reverted, the 2 new tests fail and the other 48 pass. - `helm template` with `version=v8` and `version=v7`: `spec.sentinel.image` and `spec.redis.image` are both `redis:8.4.0` and both `redis:7.4.7` respectively. - `helm lint` reports the same two errors as on `main` (icon URL, `cozy-lib` not declared as a dependency), so nothing new. - I checked the operator's Sentinel command set (`SENTINEL REMOVE/MONITOR/SET auth-pass/SET down-after-milliseconds/RESET/CKQUORUM/MASTER`, `INFO sentinel`) against a Redis 8.6.2 Sentinel locally. It behaves the same as on 6.2. I have not run the e2e suite. On a Cozystack v1.6.4 cluster we run Redis 8.4.0 data pods with 6.2.6 Sentinels today, but not this exact chart. Backwards compatibility: no API change. Existing instances roll their Sentinels once, as described above. Rolling the chart back rolls the Sentinels back to `redis:6.2.6-alpine` with a fresh config. ### Screenshots Not a UI change. ### Downstream repositories - [x] No downstream repository is affected by this change - [ ] [cozystack/website](https://github.com/cozystack/website) - follow-up: - [ ] [cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack) - follow-up: - [ ] [cozystack/ansible-cozystack](https://github.com/cozystack/ansible-cozystack) - follow-up: - [ ] [cozystack/ccp](https://github.com/cozystack/ccp) - follow-up: - [ ] [cozystack/talm](https://github.com/cozystack/talm) - follow-up: - [ ] [cozystack/cozyhr](https://github.com/cozystack/cozyhr) - follow-up: - [ ] [cozystack/cozy-proxy](https://github.com/cozystack/cozy-proxy) - follow-up: - [ ] [cozystack/cozystack-telemetry-server](https://github.com/cozystack/cozystack-telemetry-server) - follow-up: - [ ] [cozystack/external-apps-example](https://github.com/cozystack/external-apps-example) - follow-up: - [ ] [cozystack/examples](https://github.com/cozystack/examples) - follow-up: - [ ] [cozystack/community](https://github.com/cozystack/community) - follow-up: Trigger map walked against the diff: the only user-visible text change is the `version` description in `values.yaml`/`README.md`. `redis` is in the website `Makefile` `APPS` list, so the release bot regenerates its page. No field, enum, default or name changes, so terraform-provider-cozystack is not affected. ### Release note ```release-note feat(redis): Sentinel pods now run the same Redis image as the data pods (redis:8.4.0 for v8, redis:7.4.7 for v7) instead of the end-of-life redis:6.2.6-alpine. Existing instances roll their Sentinels once on upgrade; data pods are not restarted. ``` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Redis Sentinel now uses the image selected by the Redis version setting, keeping Sentinel and Redis pods on the same major-version image. * **Tests** * Added checks confirming Sentinel and Redis images match with the default version and when Redis 7 is selected. * **Documentation** * Clarified that Redis and Sentinel pods use the same image when choosing a Redis version. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2 parents 9a348ee + 9a88afe commit 33ca8b6

9 files changed

Lines changed: 63 additions & 15 deletions

File tree

‎api/apps/v1alpha1/redis/types.go‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎hack/e2e-chainsaw/redis/chainsaw-test.yaml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -284,9 +284,9 @@ spec:
284284
# expires, but it captures stdout and stderr through pipes, and Go's exec
285285
# waits for every holder of the write end to close it -- the orphaned
286286
# kubectl is one, so the run goes silent until the job ceiling instead of
287-
# failing. Both engine images carry /usr/bin/timeout; expiry reports 143
288-
# on the sentinel's busybox and 124 on the data pods' coreutils, and
289-
# neither is zero, which is all these checks read.
287+
# failing. Sentinel and data pods run the same Debian-based engine image,
288+
# whose coreutils /usr/bin/timeout reports 124 on expiry; that is not
289+
# zero, which is all these checks read.
290290
#
291291
# bash for pipefail: base64 -d exits 0 on empty input, so without it a
292292
# failed Secret read below takes the decoder's status and is reported as

‎packages/apps/redis/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Service utilizes the freshworks-oss Redis Operator (a maintained fork of the arc
2525
| `size` | Persistent Volume Claim size available for application data. | `quantity` | `1Gi` |
2626
| `storageClass` | StorageClass used to store the data. | `string` | `""` |
2727
| `external` | Enable external access from outside the cluster. Can be enabled only when the instance is created, together with `tls.enabled: true`; turning it on for an existing instance, or changing `tls.enabled` while it is on, is refused at admission. | `bool` | `false` |
28-
| `version` | Redis major version to deploy | `string` | `v8` |
28+
| `version` | Redis major version to deploy. The Redis and Sentinel pods run the same image. | `string` | `v8` |
2929

3030

3131
### TLS parameters

‎packages/apps/redis/hack/update-versions.sh‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ for major_ver in "${MAJOR_VERSIONS[@]}"; do
116116
done
117117
NEW_VERSION_SECTION="${NEW_VERSION_SECTION}
118118
119-
## @param {Version} version - Redis major version to deploy
119+
## @param {Version} version - Redis major version to deploy. The Redis and Sentinel pods run the same image.
120120
version: ${MAJOR_VERSIONS[0]}"
121121

122122
# Check if version section already exists

‎packages/apps/redis/templates/redisfailover.yaml‎

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
{{- /* One image for the data pods and the Sentinels, resolved once so they cannot drift apart. */}}
2+
{{- $redisImage := printf "redis:%s" (include "redis.versionMap" $) }}
13
{{- $tlsEnabled := (include "redis.tls.enabled" .) | eq "true" -}}
24
{{- /*
35
A Sentinel holds only its configuration and failover state, so the Redis
@@ -57,15 +59,16 @@ spec:
5759
secretName: {{ .Release.Name }}.tls
5860
{{- end }}
5961
sentinel:
60-
# Pin the sentinel engine. The freshworks-oss operator's compiled-in default
61-
# moved 6.2.6→7.2.4; the data pods run a deliberate versionMap image below,
62-
# but the sentinels were on the old 6.2.6 default and must not silently jump
63-
# on upgrade. Bump as a deliberate, separate change.
64-
image: redis:6.2.6-alpine
62+
# Sentinels run the same image as the data pods. Pinned explicitly because
63+
# the operator's compiled-in default (redis:7.2.4-alpine in freshworks-oss
64+
# v3.3.5) would otherwise move them on an operator upgrade. Unlike the data
65+
# pods they keep no RDB, only a sentinel.conf the init container rewrites
66+
# on every start, so a chart rollback to an older engine is safe here.
67+
image: {{ $redisImage | quote }}
6568
replicas: 3
6669
resources: {{- include "cozy-lib.resources.defaultingSanitize" (list $sentinelPreset $sentinelResources $) | nindent 6 }}
6770
redis:
68-
image: "redis:{{ include "redis.versionMap" $ }}"
71+
image: {{ $redisImage | quote }}
6972
resources: {{- include "cozy-lib.resources.defaultingSanitize" (list .Values.resourcesPreset .Values.resources $) | nindent 6 }}
7073
replicas: {{ .Values.replicas }}
7174
{{- with .Values.size }}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
suite: Sentinel image follows the Redis version
2+
3+
release:
4+
name: my-redis
5+
namespace: tenant-test
6+
7+
set:
8+
_cluster:
9+
cluster-domain: cluster.local
10+
_namespace:
11+
host: example.com
12+
13+
templates:
14+
- templates/redisfailover.yaml
15+
16+
tests:
17+
# An empty spec.sentinel.image would hand the choice to the operator's
18+
# compiled-in default, which moves with operator releases. The patterns pin
19+
# the major version only, so a patch bump in files/versions.yaml does not
20+
# need a test change.
21+
- it: "the default version runs Sentinel on the data pods' image"
22+
documentSelector:
23+
path: kind
24+
value: RedisFailover
25+
asserts:
26+
- matchRegex:
27+
path: spec.sentinel.image
28+
pattern: ^redis:8\.[0-9]+\.[0-9]+$
29+
- matchRegex:
30+
path: spec.redis.image
31+
pattern: ^redis:8\.[0-9]+\.[0-9]+$
32+
33+
- it: "version v7 moves Sentinel to the v7 image too"
34+
set:
35+
version: v7
36+
documentSelector:
37+
path: kind
38+
value: RedisFailover
39+
asserts:
40+
- matchRegex:
41+
path: spec.sentinel.image
42+
pattern: ^redis:7\.[0-9]+\.[0-9]+$
43+
- matchRegex:
44+
path: spec.redis.image
45+
pattern: ^redis:7\.[0-9]+\.[0-9]+$

‎packages/apps/redis/values.schema.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@
128128
"default": false
129129
},
130130
"version": {
131-
"description": "Redis major version to deploy",
131+
"description": "Redis major version to deploy. The Redis and Sentinel pods run the same image.",
132132
"type": "string",
133133
"default": "v8",
134134
"enum": [

‎packages/apps/redis/values.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ external: false
7979
## @value v8
8080
## @value v7
8181

82-
## @param {Version} version - Redis major version to deploy
82+
## @param {Version} version - Redis major version to deploy. The Redis and Sentinel pods run the same image.
8383
version: v8
8484

8585
##

‎packages/system/redis-rd/cozyrds/redis.yaml‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)