Skip to content

feat(env): custom env vars on redis and sentinel main containers - #34

Merged
binhnguyenduc merged 1 commit into
masterfrom
feat/redis-sentinel-pod-env
Jul 24, 2026
Merged

feat(env): custom env vars on redis and sentinel main containers#34
binhnguyenduc merged 1 commit into
masterfrom
feat/redis-sentinel-pod-env

Conversation

@binhnguyenduc

Copy link
Copy Markdown

What

Adds an optional env field ([]corev1.EnvVar) to the redis and sentinel specs, injecting custom environment variables into their main containers. Previously only the exporter sidecar accepted custom env.

Why

Users need to pass environment variables (e.g. for wrapper scripts, TLS material paths, tuning) to the redis/sentinel processes. Implements the env portion of upstream spotahome#290. (The sysctl-init portion of that PR is already covered by the existing generic initContainers.)

Precedence

On the redis container the user's env is placed before the operator-injected vars (REDIS_ADDR, REDIS_PORT, REDIS_USER, REDIS_PASSWORD). Under Kubernetes' last-wins semantics the operator vars therefore keep precedence and a user duplicate cannot override them. The sentinel main container has no operator-injected env, so the field is applied directly.

Changes

  • api/.../types.go: RedisSettings.Env, SentinelSettings.Env.
  • generator.go: wire into the redis STS + sentinel Deployment main containers.
  • Regenerated CRD + deepcopy.
  • Table-driven tests (custom var injected; operator duplicate wins); README section.

Upstream references

Test

go build ./..., go test ./..., gofmt clean; CRD regenerated via pinned codegen image.

Only the exporter sidecar accepted custom environment variables. Add an
optional env field to the redis and sentinel specs, injected into their
main containers. On the redis container the user's env is placed before
the operator-injected vars (REDIS_ADDR/PORT/USER/PASSWORD) so those keep
precedence under Kubernetes last-wins semantics.

Regenerated CRD + deepcopy for the new fields.

Refs upstream spotahome#290.
@binhnguyenduc
binhnguyenduc merged commit 4d51d46 into master Jul 24, 2026
8 checks passed
@binhnguyenduc
binhnguyenduc deleted the feat/redis-sentinel-pod-env branch July 24, 2026 09:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant