-
Notifications
You must be signed in to change notification settings - Fork 165
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
Avoid overwriting entire KubeCredentials block #397
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like a fine change.
Can you add a small unit test to cover this?
|
The new test would go in kubectl_token_test.go. We would only need to test the cacheCredential function. |
I've written a test for this fix here 78c6a7c feel free to copy the test and update the PR, or we can merge it. |
@bigkevmcd Thank you! I have added the test. @crobby Can you please review the change and let us know if any further change is required? |
Will do. It looks like the linter has identified a few issues. You should be able to see the logs and adjust based on that. |
@crobby |
@enrichman I re-used the context for the test |
As described in rancher/rancher#46997
Whenever we use
rancher token
to get a token of cluster we're currently on, instead of just verifying the token expiration date and exiting, the CLI, asks for a re-login and clears the KubeCredentials block.This PR aims to fix that issue