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

Kubernetes-commit: 93f62dad6c58bb41c396c48f54c0a73830779599
This commit is contained in:
Ryan Phillips 2020-03-20 14:43:33 -05:00 committed by Kubernetes Publisher
parent a3b5bebee7
commit de06b92a12
1 changed files with 3 additions and 0 deletions

View File

@ -277,6 +277,9 @@ func (d *Helper) evictPods(pods []corev1.Pod, policyGroupVersion string, getPodF
} 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)
time.Sleep(5 * time.Second)
} else if apierrors.IsForbidden(err) {
// an eviction request in a deleting namespace will throw a forbidden error
break
} else {
returnCh <- fmt.Errorf("error when evicting pods/%q -n %q: %v", pod.Name, pod.Namespace, err)
return