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 --context support in convert subcommand #260

Merged
merged 1 commit into from
Apr 25, 2023

Conversation

weinong
Copy link
Contributor

@weinong weinong commented Apr 21, 2023

it allows to convert only the selected context rather than the whole kubeconfig

fixes #87

@codecov-commenter
Copy link

Codecov Report

Merging #260 (89bb584) into master (d07e440) will increase coverage by 0.31%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #260      +/-   ##
==========================================
+ Coverage   49.72%   50.04%   +0.31%     
==========================================
  Files          15       15              
  Lines        1096     1103       +7     
==========================================
+ Hits          545      552       +7     
  Misses        520      520              
  Partials       31       31              
Impacted Files Coverage Δ
pkg/converter/convert.go 79.62% <100.00%> (+0.47%) ⬆️
pkg/converter/options.go 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Copy link
Member

@Tatsinnit Tatsinnit left a comment

Choose a reason for hiding this comment

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

💡☕️🎉 looks good to me.

@@ -1042,6 +1044,26 @@ func TestConvert(t *testing.T) {
},
command: execName,
},
{
name: "convert with context specified, auth info not specified by the context should not be changed",
Copy link
Member

Choose a reason for hiding this comment

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

maybe we should also add a test case for context specified, auth info not found case to ensure the behavior

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i think what you are suggesting is the essence of this test case? for any unmatched auth info, they should remain as is

Copy link
Member

@bcho bcho left a comment

Choose a reason for hiding this comment

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

LGTM. My remaining question is on what should we show to the user if there is no matched context. This is a common case if there is typo in the --context value. Silently omitting this might cause confusion in some cases. But I am fine to improve this part in later change.

@bcho bcho merged commit 4458c89 into Azure:master Apr 25, 2023
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.

Support converting a single cluster in a kubeconfig file
4 participants