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

add username flag for token command #351

Open
wants to merge 2 commits into
base: v2.9
Choose a base branch
from

Conversation

billiford
Copy link

@billiford billiford commented Mar 14, 2024

This PR allows us to pass the username as a flag to the rancher token command so it does not need to be input each time. This is helpful in Kubernetes configs when defining the login command for a given cluster.

Example

$ ranch token --server=my-server --user=my-user --cluster=my-cluster --auth-provider=activeDirectoryProvider --username=my-username
Enter credentials for activeDirectoryProvider

Enter password:

As we can see it no longer asks for a username if one is passed in.

Copy link

@andreas-kupries andreas-kupries left a comment

Choose a reason for hiding this comment

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

While it looks ok I am wondering about the relation between this new username and the pre-existing userId (flag --user). Is one derivable from the other ?

@billiford
Copy link
Author

In our environment there is no relation. It is setup so the userId is the name of the cluster and is therefore the same for everyone connecting to that cluster. Since we're using an auth provider, the username is what's passed to Active Directory to identify the client during login.

@elaijuh
Copy link

elaijuh commented Apr 18, 2024

Does it make sense to support --password or RANCHER_PASSWORD env variable. I think this is valid in non-interactive process like CICD.

@billiford
Copy link
Author

Why not support both? The --password flag is useful for my kubectl config login command.

@elaijuh
Copy link

elaijuh commented Apr 18, 2024

@billiford will you add password support as well? maybe name them --authUser and --authPassword to differentiate from --user

@billiford
Copy link
Author

I'd be happy to change this to --authUser in this PR, but I think anything involving a password should take place in a separate PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants