-
Notifications
You must be signed in to change notification settings - Fork 39.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
Remove specific command suggestion from kubectl rollout undo error message #111795
Remove specific command suggestion from kubectl rollout undo error message #111795
Conversation
Please note that we're already in Test Freeze for the Fast forwards are scheduled to happen every 6 hours, whereas the most recent run was: Thu Aug 11 01:31:23 UTC 2022. |
@lojies: This issue is currently awaiting triage. If a SIG or subproject determines this is a relevant issue, they will accept it by applying the The 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. |
/test pull-kubernetes-verify |
This change sounds reasonable to me. Would it be better to also update examples? kubernetes/staging/src/k8s.io/kubectl/pkg/cmd/rollout/rollout_undo.go Lines 59 to 67 in c4f8c57
|
It seems like no namespace added in all commands' examples, i'm not sure if it's better to update this command only. |
You are right. /lgtm |
@@ -124,7 +124,7 @@ func (r *DeploymentRollbacker) Rollback(obj runtime.Object, updatedAnnotations m | |||
return printTemplate(&rsForRevision.Spec.Template) | |||
} | |||
if deployment.Spec.Paused { | |||
return "", fmt.Errorf("you cannot rollback a paused deployment; resume it first with 'kubectl rollout resume deployment/%s' and try again", name) | |||
return "", fmt.Errorf("you cannot rollback a paused deployment; resume it first with 'kubectl rollout resume deployment/%s -n %s' and try again", name, namespace) |
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.
Are you sure that in case of default namespace the error will be "-n default" and not "-n "?
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.
This is a good point. The namespace variable here is coming from the object's metadata.namespace
, and reading this comment makes me THINK it should be OK, but it doesn't clear things up 100%:
An empty namespace is equivalent to the "default" namespace, but "default" is the canonical representation
This implies, to me, that empty will be change to "default". But on the other hand it implies that it COULD be empty and still be valid. Am I reading this correctly? It sounds like we might want to check if namespace is empty, and use default if so, just to be safe.
Also, we can't just omit the -n in this case, even though for many people "default" is their default namespace, you can configure a kubectl context to use a different namespace, so it would get complicated to try to figure out whether "default" is their default namespace in their current kubectl context.
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.
There is part of me that thinks maybe we should not be telling people exactly which command to run. Maybe we should be just saying:
...resume it first with 'kubectl rollout resume'
and not try to build up the entire command for them.
Is kubectl trying to do too much here?
For example, we don't know if they are supposed to be using --context=production
or something like that. Telling them to run a specific complete command seems like it could be a somewhat dangerous thing.
I think there is a difference between this and help text examples, because people understand that they need to adapt help text examples to their use case, but when we are including their deployment name and namespace in the completely runnable command, it implies that we are telling them that it is correct to run that specific command.
Am I making sense? Thoughts about this?
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.
I tried and we got -n default.This can be run correctly, but as @brianpursley mentioned, it seems like a little strange and is maybe still not a complete command.
[root@lzx-22:/root]$ kubectl rollout undo deployment kubia
error: you cannot rollback a paused deployment; resume it first with 'kubectl rollout resume deployment/kubia -n default' and try again
Are you sure that in case of default namespace the error will be "-n default" and not "-n "?
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.
@brianpursley, I agree with you. If we cannot give the complete command, i think it's better to just use kubectl rollout resume
.
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.
Telling them to run a specific complete command seems like it could be a somewhat dangerous thing.
👍 I also agree with you, Brian. As you're saying, it's not helpful for it to look runnable and complete while potentially not being exactly what they need to run under the circumstances.
@brianpursley @VirrageS, so is it ok that change like this? return "", fmt.Errorf("you cannot rollback a paused deployment; resume it first with 'kubectl rollout resume' and try again", name) |
Yeah, the wording is good, but obviously you would not need to pass |
fa63447
to
186a326
Compare
Yes, i have changed this, thanks. |
/retitle Remove specific command suggestion from kubectl rollout undo error message |
/lgtm Thanks @lojies |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: brianpursley, lojies 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 |
What type of PR is this?
/kind bug
What this PR does / why we need it:
add namespace in error message command
Which issue(s) this PR fixes:
Fixes #111794
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: