mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-29 13:24:42 +00:00
Better error message when checking rollout status for StatefulSet with OnDelete strategy type
This commit is contained in:
parent
4cd27c3644
commit
8e497274c9
@ -105,7 +105,7 @@ func (s *DaemonSetStatusViewer) Status(namespace, name string, revision int64) (
|
|||||||
return "", false, err
|
return "", false, err
|
||||||
}
|
}
|
||||||
if daemon.Spec.UpdateStrategy.Type != appsv1.RollingUpdateDaemonSetStrategyType {
|
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.Generation <= daemon.Status.ObservedGeneration {
|
||||||
if daemon.Status.UpdatedNumberScheduled < daemon.Status.DesiredNumberScheduled {
|
if daemon.Status.UpdatedNumberScheduled < daemon.Status.DesiredNumberScheduled {
|
||||||
@ -125,8 +125,8 @@ func (s *StatefulSetStatusViewer) Status(namespace, name string, revision int64)
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return "", false, err
|
return "", false, err
|
||||||
}
|
}
|
||||||
if sts.Spec.UpdateStrategy.Type == apps.OnDeleteStatefulSetStrategyType {
|
if sts.Spec.UpdateStrategy.Type != appsv1.RollingUpdateStatefulSetStrategyType {
|
||||||
return "", true, fmt.Errorf("%s updateStrategy does not have a Status", apps.OnDeleteStatefulSetStrategyType)
|
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 {
|
if sts.Status.ObservedGeneration == 0 || sts.Generation > sts.Status.ObservedGeneration {
|
||||||
return "Waiting for statefulset spec update to be observed...\n", false, nil
|
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()
|
client := fake.NewSimpleClientset(d).Apps()
|
||||||
dsv := &DaemonSetStatusViewer{c: client}
|
dsv := &DaemonSetStatusViewer{c: client}
|
||||||
msg, done, err := dsv.Status("bar", "foo", 0)
|
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 {
|
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)
|
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
Block a user