Merge pull request #61002 from FengyunPan2/fix-isNotFound

Automatic merge from submit-queue (batch tested with PRs 60898, 60912, 60753, 61002, 60796). 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>.

IsNotFound should check ErrDefault404 and ErrUnexpectedResponseCode

Related to: #60658 #60976
Refer to:
 https://github.com/gophercloud/gophercloud/pull/103/files#diff-e8ad71423a1527851f282515739eecc2R265

**Release note**:
```release-note
NONE
```
pull/8/head
Kubernetes Submit Queue 2018-03-20 17:37:17 -07:00 committed by GitHub
commit e3ac40264f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 2 deletions

View File

@ -602,8 +602,17 @@ func (os *OpenStack) LoadBalancer() (cloudprovider.LoadBalancer, bool) {
}
func isNotFound(err error) bool {
e, ok := err.(*gophercloud.ErrUnexpectedResponseCode)
return ok && e.Actual == http.StatusNotFound
if _, ok := err.(gophercloud.ErrDefault404); ok {
return true
}
if errCode, ok := err.(gophercloud.ErrUnexpectedResponseCode); ok {
if errCode.Actual == http.StatusNotFound {
return true
}
}
return false
}
// Zones indicates that we support zones