Merge pull request #75167 from tnozicka/fix-retry-watcher-error

Handle unstructured status in RetryWatcher

Kubernetes-commit: 44e369b000fa9c194b5fda142a9d3f62172f27f6
This commit is contained in:
Kubernetes Publisher 2019-03-11 05:17:27 -07:00
commit 191b4b1228
2 changed files with 57 additions and 53 deletions

104
Godeps/Godeps.json generated
View File

@ -1,6 +1,6 @@
{ {
"ImportPath": "k8s.io/client-go", "ImportPath": "k8s.io/client-go",
"GoVersion": "go1.11", "GoVersion": "go1.12",
"GodepVersion": "v80", "GodepVersion": "v80",
"Packages": [ "Packages": [
"./..." "./..."
@ -420,207 +420,207 @@
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/api/apitesting", "ImportPath": "k8s.io/apimachinery/pkg/api/apitesting",
"Rev": "bb74a2916ecf26bf9ac05cfaf449cf07c8763ea3" "Rev": "b6b933fb33e6417ac62475c4fb6df675959f9b0a"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/api/apitesting/fuzzer", "ImportPath": "k8s.io/apimachinery/pkg/api/apitesting/fuzzer",
"Rev": "bb74a2916ecf26bf9ac05cfaf449cf07c8763ea3" "Rev": "b6b933fb33e6417ac62475c4fb6df675959f9b0a"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/api/apitesting/roundtrip", "ImportPath": "k8s.io/apimachinery/pkg/api/apitesting/roundtrip",
"Rev": "bb74a2916ecf26bf9ac05cfaf449cf07c8763ea3" "Rev": "b6b933fb33e6417ac62475c4fb6df675959f9b0a"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/api/equality", "ImportPath": "k8s.io/apimachinery/pkg/api/equality",
"Rev": "bb74a2916ecf26bf9ac05cfaf449cf07c8763ea3" "Rev": "b6b933fb33e6417ac62475c4fb6df675959f9b0a"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/api/errors", "ImportPath": "k8s.io/apimachinery/pkg/api/errors",
"Rev": "bb74a2916ecf26bf9ac05cfaf449cf07c8763ea3" "Rev": "b6b933fb33e6417ac62475c4fb6df675959f9b0a"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/api/meta", "ImportPath": "k8s.io/apimachinery/pkg/api/meta",
"Rev": "bb74a2916ecf26bf9ac05cfaf449cf07c8763ea3" "Rev": "b6b933fb33e6417ac62475c4fb6df675959f9b0a"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/api/resource", "ImportPath": "k8s.io/apimachinery/pkg/api/resource",
"Rev": "bb74a2916ecf26bf9ac05cfaf449cf07c8763ea3" "Rev": "b6b933fb33e6417ac62475c4fb6df675959f9b0a"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/fuzzer", "ImportPath": "k8s.io/apimachinery/pkg/apis/meta/fuzzer",
"Rev": "bb74a2916ecf26bf9ac05cfaf449cf07c8763ea3" "Rev": "b6b933fb33e6417ac62475c4fb6df675959f9b0a"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/internalversion", "ImportPath": "k8s.io/apimachinery/pkg/apis/meta/internalversion",
"Rev": "bb74a2916ecf26bf9ac05cfaf449cf07c8763ea3" "Rev": "b6b933fb33e6417ac62475c4fb6df675959f9b0a"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1", "ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1",
"Rev": "bb74a2916ecf26bf9ac05cfaf449cf07c8763ea3" "Rev": "b6b933fb33e6417ac62475c4fb6df675959f9b0a"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured", "ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured",
"Rev": "bb74a2916ecf26bf9ac05cfaf449cf07c8763ea3" "Rev": "b6b933fb33e6417ac62475c4fb6df675959f9b0a"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1beta1", "ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1beta1",
"Rev": "bb74a2916ecf26bf9ac05cfaf449cf07c8763ea3" "Rev": "b6b933fb33e6417ac62475c4fb6df675959f9b0a"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/conversion", "ImportPath": "k8s.io/apimachinery/pkg/conversion",
"Rev": "bb74a2916ecf26bf9ac05cfaf449cf07c8763ea3" "Rev": "b6b933fb33e6417ac62475c4fb6df675959f9b0a"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/conversion/queryparams", "ImportPath": "k8s.io/apimachinery/pkg/conversion/queryparams",
"Rev": "bb74a2916ecf26bf9ac05cfaf449cf07c8763ea3" "Rev": "b6b933fb33e6417ac62475c4fb6df675959f9b0a"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/fields", "ImportPath": "k8s.io/apimachinery/pkg/fields",
"Rev": "bb74a2916ecf26bf9ac05cfaf449cf07c8763ea3" "Rev": "b6b933fb33e6417ac62475c4fb6df675959f9b0a"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/labels", "ImportPath": "k8s.io/apimachinery/pkg/labels",
"Rev": "bb74a2916ecf26bf9ac05cfaf449cf07c8763ea3" "Rev": "b6b933fb33e6417ac62475c4fb6df675959f9b0a"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/runtime", "ImportPath": "k8s.io/apimachinery/pkg/runtime",
"Rev": "bb74a2916ecf26bf9ac05cfaf449cf07c8763ea3" "Rev": "b6b933fb33e6417ac62475c4fb6df675959f9b0a"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/runtime/schema", "ImportPath": "k8s.io/apimachinery/pkg/runtime/schema",
"Rev": "bb74a2916ecf26bf9ac05cfaf449cf07c8763ea3" "Rev": "b6b933fb33e6417ac62475c4fb6df675959f9b0a"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer", "ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer",
"Rev": "bb74a2916ecf26bf9ac05cfaf449cf07c8763ea3" "Rev": "b6b933fb33e6417ac62475c4fb6df675959f9b0a"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/json", "ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/json",
"Rev": "bb74a2916ecf26bf9ac05cfaf449cf07c8763ea3" "Rev": "b6b933fb33e6417ac62475c4fb6df675959f9b0a"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/protobuf", "ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/protobuf",
"Rev": "bb74a2916ecf26bf9ac05cfaf449cf07c8763ea3" "Rev": "b6b933fb33e6417ac62475c4fb6df675959f9b0a"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/recognizer", "ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/recognizer",
"Rev": "bb74a2916ecf26bf9ac05cfaf449cf07c8763ea3" "Rev": "b6b933fb33e6417ac62475c4fb6df675959f9b0a"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/streaming", "ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/streaming",
"Rev": "bb74a2916ecf26bf9ac05cfaf449cf07c8763ea3" "Rev": "b6b933fb33e6417ac62475c4fb6df675959f9b0a"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/versioning", "ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/versioning",
"Rev": "bb74a2916ecf26bf9ac05cfaf449cf07c8763ea3" "Rev": "b6b933fb33e6417ac62475c4fb6df675959f9b0a"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/selection", "ImportPath": "k8s.io/apimachinery/pkg/selection",
"Rev": "bb74a2916ecf26bf9ac05cfaf449cf07c8763ea3" "Rev": "b6b933fb33e6417ac62475c4fb6df675959f9b0a"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/types", "ImportPath": "k8s.io/apimachinery/pkg/types",
"Rev": "bb74a2916ecf26bf9ac05cfaf449cf07c8763ea3" "Rev": "b6b933fb33e6417ac62475c4fb6df675959f9b0a"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/cache", "ImportPath": "k8s.io/apimachinery/pkg/util/cache",
"Rev": "bb74a2916ecf26bf9ac05cfaf449cf07c8763ea3" "Rev": "b6b933fb33e6417ac62475c4fb6df675959f9b0a"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/clock", "ImportPath": "k8s.io/apimachinery/pkg/util/clock",
"Rev": "bb74a2916ecf26bf9ac05cfaf449cf07c8763ea3" "Rev": "b6b933fb33e6417ac62475c4fb6df675959f9b0a"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/diff", "ImportPath": "k8s.io/apimachinery/pkg/util/diff",
"Rev": "bb74a2916ecf26bf9ac05cfaf449cf07c8763ea3" "Rev": "b6b933fb33e6417ac62475c4fb6df675959f9b0a"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/errors", "ImportPath": "k8s.io/apimachinery/pkg/util/errors",
"Rev": "bb74a2916ecf26bf9ac05cfaf449cf07c8763ea3" "Rev": "b6b933fb33e6417ac62475c4fb6df675959f9b0a"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/framer", "ImportPath": "k8s.io/apimachinery/pkg/util/framer",
"Rev": "bb74a2916ecf26bf9ac05cfaf449cf07c8763ea3" "Rev": "b6b933fb33e6417ac62475c4fb6df675959f9b0a"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/httpstream", "ImportPath": "k8s.io/apimachinery/pkg/util/httpstream",
"Rev": "bb74a2916ecf26bf9ac05cfaf449cf07c8763ea3" "Rev": "b6b933fb33e6417ac62475c4fb6df675959f9b0a"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/httpstream/spdy", "ImportPath": "k8s.io/apimachinery/pkg/util/httpstream/spdy",
"Rev": "bb74a2916ecf26bf9ac05cfaf449cf07c8763ea3" "Rev": "b6b933fb33e6417ac62475c4fb6df675959f9b0a"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/intstr", "ImportPath": "k8s.io/apimachinery/pkg/util/intstr",
"Rev": "bb74a2916ecf26bf9ac05cfaf449cf07c8763ea3" "Rev": "b6b933fb33e6417ac62475c4fb6df675959f9b0a"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/json", "ImportPath": "k8s.io/apimachinery/pkg/util/json",
"Rev": "bb74a2916ecf26bf9ac05cfaf449cf07c8763ea3" "Rev": "b6b933fb33e6417ac62475c4fb6df675959f9b0a"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/mergepatch", "ImportPath": "k8s.io/apimachinery/pkg/util/mergepatch",
"Rev": "bb74a2916ecf26bf9ac05cfaf449cf07c8763ea3" "Rev": "b6b933fb33e6417ac62475c4fb6df675959f9b0a"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/naming", "ImportPath": "k8s.io/apimachinery/pkg/util/naming",
"Rev": "bb74a2916ecf26bf9ac05cfaf449cf07c8763ea3" "Rev": "b6b933fb33e6417ac62475c4fb6df675959f9b0a"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/net", "ImportPath": "k8s.io/apimachinery/pkg/util/net",
"Rev": "bb74a2916ecf26bf9ac05cfaf449cf07c8763ea3" "Rev": "b6b933fb33e6417ac62475c4fb6df675959f9b0a"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/remotecommand", "ImportPath": "k8s.io/apimachinery/pkg/util/remotecommand",
"Rev": "bb74a2916ecf26bf9ac05cfaf449cf07c8763ea3" "Rev": "b6b933fb33e6417ac62475c4fb6df675959f9b0a"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/runtime", "ImportPath": "k8s.io/apimachinery/pkg/util/runtime",
"Rev": "bb74a2916ecf26bf9ac05cfaf449cf07c8763ea3" "Rev": "b6b933fb33e6417ac62475c4fb6df675959f9b0a"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/sets", "ImportPath": "k8s.io/apimachinery/pkg/util/sets",
"Rev": "bb74a2916ecf26bf9ac05cfaf449cf07c8763ea3" "Rev": "b6b933fb33e6417ac62475c4fb6df675959f9b0a"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/strategicpatch", "ImportPath": "k8s.io/apimachinery/pkg/util/strategicpatch",
"Rev": "bb74a2916ecf26bf9ac05cfaf449cf07c8763ea3" "Rev": "b6b933fb33e6417ac62475c4fb6df675959f9b0a"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/validation", "ImportPath": "k8s.io/apimachinery/pkg/util/validation",
"Rev": "bb74a2916ecf26bf9ac05cfaf449cf07c8763ea3" "Rev": "b6b933fb33e6417ac62475c4fb6df675959f9b0a"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/validation/field", "ImportPath": "k8s.io/apimachinery/pkg/util/validation/field",
"Rev": "bb74a2916ecf26bf9ac05cfaf449cf07c8763ea3" "Rev": "b6b933fb33e6417ac62475c4fb6df675959f9b0a"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/wait", "ImportPath": "k8s.io/apimachinery/pkg/util/wait",
"Rev": "bb74a2916ecf26bf9ac05cfaf449cf07c8763ea3" "Rev": "b6b933fb33e6417ac62475c4fb6df675959f9b0a"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/yaml", "ImportPath": "k8s.io/apimachinery/pkg/util/yaml",
"Rev": "bb74a2916ecf26bf9ac05cfaf449cf07c8763ea3" "Rev": "b6b933fb33e6417ac62475c4fb6df675959f9b0a"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/version", "ImportPath": "k8s.io/apimachinery/pkg/version",
"Rev": "bb74a2916ecf26bf9ac05cfaf449cf07c8763ea3" "Rev": "b6b933fb33e6417ac62475c4fb6df675959f9b0a"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/watch", "ImportPath": "k8s.io/apimachinery/pkg/watch",
"Rev": "bb74a2916ecf26bf9ac05cfaf449cf07c8763ea3" "Rev": "b6b933fb33e6417ac62475c4fb6df675959f9b0a"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/third_party/forked/golang/json", "ImportPath": "k8s.io/apimachinery/third_party/forked/golang/json",
"Rev": "bb74a2916ecf26bf9ac05cfaf449cf07c8763ea3" "Rev": "b6b933fb33e6417ac62475c4fb6df675959f9b0a"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/third_party/forked/golang/netutil", "ImportPath": "k8s.io/apimachinery/third_party/forked/golang/netutil",
"Rev": "bb74a2916ecf26bf9ac05cfaf449cf07c8763ea3" "Rev": "b6b933fb33e6417ac62475c4fb6df675959f9b0a"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/third_party/forked/golang/reflect", "ImportPath": "k8s.io/apimachinery/third_party/forked/golang/reflect",
"Rev": "bb74a2916ecf26bf9ac05cfaf449cf07c8763ea3" "Rev": "b6b933fb33e6417ac62475c4fb6df675959f9b0a"
}, },
{ {
"ImportPath": "k8s.io/klog", "ImportPath": "k8s.io/klog",

View File

@ -184,13 +184,17 @@ func (rw *RetryWatcher) doReceive() (bool, time.Duration) {
continue continue
case watch.Error: case watch.Error:
status, ok := event.Object.(*metav1.Status) // This round trip allows us to handle unstructured status
errObject := apierrors.FromObject(event.Object)
statusErr, ok := errObject.(*apierrors.StatusError)
if !ok { if !ok {
klog.Error(spew.Sprintf("Received an error which is not *metav1.Status but %#+v", event.Object)) klog.Error(spew.Sprintf("Received an error which is not *metav1.Status but %#+v", event.Object))
// Retry unknown errors // Retry unknown errors
return false, 0 return false, 0
} }
status := statusErr.ErrStatus
statusDelay := time.Duration(0) statusDelay := time.Duration(0)
if status.Details != nil { if status.Details != nil {
statusDelay = time.Duration(status.Details.RetryAfterSeconds) * time.Second statusDelay = time.Duration(status.Details.RetryAfterSeconds) * time.Second