-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix the "Standalone"-mode of oidc-login in the wrapped kubectl library #11266
Conversation
…ation. This fixes: 'error: no Auth Provider found for name "oidc"' when trying to run any subcommands in kubectl that require a valid server login. Signed-off-by: Ludo Stellingwerff <[email protected]>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #11266 +/- ##
==========================================
- Coverage 46.97% 42.43% -4.55%
==========================================
Files 179 179
Lines 18587 18587
==========================================
- Hits 8732 7888 -844
- Misses 8493 9490 +997
+ Partials 1362 1209 -153
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Can you please open an issue to track this? You can copy-paste most of it from this well filled out PR. That will help us track and handle the backports for this fix. |
I was worried that this would pull in some new auth provider stuff that isn't currently included, but I have confirmed from CI logs that this does not have any impact on the size of the shipping K3s binary. LGTM once we have an issue tracking what's being fixed here. |
Done: #11268 |
Proposed Changes
Currently K3s fails to work with the "standalone mode" of oidc-login, where the kube.config file contains an Auth-provider section for the users. Trying to use any subcommand that requires a valid login will fail with the error:
'error: no Auth Provider found for name "oidc"'
This PR fixes this, and allows the usage of this oidc-login mode for the embedded kubectl library in K3s.
For background info on that oidc-login mode: https://github.com/int128/kubelogin/blob/master/docs/standalone-mode.md
Types of Changes
This is a simple one-liner bugfix copied from the upstream kubectl-cli implementation.
Source of the fix: https://github.com/kubernetes/kubernetes/blob/master/cmd/kubectl/kubectl.go#L25
Verification
Use an example kube.config like described in the kubelogin documentation:
Login through the normal oidc-login works correctly:
Then trying to use this login fails, without this fix:
However, the upstream kubectl cli command worked correctly:
Similarly, after applying the fix in this PR:
Testing
Although no separate test is built for this, K3s might want to consider creating a specific test for this use case.
Linked Issues
User-Facing Change
Further Comments