mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-31 23:37:01 +00:00
Merge pull request #120405 from Rei1010/introduceNewMethod
using wait.Interrupted instead of deprecated wait.ErrWaitTimeout for apps
This commit is contained in:
commit
ed552363c3
@ -105,7 +105,7 @@ func updateDaemonSetWithRetries(ctx context.Context, c clientset.Interface, name
|
||||
updateErr = err
|
||||
return false, nil
|
||||
})
|
||||
if pollErr == wait.ErrWaitTimeout {
|
||||
if wait.Interrupted(pollErr) {
|
||||
pollErr = fmt.Errorf("couldn't apply the provided updated to DaemonSet %q: %v", name, updateErr)
|
||||
}
|
||||
return ds, pollErr
|
||||
|
@ -1549,7 +1549,7 @@ func watchRecreateDeployment(ctx context.Context, c clientset.Interface, d *apps
|
||||
ctxUntil, cancel := context.WithTimeout(ctx, 2*time.Minute)
|
||||
defer cancel()
|
||||
_, err := watchtools.Until(ctxUntil, d.ResourceVersion, w, condition)
|
||||
if err == wait.ErrWaitTimeout {
|
||||
if wait.Interrupted(err) {
|
||||
err = fmt.Errorf("deployment %q never completed: %#v", d.Name, status)
|
||||
}
|
||||
return err
|
||||
@ -1573,7 +1573,7 @@ func waitForDeploymentOldRSsNum(ctx context.Context, c clientset.Interface, ns,
|
||||
}
|
||||
return len(oldRSs) == desiredRSNum, nil
|
||||
})
|
||||
if pollErr == wait.ErrWaitTimeout {
|
||||
if wait.Interrupted(pollErr) {
|
||||
pollErr = fmt.Errorf("%d old replica sets were not cleaned up for deployment %q", len(oldRSs)-desiredRSNum, deploymentName)
|
||||
testutil.LogReplicaSetsOfDeployment(d, oldRSs, nil, framework.Logf)
|
||||
}
|
||||
@ -1590,7 +1590,7 @@ func waitForReplicaSetDesiredReplicas(ctx context.Context, rsClient appsclient.R
|
||||
}
|
||||
return rs.Status.ObservedGeneration >= desiredGeneration && rs.Status.Replicas == *(replicaSet.Spec.Replicas) && rs.Status.Replicas == *(rs.Spec.Replicas), nil
|
||||
})
|
||||
if err == wait.ErrWaitTimeout {
|
||||
if wait.Interrupted(err) {
|
||||
err = fmt.Errorf("replicaset %q never had desired number of replicas", replicaSet.Name)
|
||||
}
|
||||
return err
|
||||
@ -1606,7 +1606,7 @@ func waitForReplicaSetTargetSpecReplicas(ctx context.Context, c clientset.Interf
|
||||
}
|
||||
return rs.Status.ObservedGeneration >= desiredGeneration && *rs.Spec.Replicas == targetReplicaNum, nil
|
||||
})
|
||||
if err == wait.ErrWaitTimeout {
|
||||
if wait.Interrupted(err) {
|
||||
err = fmt.Errorf("replicaset %q never had desired number of .spec.replicas", replicaSet.Name)
|
||||
}
|
||||
return err
|
||||
|
@ -19,6 +19,7 @@ package apps
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"time"
|
||||
@ -286,7 +287,7 @@ var _ = SIGDescribe("Job", func() {
|
||||
return false, err
|
||||
}
|
||||
return len(pods.Items) > 0, nil
|
||||
}), wait.ErrWaitTimeout)
|
||||
}), wait.ErrorInterrupted(errors.New("timed out waiting for the condition")))
|
||||
|
||||
ginkgo.By("Checking Job status to observe Suspended state")
|
||||
job, err = e2ejob.GetJob(ctx, f.ClientSet, f.Namespace.Name, job.Name)
|
||||
|
@ -19,6 +19,7 @@ package apps
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
@ -554,7 +555,7 @@ func testReplicationControllerConditionCheck(ctx context.Context, f *framework.F
|
||||
quantity := resource.MustParse("2")
|
||||
return (&podQuota).Cmp(quantity) == 0, nil
|
||||
})
|
||||
if err == wait.ErrWaitTimeout {
|
||||
if wait.Interrupted(err) {
|
||||
err = fmt.Errorf("resource quota %q never synced", name)
|
||||
}
|
||||
framework.ExpectNoError(err)
|
||||
@ -581,7 +582,7 @@ func testReplicationControllerConditionCheck(ctx context.Context, f *framework.F
|
||||
cond := replication.GetCondition(rc.Status, v1.ReplicationControllerReplicaFailure)
|
||||
return cond != nil, nil
|
||||
})
|
||||
if err == wait.ErrWaitTimeout {
|
||||
if wait.Interrupted(err) {
|
||||
err = fmt.Errorf("rc manager never added the failure condition for rc %q: %#v", name, conditions)
|
||||
}
|
||||
framework.ExpectNoError(err)
|
||||
@ -610,7 +611,7 @@ func testReplicationControllerConditionCheck(ctx context.Context, f *framework.F
|
||||
cond := replication.GetCondition(rc.Status, v1.ReplicationControllerReplicaFailure)
|
||||
return cond == nil, nil
|
||||
})
|
||||
if err == wait.ErrWaitTimeout {
|
||||
if wait.Interrupted(err) {
|
||||
err = fmt.Errorf("rc manager never removed the failure condition for rc %q: %#v", name, conditions)
|
||||
}
|
||||
framework.ExpectNoError(err)
|
||||
@ -732,7 +733,7 @@ func updateReplicationControllerWithRetries(ctx context.Context, c clientset.Int
|
||||
updateErr = err
|
||||
return false, nil
|
||||
})
|
||||
if pollErr == wait.ErrWaitTimeout {
|
||||
if wait.Interrupted(pollErr) {
|
||||
pollErr = fmt.Errorf("couldn't apply the provided updated to rc %q: %v", name, updateErr)
|
||||
}
|
||||
return rc, pollErr
|
||||
@ -778,7 +779,7 @@ func watchUntilWithoutRetry(ctx context.Context, watcher watch.Interface, condit
|
||||
}
|
||||
|
||||
case <-ctx.Done():
|
||||
return lastEvent, wait.ErrWaitTimeout
|
||||
return lastEvent, wait.ErrorInterrupted(errors.New("timed out waiting for the condition"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -251,7 +251,7 @@ func testReplicaSetConditionCheck(ctx context.Context, f *framework.Framework) {
|
||||
podQuota := quota.Status.Hard[v1.ResourcePods]
|
||||
return (&podQuota).Cmp(quantity) == 0, nil
|
||||
})
|
||||
if err == wait.ErrWaitTimeout {
|
||||
if wait.Interrupted(err) {
|
||||
err = fmt.Errorf("resource quota %q never synced", name)
|
||||
}
|
||||
framework.ExpectNoError(err)
|
||||
@ -279,7 +279,7 @@ func testReplicaSetConditionCheck(ctx context.Context, f *framework.Framework) {
|
||||
return cond != nil, nil
|
||||
|
||||
})
|
||||
if err == wait.ErrWaitTimeout {
|
||||
if wait.Interrupted(err) {
|
||||
err = fmt.Errorf("rs controller never added the failure condition for replica set %q: %#v", name, conditions)
|
||||
}
|
||||
framework.ExpectNoError(err)
|
||||
@ -308,7 +308,7 @@ func testReplicaSetConditionCheck(ctx context.Context, f *framework.Framework) {
|
||||
cond := replicaset.GetCondition(rs.Status, appsv1.ReplicaSetReplicaFailure)
|
||||
return cond == nil, nil
|
||||
})
|
||||
if err == wait.ErrWaitTimeout {
|
||||
if wait.Interrupted(err) {
|
||||
err = fmt.Errorf("rs controller never removed the failure condition for rs %q: %#v", name, conditions)
|
||||
}
|
||||
framework.ExpectNoError(err)
|
||||
|
@ -1836,7 +1836,7 @@ func pollReadWithTimeout(ctx context.Context, statefulPod statefulPodTester, sta
|
||||
return true, nil
|
||||
})
|
||||
|
||||
if err == wait.ErrWaitTimeout {
|
||||
if wait.Interrupted(err) {
|
||||
return fmt.Errorf("timed out when trying to read value for key %v from stateful pod %d", key, statefulPodNumber)
|
||||
}
|
||||
return err
|
||||
@ -2058,7 +2058,7 @@ func updateStatefulSetWithRetries(ctx context.Context, c clientset.Interface, na
|
||||
updateErr = err
|
||||
return false, nil
|
||||
})
|
||||
if pollErr == wait.ErrWaitTimeout {
|
||||
if wait.Interrupted(pollErr) {
|
||||
pollErr = fmt.Errorf("couldn't apply the provided updated to stateful set %q: %v", name, updateErr)
|
||||
}
|
||||
return statefulSet, pollErr
|
||||
|
@ -139,7 +139,7 @@ func updateJobWithRetries(ctx context.Context, c clientset.Interface, namespace,
|
||||
updateErr = err
|
||||
return false, nil
|
||||
})
|
||||
if pollErr == wait.ErrWaitTimeout {
|
||||
if wait.Interrupted(pollErr) {
|
||||
pollErr = fmt.Errorf("couldn't apply the provided updated to job %q: %v", name, updateErr)
|
||||
}
|
||||
return job, pollErr
|
||||
|
Loading…
Reference in New Issue
Block a user