-
Notifications
You must be signed in to change notification settings - Fork 41
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
Support population of kubeconfig files #102
Conversation
Adds a helper to extract the default kubeconfig and merge the data for the specified control plane and auth user into it. Default kubeconfig loading rules are followed. If a path that does not exist is provided, a new file will be created. Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
Adds a command to get a kubeconfig for a specified control plane. Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
The kubeconfig commands do not inherit anything from their parent commands, but the nesting is more intuitive then separating into their own group. Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
Adds documentation for the control plane kubeconfig subgroup. Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
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.
The trailing \n
in the token is giving me the following error:
Unable to connect to the server: net/http: invalid header field value "Bearer eyJhb...\n" for key Authorization
This is caused by using a block when the kubeconfig is written:
- name: upbound-d21d63fe-88fd-406f-a14f-6a3eb665b772
user:
token: |
eyJhb...
The following works:
- name: upbound-d21d63fe-88fd-406f-a14f-6a3eb665b772
user:
token: eyJhb...
And so does this:
- name: upbound-d21d63fe-88fd-406f-a14f-6a3eb665b772
user:
token: |-
eyJhb...
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.
@AaronME we are consuming upstream functionality to merge the kubeconfig
, and IMO providing a token with a trailing newline is an invalid token. That being said, we could strip off all whitespace characters for a provided token to allow for a smoother UX. What do you think?
This was a consequence of me running I agree that sanitizing the token input would improve the UX. |
Trims unicode whitespace from tokens provided via stdin. This helps alleviate issues where a token file contains trailing newlines, etc. Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
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.
@AaronME updated, also added whitespace trimming to up uxp connect
when token is provided via stdin 👍🏻
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.
LGTM!
- Flags: | ||
- `--token = STRING` (*Required*): API token for authenticating to | ||
control plane. If `-` is given the value will be read from stdin. | ||
- `-f,--file = FILE`: File to merge `kubeconfig`. |
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.
Should we assume a default kubeconfig file name/path?
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.
@grantgumina yep :) since we use the upstream kubeconfig loading rules we automatically default to proper path and honor things like KUBECONFIG
env var 👍🏻
Description of your changes
Adds support for merging
kubeconfig
data for a control plane into localkubeconfig
.Fixes #86
All keys in the new
kubeconfig
entries are structured asupbound-<control-plane-id>
I have:
make reviewable
to ensure this PR is ready for review.backport release-x.y
labels to auto-backport this PR, as appropriate.How has this code been tested
Tested the following scenarios:
kubeconfig
and verify that other entries are not overwritten: