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

Fix kubectl unlabel response msg #104372

Merged
merged 1 commit into from
Nov 3, 2021

Conversation

astraw99
Copy link
Member

What type of PR is this?

/kind bug

What this PR does / why we need it:

To distinguish between label and unlabel msg: labeled/unlabeled, just like tainted/untainted.

Which issue(s) this PR fixes:

Fixes #104371

Does this PR introduce a user-facing change?

NONE

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/bug Categorizes issue or PR as related to a bug. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. 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 Aug 15, 2021
@k8s-ci-robot
Copy link
Contributor

Hi @astraw99. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Aug 15, 2021
@k8s-ci-robot k8s-ci-robot added area/kubectl 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 Aug 15, 2021
@afirth
Copy link
Member

afirth commented Aug 17, 2021

/sig cli
/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Aug 17, 2021
@rikatz
Copy link
Contributor

rikatz commented Aug 17, 2021

/lgtm
I would just take a look into https://github.com/kubernetes/kubernetes/blob/d98989b62a7005be3b28c75f8a52cf8c4b77e75a/staging/src/k8s.io/kubectl/pkg/cmd/label/label_test.go and check if some additional unit test can be added/needs to be changed

Thanks!

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 17, 2021
@astraw99
Copy link
Member Author

/lgtm
I would just take a look into https://github.com/kubernetes/kubernetes/blob/d98989b62a7005be3b28c75f8a52cf8c4b77e75a/staging/src/k8s.io/kubectl/pkg/cmd/label/label_test.go and check if some additional unit test can be added/needs to be changed

Thanks!

@rikatz Any update on this? Waiting for your update, thanks.

@@ -393,6 +393,9 @@ func updateDataChangeMsg(oldObj []byte, newObj []byte) string {
msg := "not labeled"
if !reflect.DeepEqual(oldObj, newObj) {
msg = "labeled"
if len(newObj) < len(oldObj) {
msg = "unlabeled"
Copy link
Member

@Pingan2017 Pingan2017 Aug 20, 2021

Choose a reason for hiding this comment

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

add the label key?
eg: 'labelkey' unlabeled

Copy link
Member Author

Choose a reason for hiding this comment

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

Currently the kubectl label response is like node/10.0.x.x labeled/unlabeled, it is the same as node/10.0.x.x tainted/untainted.
So if want to add the label key, there need more code change.

@agile6v
Copy link

agile6v commented Aug 22, 2021

Hello @astraw99 @rikatz I think label command can provide more exact response msg.

Like this:

$ kubectl label pod apple-app foo=bar
pod/apple-app labeled

$ kubectl label pod apple-app foo=bar --overwrite
pod/apple-app not labeled

$ kubectl label pod apple-app foo=bar1 --overwrite
pod/apple-app labeled

$ kubectl label pod apple-app foofoo=barbar foo-
pod/apple-app labeled & unlabeled

$ kubectl label pod apple-app foofoo-
pod/apple-app unlabeled

I submitted a PR for this. Hopefully understand it correctly. Thanks.

@pacoxu pacoxu added this to Needs Approver in SIG CLI Aug 24, 2021
@astraw99
Copy link
Member Author

astraw99 commented Sep 1, 2021

@rikatz PTAL thanks.

@pacoxu
Copy link
Member

pacoxu commented Sep 10, 2021

/lgtm
/triage accepted
/assign @soltysh
for approval and btw, there is another fix #104502 which did some refactors meanwhile.

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Sep 10, 2021
@astraw99
Copy link
Member Author

@soltysh PTAL thanks.

@rikatz
Copy link
Contributor

rikatz commented Sep 19, 2021

/lgtm
I would just take a look into https://github.com/kubernetes/kubernetes/blob/d98989b62a7005be3b28c75f8a52cf8c4b77e75a/staging/src/k8s.io/kubectl/pkg/cmd/label/label_test.go and check if some additional unit test can be added/needs to be changed
Thanks!

@rikatz Any update on this? Waiting for your update, thanks.

Have you added the unit tests?

Thanks!

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Sep 23, 2021
@astraw99
Copy link
Member Author

@rikatz Unit tests added and passed, PTAL thanks.

@astraw99
Copy link
Member Author

@soltysh @rikatz PTAL thanks.

2 similar comments
@astraw99
Copy link
Member Author

astraw99 commented Oct 8, 2021

@soltysh @rikatz PTAL thanks.

@astraw99
Copy link
Member Author

@soltysh @rikatz PTAL thanks.

@rikatz
Copy link
Contributor

rikatz commented Oct 25, 2021

/lgtm

Thank you

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 25, 2021
Copy link
Contributor

@soltysh soltysh left a comment

Choose a reason for hiding this comment

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

/priority backlog
/approve

@k8s-ci-robot k8s-ci-robot added priority/backlog Higher priority than priority/awaiting-more-evidence. and removed needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Nov 3, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: astraw99, 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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 3, 2021
@afirth
Copy link
Member

afirth commented Nov 3, 2021

This looks like a flake? Don't see an open issue but will make one if it passes

W1103 14:02:20.750] Could not detect Kubernetes master node.  Make sure you've launched a cluster with 'kube-up.sh'
I1103 14:02:20.851] Master not detected. Is the cluster up?

and testgrid
/retest

@k8s-triage-robot
Copy link

The Kubernetes project has merge-blocking tests that are currently too flaky to consistently pass.

This bot retests PRs for certain kubernetes repos according to the following rules:

  • The PR does have any do-not-merge/* labels
  • The PR does not have the needs-ok-to-test label
  • The PR is mergeable (does not have a needs-rebase label)
  • The PR is approved (has cncf-cla: yes, lgtm, approved labels)
  • The PR is failing tests required for merge

You can:

/retest

@k8s-ci-robot k8s-ci-robot merged commit a65bb64 into kubernetes:master Nov 3, 2021
SIG CLI automation moved this from Needs Approver to Done Nov 3, 2021
@k8s-ci-robot k8s-ci-robot added this to the v1.23 milestone Nov 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/kubectl cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. priority/backlog Higher priority than priority/awaiting-more-evidence. release-note-none Denotes a PR that doesn't merit a release note. sig/cli Categorizes an issue or PR as relevant to SIG CLI. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
Development

Successfully merging this pull request may close these issues.

kubectl label msg is not distinguished between label and unlabel
9 participants