diff --git a/go.mod b/go.mod index 490d5b4f..e8cb1e41 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,7 @@ require ( github.com/coreos/prometheus-operator v0.33.0 github.com/knative/pkg v0.0.0-20190817231834-12ee58e32cc8 github.com/pkg/errors v0.8.1 - github.com/rancher/norman v0.0.0-20190930164704-e09204b63081 + github.com/rancher/norman v0.0.0-20191002173122-b1eb20740eab github.com/sirupsen/logrus v1.4.2 golang.org/x/tools v0.0.0-20190926165942-a8d5d34286bd // indirect k8s.io/api v0.0.0-20190918155943-95b840bb6a1f diff --git a/go.sum b/go.sum index c77afc16..4288f5b1 100644 --- a/go.sum +++ b/go.sum @@ -402,8 +402,8 @@ github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40T github.com/prometheus/tsdb v0.8.0/go.mod h1:fSI0j+IUQrDd7+ZtR9WKIGtoYAYAJUKcKhYLG25tN4g= github.com/rancher/moq v0.0.0-20190404221404-ee5226d43009 h1:Xsxh7fX3+2wAUJtPy8g2lZh0cYuyifqhBL0vxCIYojs= github.com/rancher/moq v0.0.0-20190404221404-ee5226d43009/go.mod h1:wpITyDPTi/Na5h73XkbuEf2AP9fbgrIGqqxVzFhYD6U= -github.com/rancher/norman v0.0.0-20190930164704-e09204b63081 h1:t0Yq2Rm0PdPkhY5AfHjtoyKEbt0bhYk4Jya27EfJk5Q= -github.com/rancher/norman v0.0.0-20190930164704-e09204b63081/go.mod h1:kVWc1OyHK9decIY90IYExSHedI5a5qze7IfLiEOTmXQ= +github.com/rancher/norman v0.0.0-20191002173122-b1eb20740eab h1:HtVMv6yfnH3t0ImfFAcb7LuIG7IQe+GTgzefLI9vYWA= +github.com/rancher/norman v0.0.0-20191002173122-b1eb20740eab/go.mod h1:kVWc1OyHK9decIY90IYExSHedI5a5qze7IfLiEOTmXQ= github.com/rancher/pkg v0.0.0-20190514055449-b30ab9de040e h1:j6+HqCET/NLPBtew2m5apL7jWw/PStQ7iGwXjgAqdvo= github.com/rancher/pkg v0.0.0-20190514055449-b30ab9de040e/go.mod h1:XbYHTPaXuw8ZY9bylhYKQh/nJxDaTKk3YhAxPl4Qy/k= github.com/rancher/wrangler v0.1.5 h1:HiXOeP6Kci2DK+e04D1g6INT77xAYpAr54zmTTe0Spk= diff --git a/vendor/github.com/rancher/norman/store/proxy/proxy_store.go b/vendor/github.com/rancher/norman/store/proxy/proxy_store.go index 26b451ba..3624e1a8 100644 --- a/vendor/github.com/rancher/norman/store/proxy/proxy_store.go +++ b/vendor/github.com/rancher/norman/store/proxy/proxy_store.go @@ -303,7 +303,7 @@ func (s *Store) realWatch(apiContext *types.APIContext, schema *types.Schema, op framer := json.Framer.NewFrameReader(body) decoder := streaming.NewDecoder(framer, &unstructuredDecoder{}) - watcher := watch.NewStreamWatcher(restclientwatch.NewDecoder(decoder, &unstructuredDecoder{}), errors.NewClientErrorReporter(http.StatusInternalServerError, "watch", "ClientWatchDecoding")) + watcher := watch.NewStreamWatcher(restclientwatch.NewDecoder(decoder, &unstructuredDecoder{}), &errorReporter{}) watchingContext, cancelWatchingContext := context.WithCancel(apiContext.Request.Context()) go func() { @@ -315,12 +315,17 @@ func (s *Store) realWatch(apiContext *types.APIContext, schema *types.Schema, op result := make(chan map[string]interface{}) go func() { for event := range watcher.ResultChan() { - data := event.Object.(*unstructured.Unstructured) - s.fromInternal(apiContext, schema, data.Object) - if event.Type == watch.Deleted && data.Object != nil { - data.Object[".removed"] = true + if data, ok := event.Object.(*metav1.Status); ok { + // just logging it, keeping the same behavior as before + logrus.Errorf("watcher error %v", data) + } else { + data := event.Object.(*unstructured.Unstructured) + s.fromInternal(apiContext, schema, data.Object) + if event.Type == watch.Deleted && data.Object != nil { + data.Object[".removed"] = true + } + result <- data.Object } - result <- data.Object } logrus.Debugf("closing watcher for %s", schema.ID) close(result) @@ -333,6 +338,13 @@ func (s *Store) realWatch(apiContext *types.APIContext, schema *types.Schema, op type unstructuredDecoder struct { } +type errorReporter struct { +} + +func (e *errorReporter) AsObject(err error) runtime.Object { + return &metav1.Status{Message: err.Error(), Code: http.StatusInternalServerError, Reason: "ClientWatchDecoding"} +} + func (d *unstructuredDecoder) Decode(data []byte, defaults *schema.GroupVersionKind, into runtime.Object) (runtime.Object, *schema.GroupVersionKind, error) { if into == nil { into = &unstructured.Unstructured{} diff --git a/vendor/modules.txt b/vendor/modules.txt index 684d2dc0..a4e265e9 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -84,7 +84,7 @@ github.com/prometheus/procfs github.com/prometheus/procfs/nfs github.com/prometheus/procfs/xfs github.com/prometheus/procfs/internal/util -# github.com/rancher/norman v0.0.0-20190930164704-e09204b63081 +# github.com/rancher/norman v0.0.0-20191002173122-b1eb20740eab github.com/rancher/norman/controller github.com/rancher/norman/lifecycle github.com/rancher/norman/objectclient