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

Better error message when checking rollout status for StatefulSet wit… #66983

Conversation

mortent
Copy link
Member

@mortent mortent commented Aug 4, 2018

…h OnDelete strategy type

What this PR does / why we need it: The error message when checking the rollout status for a StatefulSet with the OnDelete strategy type can be confusing (ref #64500). It gives the impression that something has gone wrong when the issue is simply that there is no rollout status. The error message is updated to use similar language as for DaemonSet in the same situation.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):

Special notes for your reviewer:

Release note:

Improved error message when checking the rollout status of StatefulSet with OnDelete strategy type

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. 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-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Aug 4, 2018
@neolit123
Copy link
Member

neolit123 commented Aug 6, 2018

@mortent thank you for your first contribution!

/sig cli
/ok-to-test
/kind cleanup

edit: a release note might not be needed here. waiting on others to confirm.

@k8s-ci-robot k8s-ci-robot added sig/cli Categorizes an issue or PR as relevant to SIG CLI. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Aug 6, 2018
@mortent
Copy link
Member Author

mortent commented Aug 6, 2018

/retest

@mortent
Copy link
Member Author

mortent commented Aug 6, 2018

/assign @janetkuo

@@ -126,7 +126,7 @@ func (s *StatefulSetStatusViewer) Status(namespace, name string, revision int64)
return "", false, err
}
if sts.Spec.UpdateStrategy.Type == apps.OnDeleteStatefulSetStrategyType {
return "", true, fmt.Errorf("%s updateStrategy does not have a Status", apps.OnDeleteStatefulSetStrategyType)
return "", true, fmt.Errorf("Status is not available for the OnDelete strategy type")
Copy link
Member

Choose a reason for hiding this comment

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

I think we should use != instead, i.e.

	if sts.Spec.UpdateStrategy.Type != apps.RollingUpdateStatefulSetStrategyType {
      return "", true, fmt.Errorf("rollout status is only available for %s strategy type", apps.RollingUpdateStatefulSetStrategyType)

Note that errors should not be capitalized, because it's usually appended to another error like this fmt.Errorf("failed to do this: %v", err). Using rollout status instead of status to avoid users confusing status command with status API field.

Please also update the error message in DaemonSet to make them consistent.

Copy link
Member Author

Choose a reason for hiding this comment

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

@janetkuo PR is updated.

@mortent mortent force-pushed the BetterRolloutStatusMsgForStatefulSet branch 2 times, most recently from 48af149 to df77a47 Compare August 16, 2018 02:49
@mortent mortent force-pushed the BetterRolloutStatusMsgForStatefulSet branch from df77a47 to 8e49727 Compare August 16, 2018 04:39
@mortent
Copy link
Member Author

mortent commented Aug 17, 2018

/retest

@janetkuo
Copy link
Member

/lgtm

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: janetkuo, mortent

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 Aug 23, 2018
@mortent
Copy link
Member Author

mortent commented Aug 23, 2018

/retest

@k8s-github-robot
Copy link

/test all [submit-queue is verifying that this PR is safe to merge]

@k8s-github-robot
Copy link

Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions here.

@k8s-github-robot k8s-github-robot merged commit 47ea5ea into kubernetes:master Aug 24, 2018
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. 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. 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/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants