Repository navigation
refactor(auth): move kubeconfig machinery to internal/kubeconfig - #461
Merged
Merged
Conversation
thde
added this pull request to stack #459
September 17, 2026 10:57
thde
force-pushed
the
thde/352-04-cluster-login
branch
3 times, most recently
from
October 1, 2026 13:27
c18c1e0 to
ffc2b39
Compare
Building the kubeconfig entries (newAPIConfig with its options and the two exec plugin configs), merging them into the user's kubeconfig (login, mergeKubeConfig) and logging in to a KubernetesCluster were unexported helpers of the auth verb, which forced create to import auth for ClusterCmd. They now live in the non-verb package internal/kubeconfig as NewAPIConfig, Login and LoginCluster; auth keeps the kong commands and flag parsing and delegates to it. The exec plugin args need the name of the auth command, so the "auth" constant moves next to api.OIDCCmdName as api.AuthCmdName and auth.CmdName refers to it. The cluster login test moves with the logic; auth keeps a test for its name/project argument parsing.
create vcluster ran auth.ClusterCmd after the cluster became available, which was the last reason for create to import the auth verb. It now calls kubeconfig.LoginCluster directly. This also passes the command's own writer instead of the zero-value format.Writer of the constructed ClusterCmd, which wrote to io.Discard, so the "added ... to kubeconfig" and "logged into cluster ..." messages are no longer swallowed after `nctl create vcluster`.
thde
force-pushed
the
thde/352-04-cluster-login
branch
from
October 1, 2026 13:59
ffc2b39 to
5698c1e
Compare
SaadAssaf
approved these changes
Oct 5, 2026
SaadAssaf
left a comment
Contributor
There was a problem hiding this comment.
looks clean and good to me
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Building the kubeconfig entries (newAPIConfig with its options and the two exec plugin configs), merging them into the user's kubeconfig (login, mergeKubeConfig) and logging in to a KubernetesCluster were unexported helpers of the auth verb, which forced create to import auth for ClusterCmd. They now live in the non-verb package internal/kubeconfig as NewAPIConfig, Login and LoginCluster; auth keeps the kong commands and flag parsing and delegates to it.
The exec plugin args need the name of the auth command, so the "auth" constant moves next to api.OIDCCmdName as api.AuthCmdName and auth.CmdName refers to it.
The cluster login test moves with the logic; auth keeps a test for its name/project argument parsing.