feat: add config.secretKeys to selectively include secrets #384
+29
−4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR implements the
config.requiredSecretKeysoption to provide granular control over which secrets are included in the Kubernetes secret and exposed as environment variables.Problem
When using authentication methods like Azure Entra ID federated token authentication, the
client-secretis not required. However, the chart currently always includes and requires all three secrets (client-id,client-secret,cookie-secret), causing issues when usingproxyVarsAsSecrets: truewithexistingSecret.Solution
Added a
config.requiredSecretKeyslist that allows users to explicitly specify which secrets to include:Implementation Details
Following maintainer feedback, the implementation now uses:
config.requiredSecretKeyslist with explicit defaults:oauth2-proxy.secretstemplate to conditionally include secrets based on the listDefault Behavior (Backward Compatible)
The defaults are now explicitly defined in
values.yaml:This ensures full backward compatibility with existing deployments while making the configuration more explicit and easier to understand.
Usage Examples
Scenario 1: Default (all secrets)
→ Includes all three secrets (default behavior)
Scenario 2: Exclude client-secret (federated auth)
→ Includes only
client-idandcookie-secretScenario 3: Custom subset
→ Includes only
cookie-secretBenefits
Changes Based on Maintainer Feedback
secretKeystorequiredSecretKeysfor clarity| default) to explicit defaults invalues.yamlTesting
Tested with
helm templateto verify:Checklist
Fixes #376