Skip to content
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

kubectl config set-crentials: add arguments for auth providers #30007

Conversation

ericchiang
Copy link
Contributor

@ericchiang ericchiang commented Aug 3, 2016

This PR adds --auth-provider and --auth-provider-arg flags to the
kubectl config set-credentials sub-command.

There's currently no way of interacting with the new auth provider framework added in #23066 through kubectl. You have to render a custom kubeconfig to use them. Additionally kubectl config set just sort of craps out when attempting to interact with authentication info objects (#29312).

This is a minimal implementation of allowing kubect config set-credentials to set fields for client auth providers.

cc @cjcullen @kubernetes/kubectl

@k8s-github-robot k8s-github-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. release-note-label-needed labels Aug 3, 2016
@brendandburns
Copy link
Contributor

Looks reasonable to me. Can we get some tests of that validate function?

@@ -238,5 +269,14 @@ func (o createAuthInfoOptions) validate() error {
}
}

if len(o.authProviderArgs) > 0 {
newPairs, removePairs, err := cmdutil.ParsePairs(o.authProviderArgs, "auth-provider-arg", true)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's reasonable to do this Complete so you never have to track o.authProviderArgs and can have a non-mutating Validate method. If you're unable to perform the Complete step due to bad args, you can fail there.

The Validate method allows for clean composition between commands, so that if you built a command on top of this one, you could have the kubectl fobber command build a CreateAuthInfoOptions, call Validate (couldn't call Complete since args are likely different), and then have a high confidence that Run would work.

@fabianofranz something to watch for so get clean composition out of commands.

@ericchiang ericchiang force-pushed the kubectl-config-set-credentials-auth-providers branch from ed8d4e9 to 98c34e5 Compare August 4, 2016 22:22
@k8s-github-robot k8s-github-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Aug 4, 2016
@ericchiang ericchiang force-pushed the kubectl-config-set-credentials-auth-providers branch from 98c34e5 to 60c6ebe Compare August 4, 2016 22:33
This PR adds `--auth-provider` and `--auth-provider-arg` flags to the
`kubectl config set-credentials` sub-command.
@ericchiang ericchiang force-pushed the kubectl-config-set-credentials-auth-providers branch from 60c6ebe to 974473c Compare August 4, 2016 23:23
@ericchiang
Copy link
Contributor Author

Per @deads2k's comments, the flag parsing was moved to a different part of the code.

Updated to add tests for various combinations of flags.

@brendandburns brendandburns added release-note Denotes a PR that will be considered when it comes time to generate release notes. lgtm "Looks good to me", indicates that a PR is ready to be merged. and removed release-note-label-needed labels Aug 5, 2016
@brendandburns
Copy link
Contributor

LGTM. Thanks.

@k8s-bot
Copy link

k8s-bot commented Aug 6, 2016

GCE e2e build/test passed for commit 974473c.

@k8s-github-robot
Copy link

Automatic merge from submit-queue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants