Enhance gateway configuration by conditionally including OAuth2 client ID and secret in the Helm chart template#1998
Conversation
…t ID and secret in the Helm chart template
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughSummaryThis PR updates the Helm chart template for gateway configuration to conditionally render OAuth2 client credentials only when explicitly configured, rather than always including them with empty values. ChangesFile modified: The ImpactPreviously, these fields were always rendered as empty strings, which prevented the controller from falling back to environment variable overrides. By omitting the keys entirely when unconfigured, the configuration parser will now use the environment variables (APIP_GW_CONTROLPLANE_APIM_OAUTH2_CLIENT_ID and APIP_GW_CONTROLPLANE_APIM_OAUTH2_CLIENT_SECRET) instead, enabling proper authentication flow. ReferencesRelated to issue WalkthroughThis pull request modifies the Helm chart template for the gateway configuration to conditionally render OAuth2 credentials. The template now wraps Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
We are using Koanf, it should override the config from the env var. |
Purpose
This is not a mandatory fix - as we can ommit these values without adding even empty values to the values.yaml
#1987
Without the conditionals, the template would render:
apim_oauth2_client_id = ""
apim_oauth2_client_secret = ""
An explicit empty string is a value — it gets written to the ConfigMap and the controller reads it from the TOML file. Most Go config frameworks (Viper, etc.) won't fall back to an env var when the key is present in the config file, even if the value is empty. The env var would be silently ignored.
By making the fields conditional, those lines are omitted entirely from config.toml. Only then — when the key is absent from the file — does the controller fall back to its env var override (APIP_GW_CONTROLPLANE_APIM_OAUTH2_CLIENT_ID).
So the conditionals are load-bearing. Without them: controller auth fails with an empty client ID. With them: the TOML is silent on those fields, env vars win.