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

implement Kubeconfig::from_yaml #719

Merged
merged 6 commits into from Nov 20, 2021
Merged

Conversation

imp
Copy link
Contributor

@imp imp commented Nov 18, 2021

Addresses #718

Motivation

Allow consumers to load kubeconfig from arbitrary sources with minimal friction

Solution

Refactor code for reading and merging Kubeconfig yaml documents into the separate public method as well as implement FromStr to make it more idiomatic (I.e. use str::parse())

Kubeconfig::read_from is updated to use a multi-document reader (kubeconfig_from_yaml) in a separate commit.
So if this change would appear to be controversial it could be easily dropped.

Tests are updated to use new functionality as well

@clux clux linked an issue Nov 18, 2021 that may be closed by this pull request
Copy link
Member

@clux clux left a comment

Choose a reason for hiding this comment

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

minor comments

kube-client/src/config/file_config.rs Show resolved Hide resolved
kube-client/src/config/file_config.rs Outdated Show resolved Hide resolved
kube-client/src/config/file_config.rs Outdated Show resolved Hide resolved
kube-client/src/config/file_config.rs Outdated Show resolved Hide resolved
kube-client/src/config/file_config.rs Outdated Show resolved Hide resolved
kube-client/src/config/file_config.rs Outdated Show resolved Hide resolved
@imp imp force-pushed the kubeconfig-fromstr branch 2 times, most recently from 5a24b06 to efe3a15 Compare November 20, 2021 10:06
@imp
Copy link
Contributor Author

imp commented Nov 20, 2021

Rebased and squashed to clean up the history

Copy link
Member

@clux clux left a comment

Choose a reason for hiding this comment

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

tiny comment on docs otherwise looks good!

kube-client/src/config/file_config.rs Outdated Show resolved Hide resolved
Copy link
Member

@clux clux left a comment

Choose a reason for hiding this comment

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

another nit

kube-client/src/config/file_config.rs Outdated Show resolved Hide resolved
@clux clux changed the title Kubeconfig::from_text and impl FromStr for Kubeconfig implement Kubeconfig::from_yaml Nov 20, 2021
Signed-off-by: Cyril Plisko <cyril.plisko@mountall.com>
Signed-off-by: Cyril Plisko <cyril.plisko@mountall.com>
Fixes kube-rs#718

Signed-off-by: Cyril Plisko <cyril.plisko@mountall.com>
Signed-off-by: Cyril Plisko <cyril.plisko@mountall.com>
Signed-off-by: Cyril Plisko <cyril.plisko@mountall.com>
@clux
Copy link
Member

clux commented Nov 20, 2021

Thanks a lot @imp. Minor feature with much back and forth, but useful, and you ended up helping uncover an inconsistency in our parsing logic, so appreciate the time here!

@clux clux merged commit 16e667f into kube-rs:master Nov 20, 2021
@imp imp deleted the kubeconfig-fromstr branch November 20, 2021 20:40
@clux clux added this to the 0.65.0 milestone Dec 10, 2021
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.

Export functionality to load Kubeconfig from text
4 participants