feat: add support for more values to be evaluated / templated as yaml#398
feat: add support for more values to be evaluated / templated as yaml#398pierluigilenoci merged 12 commits intooauth2-proxy:mainfrom
Conversation
pierluigilenoci
left a comment
There was a problem hiding this comment.
Review Notes
Thanks for the PR! A few observations and potential issues:
1. Inconsistent tpl context (. vs $)
In deployment.yaml the tpl call uses . (current context):
- --cookie-name={{ tpl .Values.config.cookieName . }}While in _helpers.tpl and networkpolicy.yaml it uses $ (root context):
{{ tpl (toYaml .Values.customLabels) $ }}Both work, but the inconsistency could cause confusion. Consider standardizing on $ everywhere for clarity.
2. envFrom documented in README but not implemented in templates
The diff adds envFrom to the README parameters table, but there's no corresponding change in any template file to actually use it. This looks like either a leftover from another change or premature documentation — could you clarify?
3. Semantic versioning: kind: fixed vs enhancement
The changelog entry uses kind: fixed, but this is more of a feature enhancement (supporting templated values in more places) rather than a bug fix. According to SemVer, a new feature should be a minor bump (10.2.0) rather than a patch (10.1.6). Worth reconsidering the version and changelog kind.
4. Security consideration with tpl
The tpl function executes arbitrary Go templates, including Sprig functions. If values are generated programmatically from untrusted input, this could be a vector for template injection. This is a common and accepted pattern in Helm charts, but it may be worth adding a note in the README about the security implications of templated values.
5. Missing CI test coverage for existingSecret and networkPolicy
The CI values in tpl-values.yaml cover cookieName and customLabels, but don't test the other newly templated values (config.existingSecret, networkPolicy.ingress, networkPolicy.egress). Adding test cases for these would improve confidence that the tpl wrapping works correctly in all modified paths.
There was a problem hiding this comment.
Pull request overview
This PR expands Helm templating support in the oauth2-proxy chart so additional user-supplied values can be rendered via tpl before being emitted into Kubernetes manifests.
Changes:
- Enable templating for
networkPolicy.ingress/networkPolicy.egress,config.cookieName,config.existingSecret, andcustomLabels. - Update CI templating values and documentation to reflect supported/configurable values.
- Bump chart version and append an Artifact Hub changelog entry.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
helm/oauth2-proxy/templates/networkpolicy.yaml |
Renders ingress/egress rules through tpl to allow templated network policy blocks. |
helm/oauth2-proxy/templates/deployment.yaml |
Allows config.cookieName to be templated when rendered into container args. |
helm/oauth2-proxy/templates/_helpers.tpl |
Allows templating for customLabels and config.existingSecret. |
helm/oauth2-proxy/ci/tpl-values.yaml |
Attempts to add CI coverage for newly templated values (needs adjustment). |
helm/oauth2-proxy/README.md |
Documents envFrom in the values table. |
helm/oauth2-proxy/Chart.yaml |
Version bump + changelog entry for the new templating capability. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Updated my changes to standardize on
I was updating the README for a missing item. The templating is already present: manifests/helm/oauth2-proxy/values.yaml Line 110 in 93b9b85
Updated to be a minor version bump.
Doing |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| {{- tpl (toYaml .Values.networkPolicy.ingress) $ | nindent 4 }} | ||
| {{- end }} | ||
| {{- if .Values.networkPolicy.egress }} | ||
| egress: | ||
| {{- toYaml .Values.networkPolicy.egress | nindent 4 }} | ||
| {{- tpl (toYaml .Values.networkPolicy.egress) $ | nindent 4 }} |
There was a problem hiding this comment.
The new tpl support for networkPolicy.ingress/egress isn’t exercised by any existing chart CI values files (no networkPolicy usage under helm/oauth2-proxy/ci/). Add a CI values case that sets networkPolicy.create: true and includes at least one templated field (e.g., a label value using .Release.Name) to prevent regressions.
| {{- define "oauth2-proxy.secretName" -}} | ||
| {{- if .Values.config.existingSecret -}} | ||
| {{- printf "%s" .Values.config.existingSecret -}} | ||
| {{- printf "%s" (tpl .Values.config.existingSecret $) -}} | ||
| {{- else -}} |
There was a problem hiding this comment.
config.existingSecret is now rendered through tpl, but there’s no CI values coverage for this behavior (no existingSecret appears under helm/oauth2-proxy/ci/). Add a CI values test that sets config.existingSecret to a templated value and asserts the rendered secret references use the evaluated name.
helm/oauth2-proxy/Chart.yaml
Outdated
| - kind: changed | ||
| description: Bump OAuth2 Proxy image to v7.15.0 | ||
| - kind: added | ||
| description: Additional values can be templated |
There was a problem hiding this comment.
The Artifact Hub changelog entry is very broad (“Additional values can be templated”). Since this is user-facing behavior, please list the specific values/fields that gained tpl support (e.g., config.cookieName, config.existingSecret, customLabels, networkPolicy.ingress/egress) so users know what changed.
| description: Additional values can be templated | |
| description: Add tpl support for config.cookieName, config.existingSecret, customLabels, and networkPolicy.ingress/egress |
|
Nice work on this PR! A few thoughts on the remaining open items: 1. Changelog descriptionAgree with the suggestion to make it more specific. Users scanning the Artifact Hub changelog need to know exactly which fields gained
2. CI test for
|
|
I've made the requested changes. |
|
@pierluigilenoci I think the existing secret test is the problem: The |
Signed-off-by: Trey Dockendorf <tdockendorf@osc.edu>
Signed-off-by: Trey Dockendorf <tdockendorf@osc.edu>
Add some testing updates Signed-off-by: Trey Dockendorf <tdockendorf@osc.edu>
Signed-off-by: Trey Dockendorf <tdockendorf@osc.edu>
Signed-off-by: Trey Dockendorf <tdockendorf@osc.edu>
Signed-off-by: Trey Dockendorf <tdockendorf@osc.edu>
Signed-off-by: Trey Dockendorf <tdockendorf@osc.edu>
Signed-off-by: Trey Dockendorf <tdockendorf@osc.edu>
This reverts commit d2835d8. Signed-off-by: Trey Dockendorf <tdockendorf@osc.edu>
Signed-off-by: Trey Dockendorf <tdockendorf@osc.edu>
Signed-off-by: Trey Dockendorf <tdockendorf@osc.edu>
|
@pierluigilenoci Let me know if any more changes are needed or if this is good for review. |
Signed-off-by: Trey Dockendorf <tdockendorf@osc.edu>
Description
Allow additional values to be templated when passed to the Helm chart.
Checklist: