feat: allow OIDC cookies when in-cluster is false via flag#4487
feat: allow OIDC cookies when in-cluster is false via flag#4487beep-boopp wants to merge 1 commit intokubernetes-sigs:mainfrom
Conversation
|
Welcome @beep-boopp! |
illume
left a comment
There was a problem hiding this comment.
Can you please have a look at fixing the merge conflict?
We use linux kernel style git commit messages. Please see the contributing guide and the section in there about git commit messages.
Also, please remove Signed-off-by, as that is not needed in this repo. Thanks!
There was a problem hiding this comment.
Pull request overview
Adds support for enabling OIDC token cookies when Headlamp is not running in in-cluster mode, via a new --oidc-use-cookie config/flag, intended to unblock local/dev usage with OIDC-based kubeconfigs.
Changes:
- Add
oidc-use-cookieflag/config field and relax OIDC validation rules when it is enabled. - Extend internal
HeadlampCFGto carry the new setting. - Allow Helm release routes to pull auth tokens from cookies when
in-clusteroroidc-use-cookieis enabled.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| backend/pkg/headlampconfig/headlampConfig.go | Adds OidcUseCookie to internal backend config struct. |
| backend/pkg/config/config.go | Adds OidcUseCookie config + flag; updates Validate() gating logic and error message. |
| backend/pkg/config/config_test.go | Updates expected validation error substring for non-in-cluster OIDC flags. |
| backend/cmd/headlamp.go | Enables cookie-token behavior for Helm release handler when in-cluster or flag-enabled; initializes oidcUseCookie from HeadlampCFG. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Thanks for the review. I'll go over the requested changes, fix the merge conflicts, and update the commit message style (including removing the sign-off). |
32fbbc4 to
dd72d6a
Compare
|
Hey! I've updated the PR to address the feedback. I've switched the commit message to the requested style , cleaned up that multiline error string, and added a success case to the unit tests as suggested. If you spot any other adjustments needed, just let me know. |
|
Hey, sorry for the extra push, the linter caught a formatting issue and a long line I missed. All fixed now |
|
@beep-boopp Please address the review from copilot |
All good, I've already pushed the fixes and addressed those Copilot points. Resolving the threads now. |
@mudit06mah The fix is already in server.go (as shown in my latest commit). I manually mapped conf.OidcUseCookie to the internal config struct, which is why GitHub says the suggestion can't be applied ,the code has already been updated to handle the wiring. I have made all the changes requested |
|
@beep-boopp You have indeed made the wiring changes, it was that copilot messages did not have the outdated tag that got me confused. (First letter of commit message is capitalized) |
@mudit06mah No worries, I've updated the commit message to follow the repo's area-prefix style and refreshed the PR body with the full summary and test steps. GitHub isn't letting me edit the PR title itself (probably a permission thing), so that's all set on my end. |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
illume
left a comment
There was a problem hiding this comment.
Thanks.
Can you please see the open review notes?
Thanks for the review! |
|
@beep-boopp Could you also add this flag to |
|
@mudit06mah Thanks for the review! I've updated the PR to include the full Helm chart configuration (values.yaml, deployment.yaml) and the documentation in README.md to ensure this feature is deployable out-of-the-box. |
illume
left a comment
There was a problem hiding this comment.
Thanks for doing those changes.
There’s a github check failing.
Please run the linter locally to see:
npm run backend:lint
0939b55 to
d062f7d
Compare
|
@illume All checks are passing now. Ready for your review. Thanks for your patience! |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: beep-boopp, illume The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
@beep-boopp I’ll wait a little while before merging this to give folks a chance to have a look and provide feedback. Are you able to ask in the headlamp channel on the kubernetes slack for someone to review? I asked the original issue reporter for feedback, maybe they will have time to respond too. thanks again!! |
Thanks for the approval! |
|
@illume Just a heads up, I’ve rebased onto the latest main to resolve the conflicts caused by the recent backend refactor . |


Summary
Adds the
--oidc-use-cookieflag to allow OIDC authentication configuration when Headlamp is running in a local or development environment (non–in-cluster mode).Related Issue
Fixes #4481
Changes
pkg/config/config.goOidcUseCookieflag.Validate()logic to permit OIDC settings when this flag is enabled.pkg/config/config_test.goTestParseBasicto verify the success path.TestParseErrorsto ensure proper error messaging when the flag is missing.cmd/server.goOidcUseCookiefrom the config parser into the internal server configuration.Error messaging
--oidc-use-cookieflag.Steps to Test