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
Changed flag name underscore warning to prevent duplicate warnings and avoid recommending invalid flag name #103852
Conversation
…y invalid flag name
/cc @eddiezane @seans3 |
/remove-sig api-machinery |
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.
Nice!
/lgtm
"testing" | ||
) | ||
|
||
type FakeLogger struct { |
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 looked (could have missed something) and was surprised that this doesn't exist as a reusable thing for tests.
Might be a good PR to add to klog?
/assign @stealthybox |
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
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: brianpursley, eddiezane, soltysh The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What type of PR is this?
/kind bug
What this PR does / why we need it:
If you use kubectl with a flag name that has underscores as a word separator, but is an invalid flag name, kubectl recommends you use the invalid flag name with - as word separator. It also writes the same warning out numerous times.
Example below tells me
foo_bar
is deprecated (not true, it is an invalid flag) and to use a flag calledfoo-bar
even though that obviously is not a valid flag.The message saying that all flags containing an underscore is deprecated is 5+ years old. However we don't really want to break someone who happens to be using a flag named this way.
The approach discussed during the 7/21 sig-cli bug scrub meeting is to allow the conversion to remain, but change the warning message to not say anything about deprecation and not make any recommendation about the flag name because we don't know at this point in the code execution whether the flag is valid or invalid.
The conversion between _ and - will still occur as it has to preserve compatibility.
This PR also prevents writing the same flag name warning out multiple times.
New output after this PR:
Which issue(s) this PR fixes:
Fixes kubernetes/kubectl#1078
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: