Merge pull request #115594 from wking/included-failed-to-evict-pod-namespace
kubectl/pkg/drain: Include namespace in evictPods return error
This commit is contained in:
commit
cfa295f569
@ -315,7 +315,7 @@ func (d *Helper) evictPods(pods []corev1.Pod, evictionGroupVersion schema.GroupV
|
|||||||
} else if apierrors.IsForbidden(err) && apierrors.HasStatusCause(err, corev1.NamespaceTerminatingCause) {
|
} else if apierrors.IsForbidden(err) && apierrors.HasStatusCause(err, corev1.NamespaceTerminatingCause) {
|
||||||
// an eviction request in a deleting namespace will throw a forbidden error,
|
// an eviction request in a deleting namespace will throw a forbidden error,
|
||||||
// if the pod is not marked deleted, we retry until it is.
|
// if the pod is not marked deleted, we retry until it is.
|
||||||
fmt.Fprintf(d.ErrOut, "error when evicting pod %q (will retry after 5s): %v\n", activePod.Name, err)
|
fmt.Fprintf(d.ErrOut, "error when evicting pod %q from terminating namespace %q (will retry after 5s): %v\n", activePod.Name, activePod.Namespace, err)
|
||||||
time.Sleep(5 * time.Second)
|
time.Sleep(5 * time.Second)
|
||||||
} else {
|
} else {
|
||||||
returnCh <- fmt.Errorf("error when evicting pods/%q -n %q: %v", activePod.Name, activePod.Namespace, err)
|
returnCh <- fmt.Errorf("error when evicting pods/%q -n %q: %v", activePod.Name, activePod.Namespace, err)
|
||||||
@ -342,7 +342,7 @@ func (d *Helper) evictPods(pods []corev1.Pod, evictionGroupVersion schema.GroupV
|
|||||||
if err == nil {
|
if err == nil {
|
||||||
returnCh <- nil
|
returnCh <- nil
|
||||||
} else {
|
} else {
|
||||||
returnCh <- fmt.Errorf("error when waiting for pod %q terminating: %v", pod.Name, err)
|
returnCh <- fmt.Errorf("error when waiting for pod %q in namespace %q to terminate: %v", pod.Name, pod.Namespace, err)
|
||||||
}
|
}
|
||||||
}(pod, returnCh)
|
}(pod, returnCh)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user