Merge pull request #63698 from rajatjindal/fix-eviction-errormsg

Automatic merge from submit-queue (batch tested with PRs 65230, 57355, 59174, 63698, 63659). 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 msg when getting toomanyrequest error from evict pod

**What this PR does / why we need it**:

When Pod Disruption Budget prevents eviction of pods, the error msg is not exposed to the user

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #

Fixes https://github.com/kubernetes/kops/issues/5066

**Special notes for your reviewer**:

Multiple people reported hung cluster update due to this issue, its confusing for them as the error msg is not exposed. 

**Release note**:

```release-note
NONE
```
pull/8/head
Kubernetes Submit Queue 2018-06-19 20:19:21 -07:00 committed by GitHub
commit c46a667fac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 0 deletions

View File

@ -586,6 +586,7 @@ func (o *DrainOptions) evictPods(pods []corev1.Pod, policyGroupVersion string, g
doneCh <- true
return
} else if apierrors.IsTooManyRequests(err) {
fmt.Fprintf(o.ErrOut, "error when evicting pod %q (will retry after 5s): %v\n", pod.Name, err)
time.Sleep(5 * time.Second)
} else {
errCh <- fmt.Errorf("error when evicting pod %q: %v", pod.Name, err)