-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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: "edit add labels" make labels handle -f flag same as commonLabels #5809
fix: "edit add labels" make labels handle -f flag same as commonLabels #5809
Conversation
|
Welcome @fktym! |
Hi @fktym. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
/test all |
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.
Hi there, @fktym! 👋🏻
Thank you for your contribution!
I just have a small suggestion on this for enhanced usability. Other than that, LGTM.
|
||
func (o *addMetadataOptions) writeToMapEntry(m map[string]string, k, v string, kind kindOfAdd) error { | ||
if _, ok := m[k]; ok && !o.force { | ||
return fmt.Errorf("%s %s already in kustomization file", kind, k) |
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.
Minor suggestion for usability:
return fmt.Errorf("%s %s already in kustomization file", kind, k) | |
return fmt.Errorf("%s %s already in kustomization file. Use --force to override.", kind, k) |
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.
@stormqueen1990 Thanks for the feedback!
Totally agree that it'll help with usability. I've made the changes - mind taking another look?
c17d9c6
to
8aa849c
Compare
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: fktym, varshaprasad96 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 |
8aa849c
to
70e4d2e
Compare
@varshaprasad96 |
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
/ok-to-test
Thanks @fktym!
Thank you for the review. Looking forward to the release! |
kustomize edit add labels
command modifies labels to handle the -f flag the same way as commonLabels. This change should also address one of the concerns raised in #4746 (comment).Current Behavior:
kustomize edit add labels name:value -f
overwrites existing labels when using -f flagkustomize edit add labels name:value -f --without-selector
creates a new Labels entry even with -f flagFixed Behavior:
kustomize edit add labels name:value -f --without-selector
overwrites existing labels when using -f flagNote:
This change unifies the -f flag behavior between commonLabels and labels. I needed this overwrite functionality as I use kustomize edit add labels in CI to update versions.
Related:
- #4746 (comment)
- #4486