Merge pull request #67024 from juanvallejo/jvallejo/add-cancel-req-discovery-rt

Automatic merge from submit-queue (batch tested with PRs 66958, 67024). 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 CancelRequest to discovery round-tripper

**Release note**:
```release-note
NONE
```

Make discovery roundtripper implement the RequestCanceler interface

cc @deads2k

Kubernetes-commit: a945b5d9281ac5cba5e4a2976a0747592c0cff87
This commit is contained in:
Kubernetes Publisher 2018-08-06 13:41:03 -07:00
commit bdfc4cfc12
2 changed files with 63 additions and 51 deletions

102
Godeps/Godeps.json generated
View File

@ -396,207 +396,207 @@
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/api/apitesting", "ImportPath": "k8s.io/apimachinery/pkg/api/apitesting",
"Rev": "085ff9770270458ad7d899f2338e193c2c585d5b" "Rev": "cd53e6e3b3a5f792de51f8d95fb17f46f0627abf"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/api/apitesting/fuzzer", "ImportPath": "k8s.io/apimachinery/pkg/api/apitesting/fuzzer",
"Rev": "085ff9770270458ad7d899f2338e193c2c585d5b" "Rev": "cd53e6e3b3a5f792de51f8d95fb17f46f0627abf"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/api/apitesting/roundtrip", "ImportPath": "k8s.io/apimachinery/pkg/api/apitesting/roundtrip",
"Rev": "085ff9770270458ad7d899f2338e193c2c585d5b" "Rev": "cd53e6e3b3a5f792de51f8d95fb17f46f0627abf"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/api/equality", "ImportPath": "k8s.io/apimachinery/pkg/api/equality",
"Rev": "085ff9770270458ad7d899f2338e193c2c585d5b" "Rev": "cd53e6e3b3a5f792de51f8d95fb17f46f0627abf"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/api/errors", "ImportPath": "k8s.io/apimachinery/pkg/api/errors",
"Rev": "085ff9770270458ad7d899f2338e193c2c585d5b" "Rev": "cd53e6e3b3a5f792de51f8d95fb17f46f0627abf"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/api/meta", "ImportPath": "k8s.io/apimachinery/pkg/api/meta",
"Rev": "085ff9770270458ad7d899f2338e193c2c585d5b" "Rev": "cd53e6e3b3a5f792de51f8d95fb17f46f0627abf"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/api/resource", "ImportPath": "k8s.io/apimachinery/pkg/api/resource",
"Rev": "085ff9770270458ad7d899f2338e193c2c585d5b" "Rev": "cd53e6e3b3a5f792de51f8d95fb17f46f0627abf"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/fuzzer", "ImportPath": "k8s.io/apimachinery/pkg/apis/meta/fuzzer",
"Rev": "085ff9770270458ad7d899f2338e193c2c585d5b" "Rev": "cd53e6e3b3a5f792de51f8d95fb17f46f0627abf"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/internalversion", "ImportPath": "k8s.io/apimachinery/pkg/apis/meta/internalversion",
"Rev": "085ff9770270458ad7d899f2338e193c2c585d5b" "Rev": "cd53e6e3b3a5f792de51f8d95fb17f46f0627abf"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1", "ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1",
"Rev": "085ff9770270458ad7d899f2338e193c2c585d5b" "Rev": "cd53e6e3b3a5f792de51f8d95fb17f46f0627abf"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured", "ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured",
"Rev": "085ff9770270458ad7d899f2338e193c2c585d5b" "Rev": "cd53e6e3b3a5f792de51f8d95fb17f46f0627abf"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1beta1", "ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1beta1",
"Rev": "085ff9770270458ad7d899f2338e193c2c585d5b" "Rev": "cd53e6e3b3a5f792de51f8d95fb17f46f0627abf"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/conversion", "ImportPath": "k8s.io/apimachinery/pkg/conversion",
"Rev": "085ff9770270458ad7d899f2338e193c2c585d5b" "Rev": "cd53e6e3b3a5f792de51f8d95fb17f46f0627abf"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/conversion/queryparams", "ImportPath": "k8s.io/apimachinery/pkg/conversion/queryparams",
"Rev": "085ff9770270458ad7d899f2338e193c2c585d5b" "Rev": "cd53e6e3b3a5f792de51f8d95fb17f46f0627abf"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/fields", "ImportPath": "k8s.io/apimachinery/pkg/fields",
"Rev": "085ff9770270458ad7d899f2338e193c2c585d5b" "Rev": "cd53e6e3b3a5f792de51f8d95fb17f46f0627abf"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/labels", "ImportPath": "k8s.io/apimachinery/pkg/labels",
"Rev": "085ff9770270458ad7d899f2338e193c2c585d5b" "Rev": "cd53e6e3b3a5f792de51f8d95fb17f46f0627abf"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/runtime", "ImportPath": "k8s.io/apimachinery/pkg/runtime",
"Rev": "085ff9770270458ad7d899f2338e193c2c585d5b" "Rev": "cd53e6e3b3a5f792de51f8d95fb17f46f0627abf"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/runtime/schema", "ImportPath": "k8s.io/apimachinery/pkg/runtime/schema",
"Rev": "085ff9770270458ad7d899f2338e193c2c585d5b" "Rev": "cd53e6e3b3a5f792de51f8d95fb17f46f0627abf"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer", "ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer",
"Rev": "085ff9770270458ad7d899f2338e193c2c585d5b" "Rev": "cd53e6e3b3a5f792de51f8d95fb17f46f0627abf"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/json", "ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/json",
"Rev": "085ff9770270458ad7d899f2338e193c2c585d5b" "Rev": "cd53e6e3b3a5f792de51f8d95fb17f46f0627abf"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/protobuf", "ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/protobuf",
"Rev": "085ff9770270458ad7d899f2338e193c2c585d5b" "Rev": "cd53e6e3b3a5f792de51f8d95fb17f46f0627abf"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/recognizer", "ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/recognizer",
"Rev": "085ff9770270458ad7d899f2338e193c2c585d5b" "Rev": "cd53e6e3b3a5f792de51f8d95fb17f46f0627abf"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/streaming", "ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/streaming",
"Rev": "085ff9770270458ad7d899f2338e193c2c585d5b" "Rev": "cd53e6e3b3a5f792de51f8d95fb17f46f0627abf"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/versioning", "ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/versioning",
"Rev": "085ff9770270458ad7d899f2338e193c2c585d5b" "Rev": "cd53e6e3b3a5f792de51f8d95fb17f46f0627abf"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/selection", "ImportPath": "k8s.io/apimachinery/pkg/selection",
"Rev": "085ff9770270458ad7d899f2338e193c2c585d5b" "Rev": "cd53e6e3b3a5f792de51f8d95fb17f46f0627abf"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/types", "ImportPath": "k8s.io/apimachinery/pkg/types",
"Rev": "085ff9770270458ad7d899f2338e193c2c585d5b" "Rev": "cd53e6e3b3a5f792de51f8d95fb17f46f0627abf"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/cache", "ImportPath": "k8s.io/apimachinery/pkg/util/cache",
"Rev": "085ff9770270458ad7d899f2338e193c2c585d5b" "Rev": "cd53e6e3b3a5f792de51f8d95fb17f46f0627abf"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/clock", "ImportPath": "k8s.io/apimachinery/pkg/util/clock",
"Rev": "085ff9770270458ad7d899f2338e193c2c585d5b" "Rev": "cd53e6e3b3a5f792de51f8d95fb17f46f0627abf"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/diff", "ImportPath": "k8s.io/apimachinery/pkg/util/diff",
"Rev": "085ff9770270458ad7d899f2338e193c2c585d5b" "Rev": "cd53e6e3b3a5f792de51f8d95fb17f46f0627abf"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/errors", "ImportPath": "k8s.io/apimachinery/pkg/util/errors",
"Rev": "085ff9770270458ad7d899f2338e193c2c585d5b" "Rev": "cd53e6e3b3a5f792de51f8d95fb17f46f0627abf"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/framer", "ImportPath": "k8s.io/apimachinery/pkg/util/framer",
"Rev": "085ff9770270458ad7d899f2338e193c2c585d5b" "Rev": "cd53e6e3b3a5f792de51f8d95fb17f46f0627abf"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/httpstream", "ImportPath": "k8s.io/apimachinery/pkg/util/httpstream",
"Rev": "085ff9770270458ad7d899f2338e193c2c585d5b" "Rev": "cd53e6e3b3a5f792de51f8d95fb17f46f0627abf"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/httpstream/spdy", "ImportPath": "k8s.io/apimachinery/pkg/util/httpstream/spdy",
"Rev": "085ff9770270458ad7d899f2338e193c2c585d5b" "Rev": "cd53e6e3b3a5f792de51f8d95fb17f46f0627abf"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/intstr", "ImportPath": "k8s.io/apimachinery/pkg/util/intstr",
"Rev": "085ff9770270458ad7d899f2338e193c2c585d5b" "Rev": "cd53e6e3b3a5f792de51f8d95fb17f46f0627abf"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/json", "ImportPath": "k8s.io/apimachinery/pkg/util/json",
"Rev": "085ff9770270458ad7d899f2338e193c2c585d5b" "Rev": "cd53e6e3b3a5f792de51f8d95fb17f46f0627abf"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/mergepatch", "ImportPath": "k8s.io/apimachinery/pkg/util/mergepatch",
"Rev": "085ff9770270458ad7d899f2338e193c2c585d5b" "Rev": "cd53e6e3b3a5f792de51f8d95fb17f46f0627abf"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/naming", "ImportPath": "k8s.io/apimachinery/pkg/util/naming",
"Rev": "085ff9770270458ad7d899f2338e193c2c585d5b" "Rev": "cd53e6e3b3a5f792de51f8d95fb17f46f0627abf"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/net", "ImportPath": "k8s.io/apimachinery/pkg/util/net",
"Rev": "085ff9770270458ad7d899f2338e193c2c585d5b" "Rev": "cd53e6e3b3a5f792de51f8d95fb17f46f0627abf"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/remotecommand", "ImportPath": "k8s.io/apimachinery/pkg/util/remotecommand",
"Rev": "085ff9770270458ad7d899f2338e193c2c585d5b" "Rev": "cd53e6e3b3a5f792de51f8d95fb17f46f0627abf"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/runtime", "ImportPath": "k8s.io/apimachinery/pkg/util/runtime",
"Rev": "085ff9770270458ad7d899f2338e193c2c585d5b" "Rev": "cd53e6e3b3a5f792de51f8d95fb17f46f0627abf"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/sets", "ImportPath": "k8s.io/apimachinery/pkg/util/sets",
"Rev": "085ff9770270458ad7d899f2338e193c2c585d5b" "Rev": "cd53e6e3b3a5f792de51f8d95fb17f46f0627abf"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/strategicpatch", "ImportPath": "k8s.io/apimachinery/pkg/util/strategicpatch",
"Rev": "085ff9770270458ad7d899f2338e193c2c585d5b" "Rev": "cd53e6e3b3a5f792de51f8d95fb17f46f0627abf"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/validation", "ImportPath": "k8s.io/apimachinery/pkg/util/validation",
"Rev": "085ff9770270458ad7d899f2338e193c2c585d5b" "Rev": "cd53e6e3b3a5f792de51f8d95fb17f46f0627abf"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/validation/field", "ImportPath": "k8s.io/apimachinery/pkg/util/validation/field",
"Rev": "085ff9770270458ad7d899f2338e193c2c585d5b" "Rev": "cd53e6e3b3a5f792de51f8d95fb17f46f0627abf"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/wait", "ImportPath": "k8s.io/apimachinery/pkg/util/wait",
"Rev": "085ff9770270458ad7d899f2338e193c2c585d5b" "Rev": "cd53e6e3b3a5f792de51f8d95fb17f46f0627abf"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/yaml", "ImportPath": "k8s.io/apimachinery/pkg/util/yaml",
"Rev": "085ff9770270458ad7d899f2338e193c2c585d5b" "Rev": "cd53e6e3b3a5f792de51f8d95fb17f46f0627abf"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/version", "ImportPath": "k8s.io/apimachinery/pkg/version",
"Rev": "085ff9770270458ad7d899f2338e193c2c585d5b" "Rev": "cd53e6e3b3a5f792de51f8d95fb17f46f0627abf"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/watch", "ImportPath": "k8s.io/apimachinery/pkg/watch",
"Rev": "085ff9770270458ad7d899f2338e193c2c585d5b" "Rev": "cd53e6e3b3a5f792de51f8d95fb17f46f0627abf"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/third_party/forked/golang/json", "ImportPath": "k8s.io/apimachinery/third_party/forked/golang/json",
"Rev": "085ff9770270458ad7d899f2338e193c2c585d5b" "Rev": "cd53e6e3b3a5f792de51f8d95fb17f46f0627abf"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/third_party/forked/golang/netutil", "ImportPath": "k8s.io/apimachinery/third_party/forked/golang/netutil",
"Rev": "085ff9770270458ad7d899f2338e193c2c585d5b" "Rev": "cd53e6e3b3a5f792de51f8d95fb17f46f0627abf"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/third_party/forked/golang/reflect", "ImportPath": "k8s.io/apimachinery/third_party/forked/golang/reflect",
"Rev": "085ff9770270458ad7d899f2338e193c2c585d5b" "Rev": "cd53e6e3b3a5f792de51f8d95fb17f46f0627abf"
}, },
{ {
"ImportPath": "k8s.io/kube-openapi/pkg/util/proto", "ImportPath": "k8s.io/kube-openapi/pkg/util/proto",

View File

@ -20,6 +20,7 @@ import (
"net/http" "net/http"
"path/filepath" "path/filepath"
"github.com/golang/glog"
"github.com/gregjones/httpcache" "github.com/gregjones/httpcache"
"github.com/gregjones/httpcache/diskcache" "github.com/gregjones/httpcache/diskcache"
"github.com/peterbourgon/diskv" "github.com/peterbourgon/diskv"
@ -47,4 +48,15 @@ func (rt *cacheRoundTripper) RoundTrip(req *http.Request) (*http.Response, error
return rt.rt.RoundTrip(req) return rt.rt.RoundTrip(req)
} }
func (rt *cacheRoundTripper) CancelRequest(req *http.Request) {
type canceler interface {
CancelRequest(*http.Request)
}
if cr, ok := rt.rt.Transport.(canceler); ok {
cr.CancelRequest(req)
} else {
glog.Errorf("CancelRequest not implemented by %T", rt.rt.Transport)
}
}
func (rt *cacheRoundTripper) WrappedRoundTripper() http.RoundTripper { return rt.rt.Transport } func (rt *cacheRoundTripper) WrappedRoundTripper() http.RoundTripper { return rt.rt.Transport }