Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
fix: align kube-rs with client-go config parsing #1077
fix: align kube-rs with client-go config parsing #1077
Changes from 8 commits
935c554
d5f1325
af53d50
57f79ad
42c92fd
5964333
071bfd5
447e546
772e9e1
a4bbc97
850fb5b
d86c2c6
1f51e4e
8ecbd8f
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Why was this changed?
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.
I think we can clean this up to:
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.
That was removed because current-context can be null/empty, at least that's how it works on kubectl. Do you think we should not change this in kube-rs?
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.
It can be null/empty when parsing, but should return an error when using the config, right?
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.
It depends, if we want similar behavior as client-go/kubectl, then an empty current-context is a valid value, because context names can be empty too.
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.
Confirmed kubectl works with a context with empty name when current context is empty.
We should align with client-go (library), and not kubectl (app), though.
Config
struct. (The link infile_config.rs
is pointing to the struct after the conversion.)We should probably use default value when missing instead of
Option
to align with client-go'sConfig
as much as possible. ExistingOption<String>
fields should be fixed if it doesn't match client-go for consistency (not in this PR). We should also followomitempty
tags and skip serializing empty.The problem is allowing
null
. Do we really need to? It just feels weird to me, and I don't think this happens in practice.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.
Maybe kubectl doesn't call ConfirmUsable?
I think this topic requires a bit more discussion and I don't want to rush into a solution, but I'd like to get the other changes on this PR merged soon.
As empty/null names are very edge cases scenarios, I'd like to propose that:
What you think?
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.
Yeah, let's do that.
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.
It's possible that all this lax parsing is due to supporting config merges. Configs that are invalid in isolation (e.g. no current context) are fine in the merged setting (where another file sets the current-context).
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.
OK, I've reverted a bunch of changes so the PR is a lot simpler now. Still open for feedback! Thanks