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

feat: add label(s) modified message for kubectl label command #124647

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

TessaIO
Copy link
Contributor

@TessaIO TessaIO commented Apr 30, 2024

What type of PR is this?

/kind feature

What this PR does / why we need it:

This PR aims to modify the kubectl label command when we add and remove labels at the same time. In fact, the old behavior was based on the length of labels being added/removed. Now, if we remove and add labels at the same operation we just output label(s) modified

Which issue(s) this PR fixes:

Fixes #1312

Special notes for your reviewer:

Does this PR introduce a user-facing change?

Added the "label(s) modified" message to handle the case of adding and removing labels at the same time.

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:

N/A

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. kind/feature Categorizes issue or PR as related to a new feature. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Apr 30, 2024
@k8s-ci-robot
Copy link
Contributor

This issue is currently awaiting triage.

If a SIG or subproject determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

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/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the needs-priority Indicates a PR lacks a `priority/foo` label and requires one. label Apr 30, 2024
@TessaIO TessaIO force-pushed the feat-add-labels-modified-message branch from ba50a36 to b6832b0 Compare April 30, 2024 22:24
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Apr 30, 2024
@k8s-ci-robot k8s-ci-robot added area/kubectl sig/auth Categorizes an issue or PR as relevant to SIG Auth. sig/cli Categorizes an issue or PR as relevant to SIG CLI. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Apr 30, 2024
@TessaIO TessaIO changed the title [WIP] feat: add labels modified message for kubectl label command feat: add labels modified message for kubectl label command Apr 30, 2024
@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Apr 30, 2024
@TessaIO TessaIO changed the title feat: add labels modified message for kubectl label command feat: add label(s) modified message for kubectl label command Apr 30, 2024
@TessaIO TessaIO force-pushed the feat-add-labels-modified-message branch from b6832b0 to 70aff12 Compare April 30, 2024 22:51
@TessaIO
Copy link
Contributor Author

TessaIO commented May 2, 2024

/cc @brianpursley

@ah8ad3
Copy link
Member

ah8ad3 commented May 5, 2024

Thanks for the PR. I think it would be nice if we change from

	MsgNotLabeled    = "not labeled"
	MsgLabeled       = "labeled"
	MsgUnLabeled     = "unlabeled"
	MsgLabelsChanged = "label(s) changed"

to just simply

	MsgNotLabeled    = "not labeled"
	MsgLabelsChanged = "label(s) changed"

but wait for other reviewer for this.

@TessaIO
Copy link
Contributor Author

TessaIO commented May 5, 2024

Thanks for the PR. I think it would be nice if we change from

	MsgNotLabeled    = "not labeled"
	MsgLabeled       = "labeled"
	MsgUnLabeled     = "unlabeled"
	MsgLabelsChanged = "label(s) changed"

Thanks for the review, and I see your point. However, it would be cleaner from a UX perspective if the user knew what happened exactly. The current setup in the PR allows the user to differentiate between adding labels, removing labels, and adding and removing labels by the same operation. Therefore, I see that printing label(s) changed for all of these kinds of operations makes it blurry/hard for the user to understand what happened exactly.

Signed-off-by: TessaIO <ahmedgrati1999@gmail.com>
@TessaIO TessaIO force-pushed the feat-add-labels-modified-message branch from 70aff12 to d73951c Compare May 6, 2024 07:53
@TessaIO TessaIO requested a review from ah8ad3 May 6, 2024 07:53
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: TessaIO
Once this PR has been reviewed and has the lgtm label, please assign apelisse for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/kubectl cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/auth Categorizes an issue or PR as relevant to SIG Auth. sig/cli Categorizes an issue or PR as relevant to SIG CLI. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
Status: Needs Triage
Status: Needs Triage
Development

Successfully merging this pull request may close these issues.

kubectl label: Inconsistent messaging when both adding and removing labels
3 participants