mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-11 21:12:07 +00:00
Merge pull request #59817 from shyamjvs/add-retries-to-node-create-util-function
Automatic merge from submit-queue (batch tested with PRs 59800, 59817, 59711). 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>. Add retries to PrepareNodes utility function Fixes https://github.com/kubernetes/kubernetes/issues/59815 /cc @wojtek-t ```release-note NONE ```
This commit is contained in:
commit
a0bdf35ac2
@ -5074,7 +5074,7 @@ func DumpDebugInfo(c clientset.Interface, ns string) {
|
||||
}
|
||||
|
||||
func IsRetryableAPIError(err error) bool {
|
||||
return apierrs.IsTimeout(err) || apierrs.IsServerTimeout(err) || apierrs.IsTooManyRequests(err) || apierrs.IsInternalError(err)
|
||||
return apierrs.IsTimeout(err) || apierrs.IsServerTimeout(err) || apierrs.IsTooManyRequests(err)
|
||||
}
|
||||
|
||||
// DsFromManifest reads a .json/yaml file and returns the daemonset in it.
|
||||
|
@ -73,7 +73,14 @@ func (p *IntegrationTestNodePreparer) PrepareNodes() error {
|
||||
},
|
||||
}
|
||||
for i := 0; i < numNodes; i++ {
|
||||
if _, err := p.client.CoreV1().Nodes().Create(baseNode); err != nil {
|
||||
var err error
|
||||
for retry := 0; retry < retries; retry++ {
|
||||
_, err = p.client.CoreV1().Nodes().Create(baseNode)
|
||||
if err == nil || !e2eframework.IsRetryableAPIError(err) {
|
||||
break
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
glog.Fatalf("Error creating node: %v", err)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user