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

Do not raise an error proposing to use '--overwrite' when annotating with the same value #109505

Merged
merged 2 commits into from Nov 3, 2022
Merged

Conversation

zigarn
Copy link
Contributor

@zigarn zigarn commented Apr 15, 2022

Equivalent of PR #105936 for annotations.

What type of PR is this?

/kind bug

What this PR does / why we need it:

Currently, when trying to set a label with the same value as current one, kubectl advise to use the --overwrite option:

$ kubectl create namespace test
namespace/test created
$ kubectl annotate namespace test usage=test
namespace/test annotated
$ kubectl annotate namespace test usage=test
error: --overwrite is false but found the following declared annotation(s): 'usage' already has a value (test)

But then, overwriting for the same value is a bit weird.

This PR propose to detect this situation and do nothing:

$ kubectl annotate namespace test usage=test
namespace/test annotated

Which issue(s) this PR fixes:

No existing issue.

Special notes for your reviewer:

Does this PR introduce a user-facing change?

Do not raise an error when setting an annotation with the same value, just ignore it.

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

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/bug Categorizes issue or PR as related to a bug. size/S Denotes a PR that changes 10-29 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. 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 Apr 15, 2022
@k8s-ci-robot
Copy link
Contributor

Hi @zigarn. 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 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 Apr 15, 2022
@shiva1333
Copy link
Contributor

/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 Apr 15, 2022
@zigarn
Copy link
Contributor Author

zigarn commented Apr 15, 2022

/retest

@ardaguclu
Copy link
Member

Sounds reasonable to me.
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 22, 2022
@zigarn
Copy link
Contributor Author

zigarn commented May 4, 2022

/assign @deads2k

@pacoxu pacoxu added this to Needs review in SIG CLI May 9, 2022
Annotations: map[string]string{"a": "b"},
},
},
annotations: map[string]string{"a": "c"},
expectErr: true,
Copy link
Contributor

Choose a reason for hiding this comment

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

Would you be willing to make the same improvement to these tests that you made in the labels PR, so they prove we're getting the specific error we expect? #105936 (comment)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No problem. It's done.

@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed lgtm "Looks good to me", indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels May 11, 2022
@zigarn zigarn requested a review from KnVerey July 15, 2022 10:34
@zigarn
Copy link
Contributor Author

zigarn commented Aug 3, 2022

/auto-cc

@zigarn
Copy link
Contributor Author

zigarn commented Oct 7, 2022

/auto-cc

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.

/approve

@soltysh
Copy link
Contributor

soltysh commented Oct 14, 2022

/triage accepted
/priority backlog

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. priority/backlog Higher priority than priority/awaiting-more-evidence. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Oct 14, 2022
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: soltysh, zigarn

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 Oct 14, 2022
Copy link
Contributor

@KnVerey KnVerey left a comment

Choose a reason for hiding this comment

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

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 3, 2022
@k8s-ci-robot k8s-ci-robot merged commit d96e052 into kubernetes:master Nov 3, 2022
SIG CLI automation moved this from Needs review to Done Nov 3, 2022
@k8s-ci-robot k8s-ci-robot added this to the v1.26 milestone Nov 3, 2022
@zigarn zigarn deleted the no-error-reannotate branch November 3, 2022 21:54
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 Denotes a PR that will be considered when it comes time to generate release notes. 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. 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.

None yet

7 participants