mirror of https://github.com/k3s-io/k3s
Merge pull request #66983 from mortent/BetterRolloutStatusMsgForStatefulSet
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Better error message when checking rollout status for StatefulSet wit… …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**: ```release-note Improved error message when checking the rollout status of StatefulSet with OnDelete strategy type ```pull/8/head
commit
47ea5eac71
|
@ -105,7 +105,7 @@ func (s *DaemonSetStatusViewer) Status(namespace, name string, revision int64) (
|
|||
return "", false, err
|
||||
}
|
||||
if daemon.Spec.UpdateStrategy.Type != appsv1.RollingUpdateDaemonSetStrategyType {
|
||||
return "", true, fmt.Errorf("Status is available only for RollingUpdate strategy type")
|
||||
return "", true, fmt.Errorf("rollout status is only available for %s strategy type", appsv1.RollingUpdateStatefulSetStrategyType)
|
||||
}
|
||||
if daemon.Generation <= daemon.Status.ObservedGeneration {
|
||||
if daemon.Status.UpdatedNumberScheduled < daemon.Status.DesiredNumberScheduled {
|
||||
|
@ -125,8 +125,8 @@ func (s *StatefulSetStatusViewer) Status(namespace, name string, revision int64)
|
|||
if err != nil {
|
||||
return "", false, err
|
||||
}
|
||||
if sts.Spec.UpdateStrategy.Type == apps.OnDeleteStatefulSetStrategyType {
|
||||
return "", true, fmt.Errorf("%s updateStrategy does not have a Status", apps.OnDeleteStatefulSetStrategyType)
|
||||
if sts.Spec.UpdateStrategy.Type != appsv1.RollingUpdateStatefulSetStrategyType {
|
||||
return "", true, fmt.Errorf("rollout status is only available for %s strategy type", appsv1.RollingUpdateStatefulSetStrategyType)
|
||||
}
|
||||
if sts.Status.ObservedGeneration == 0 || sts.Generation > sts.Status.ObservedGeneration {
|
||||
return "Waiting for statefulset spec update to be observed...\n", false, nil
|
||||
|
|
|
@ -405,7 +405,7 @@ func TestDaemonSetStatusViewerStatusWithWrongUpdateStrategyType(t *testing.T) {
|
|||
client := fake.NewSimpleClientset(d).Apps()
|
||||
dsv := &DaemonSetStatusViewer{c: client}
|
||||
msg, done, err := dsv.Status("bar", "foo", 0)
|
||||
errMsg := "Status is available only for RollingUpdate strategy type"
|
||||
errMsg := "rollout status is only available for RollingUpdate strategy type"
|
||||
if err == nil || err.Error() != errMsg {
|
||||
t.Errorf("Status for daemon sets with UpdateStrategy type different than RollingUpdate should return error. Instead got: msg: %s\ndone: %t\n err: %v", msg, done, err)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue