Skip to content

feat: add tpl support for sessionStorage.redis.existingSecret#414

Open
pierluigilenoci wants to merge 3 commits into
oauth2-proxy:mainfrom
pierluigilenoci:fix/redis-existingsecret-tpl
Open

feat: add tpl support for sessionStorage.redis.existingSecret#414
pierluigilenoci wants to merge 3 commits into
oauth2-proxy:mainfrom
pierluigilenoci:fix/redis-existingsecret-tpl

Conversation

@pierluigilenoci

@pierluigilenoci pierluigilenoci commented Jun 9, 2026

Copy link
Copy Markdown
Member

Summary

Fixes #409.

When oauth2-proxy is deployed as a subchart, operators (e.g. Redis Operator, Bitnami Redis) generate secrets with structured names that depend on the release name or other chart values. Previously sessionStorage.redis.existingSecret was rendered verbatim, making it impossible to reference these dynamically-named secrets without hardcoding the full name.

This PR wraps existingSecret with tpl() so Helm template expressions are evaluated at render time:

sessionStorage:
  redis:
    existingSecret: '{{ .Release.Name }}-redis-secret'

Changes

  • helm/oauth2-proxy/templates/deployment.yaml — apply tpl to existingSecret in both the standalone/cluster secretKeyRef and the sentinel secretKeyRef
  • helm/oauth2-proxy/values.yaml — document tpl support in the field comment
  • helm/oauth2-proxy/Chart.yaml — minor version bump to 10.8.0

Compatibility

Plain string values (e.g. my-redis-secret) continue to work unchanged — tpl is a no-op on non-template strings. Same pattern already used for config.existingSecret in _helpers.tpl.

Wrap the existingSecret field with tpl() in deployment.yaml so that
Helm template expressions (e.g. '{{ .Release.Name }}-redis-secret')
are evaluated at render time. This allows users to derive the secret
name dynamically when oauth2-proxy is deployed as a subchart alongside
operators that generate Redis secrets with structured names.

Applied to both the standalone/cluster password secretKeyRef and the
sentinel password secretKeyRef (which falls back to the base
existingSecret when no sentinel-specific one is set).

Closes oauth2-proxy#409

Signed-off-by: Pierluigi Lenoci <pierluigi.lenoci@gmail.com>
@pierluigilenoci pierluigilenoci requested a review from tuunit June 9, 2026 19:17
@pierluigilenoci pierluigilenoci marked this pull request as ready for review June 9, 2026 19:19
The install test on a real kind cluster fails when existingSecret
references a secret that does not exist. Use extraObjects to create
the secret inline, same pattern as alphaconfig-7-existing-secret.

Signed-off-by: Pierluigi Lenoci <pierluigi.lenoci@gmail.com>
The install test cannot pass without a real redis server running.
The tpl() rendering is already verified by ct lint (helm template)
across all existing ci/*.yaml files that touch deployment.yaml.

Signed-off-by: Pierluigi Lenoci <pierluigi.lenoci@gmail.com>

@Moulick Moulick left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is exactly the patch I am running right now and will solve my issue :)

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.

Support templating in sessionStorage.redis.existingSecret name

2 participants