Repository navigation
fix: preserve case of label selectors in command prompt - #4276
Merged
Merged
Conversation
uozalp
approved these changes
Oct 7, 2026
uozalp
left a comment
Collaborator
There was a problem hiding this comment.
@kevin9327 thanks for fixing this bug
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Kubernetes label keys and values are case-sensitive, but the command interpreter lowercases the label selector argument before it is parsed. As a result, a prompt such as
ends up as the selector
app=myappand matches nothing when the pods are labeledapp=MyApp. The same happens for quoted set-based selectors ('app in (MyApp,Other)') and for selectors coming from aliases. This is the remaining part of #2855 (which was auto-closed as stale).The fix stops lowercasing the label argument in
newArgs. The command name, namespace, filter and fuzzy arguments keep their existing case handling.Tests: added two mixed-case cases to
TestLabelCmd(plain and quoted set-based selectors). Both fail on master (app=myapp,tier=backend/app in (myapp,other)) and pass with the change. The existingl-arg-capscase expectedFRED=BLEEto becomefred=blee, which is exactly the behavior being fixed, so I updated it to expect the case to be preserved.go test ./internal/...andgo vetpass.