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

kubectl: improve the warning message when doing kubectl apply to the resource without expected annotation #91934

Merged
merged 1 commit into from Oct 4, 2020

Conversation

SataQiu
Copy link
Member

@SataQiu SataQiu commented Jun 9, 2020

What type of PR is this?
/kind cleanup

What this PR does / why we need it:
kubectl: improve the warning message when doing kubectl apply to the resource without expected annotation.
Users are keeping complaining about the confusing warning message Warning: kubectl apply should be used on resource created by either kubectl create --save-config or kubectl apply:

is it really an error message or just an informative message?
Did the command successfully execute the changes being asked?
Were the changes applied successfully?
Was there anything overwritten?
If changes were successfully applied, what is the reason for this message to show?

Which issue(s) this PR fixes:

Fixes #91425
Ref: #82154 #36620 #36672

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

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

NONE

/cc @007g3m1n1

@k8s-ci-robot
Copy link
Contributor

@SataQiu: GitHub didn't allow me to request PR reviews from the following users: 007g3m1n1.

Note that only kubernetes members and repo collaborators can review this PR, and authors cannot review their own PRs.

In response to this:

What type of PR is this?
/kind cleanup

What this PR does / why we need it:
kubectl: improve the warning message when doing kubectl apply to the resource without expected annotation.
Users are keeping complaining about the confusing warning message Warning: kubectl apply should be used on resource created by either kubectl create --save-config or kubectl apply:

is it really an error message or just an informative message?
Did the command successfully execute the changes being asked?
Were the changes applied successfully?
Was there anything overwritten?
If changes were successfully applied, what is the reason for this message to show?

Which issue(s) this PR fixes:

Fixes #91425
Ref: #82154 #36620 #36672

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

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

NONE

/cc @007g3m1n1

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 release-note-none Denotes a PR that doesn't merit a release note. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. 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. needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. area/kubectl sig/cli Categorizes an issue or PR as relevant to SIG CLI. and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Jun 9, 2020
@SataQiu
Copy link
Member Author

SataQiu commented Jun 9, 2020

/assign @janetkuo @soltysh

@SataQiu
Copy link
Member Author

SataQiu commented Jun 9, 2020

/cc @janetkuo @soltysh

@SataQiu SataQiu force-pushed the fix-kubectl-20200609 branch 2 times, most recently from d3e8f9d to b83ecdf Compare June 9, 2020 09:03
@SataQiu
Copy link
Member Author

SataQiu commented Jun 9, 2020

/retest

1 similar comment
@SataQiu
Copy link
Member Author

SataQiu commented Jun 10, 2020

/retest

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.

One nit and you're good to go.

@@ -132,7 +132,7 @@ var (
# Apply the configuration in manifest.yaml and delete all the other configmaps that are not in the file.
kubectl apply --prune -f manifest.yaml --all --prune-whitelist=core/v1/ConfigMap`))

warningNoLastAppliedConfigAnnotation = "Warning: %[1]s apply should be used on resource created by either %[1]s create --save-config or %[1]s apply\n"
warningNoLastAppliedConfigAnnotation = "Warning: resource %[1]s is missing the necessary annotation which required by %[2]s apply, it maybe not created by either %[2]s create --save-config or %[2]s apply, the missing annotation will be patched automatically\n"
Copy link
Contributor

Choose a reason for hiding this comment

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

which is required

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks a lot @soltysh
Done!

@soltysh
Copy link
Contributor

soltysh commented Jul 10, 2020

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: SataQiu, 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 Jul 10, 2020
@SataQiu
Copy link
Member Author

SataQiu commented Jul 11, 2020

/retest

1 similar comment
@SataQiu
Copy link
Member Author

SataQiu commented Jul 12, 2020

/retest

@ThomWright
Copy link

ThomWright commented Jul 28, 2020

As someone who has seen this error message and been confused, I would say this new message has confusing English and raises more questions!

Warning: resource %[1]s is missing the necessary annotation which is required by %[2]s apply, it maybe not created by either %[2]s create --save-config or %[2]s apply, the missing annotation will be patched automatically
  • what is 'the necessary annotation'?
  • 'it maybe not created by either ...' - what does this mean?

May I suggest something more like:

Warning: resource %[1]s is missing the <name_of_annotation> annotation which is required by %[2]s apply. %[2]s apply should only be used on resources created declaratively by either %[1]s create --save-config or %[1]s apply. The missing annotation will be applied automatically.

A reference to imperative/declarative resource creation is helpful here - it makes the problem much easier to Google.

…resource without expected annotation

Signed-off-by: SataQiu <1527062125@qq.com>
@SataQiu
Copy link
Member Author

SataQiu commented Jul 29, 2020

@ThomWright Thank you for your suggestions, updated!

@SataQiu
Copy link
Member Author

SataQiu commented Sep 12, 2020

/assign @liggitt
Would you mind taking a look?

@liggitt
Copy link
Member

liggitt commented Sep 14, 2020

looks like @soltysh has review on this one

/unassign

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.

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 2, 2020
@SataQiu
Copy link
Member Author

SataQiu commented Oct 3, 2020

/priority important-soon

@k8s-ci-robot k8s-ci-robot added priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. and removed needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Oct 3, 2020
@SataQiu
Copy link
Member Author

SataQiu commented Oct 3, 2020

/retest

@fejta-bot
Copy link

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to fejta).

Review the full test history for this PR.

Silence the bot with an /lgtm cancel or /hold comment for consistent failures.

3 similar comments
@fejta-bot
Copy link

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to fejta).

Review the full test history for this PR.

Silence the bot with an /lgtm cancel or /hold comment for consistent failures.

@fejta-bot
Copy link

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to fejta).

Review the full test history for this PR.

Silence the bot with an /lgtm cancel or /hold comment for consistent failures.

@fejta-bot
Copy link

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to fejta).

Review the full test history for this PR.

Silence the bot with an /lgtm cancel or /hold comment for consistent failures.

@k8s-ci-robot k8s-ci-robot merged commit d8185e5 into kubernetes:master Oct 4, 2020
@k8s-ci-robot k8s-ci-robot added this to the v1.20 milestone Oct 4, 2020
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/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. 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/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
7 participants