mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-05 02:09:56 +00:00
drain: eviction creates in a deleting namespace will throw a forbidden error
we can safely ignore this error since a deleting namespace will delete all pods
This commit is contained in:
parent
d159ae3545
commit
93f62dad6c
@ -277,6 +277,9 @@ func (d *Helper) evictPods(pods []corev1.Pod, policyGroupVersion string, getPodF
|
|||||||
} else if apierrors.IsTooManyRequests(err) {
|
} else if apierrors.IsTooManyRequests(err) {
|
||||||
fmt.Fprintf(d.ErrOut, "error when evicting pods/%q -n %q (will retry after 5s): %v\n", pod.Name, pod.Namespace, err)
|
fmt.Fprintf(d.ErrOut, "error when evicting pods/%q -n %q (will retry after 5s): %v\n", pod.Name, pod.Namespace, err)
|
||||||
time.Sleep(5 * time.Second)
|
time.Sleep(5 * time.Second)
|
||||||
|
} else if apierrors.IsForbidden(err) {
|
||||||
|
// an eviction request in a deleting namespace will throw a forbidden error
|
||||||
|
break
|
||||||
} else {
|
} else {
|
||||||
returnCh <- fmt.Errorf("error when evicting pods/%q -n %q: %v", pod.Name, pod.Namespace, err)
|
returnCh <- fmt.Errorf("error when evicting pods/%q -n %q: %v", pod.Name, pod.Namespace, err)
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user