Fix kubectl drain for statefulset and use eviciton for drain if possible

This commit is contained in:
ymqytw
2016-10-20 09:43:48 -07:00
parent 0c7421fb51
commit b73fae6c55
18 changed files with 548 additions and 103 deletions

View File

@@ -413,6 +413,17 @@ func IsInternalError(err error) bool {
return reasonForError(err) == unversioned.StatusReasonInternalError
}
// IsTooManyRequests determines if err is an error which indicates that there are too many requests
// that the server cannot handle.
// TODO: update IsTooManyRequests() when the TooManyRequests(429) error returned from the API server has a non-empty Reason field
func IsTooManyRequests(err error) bool {
switch t := err.(type) {
case APIStatus:
return t.Status().Code == StatusTooManyRequests
}
return false
}
// IsUnexpectedServerError returns true if the server response was not in the expected API format,
// and may be the result of another HTTP actor.
func IsUnexpectedServerError(err error) bool {