mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 06:27:05 +00:00
client-go cache: Make caching layer Unwrappable
This commit is contained in:
parent
e58da7bb7c
commit
a804d440c3
@ -86,12 +86,8 @@ type requestCanceler interface {
|
|||||||
CancelRequest(*http.Request)
|
CancelRequest(*http.Request)
|
||||||
}
|
}
|
||||||
|
|
||||||
type authProxyRoundTripper struct {
|
type cacheRoundTripper struct {
|
||||||
username string
|
rt *httpcache.Transport
|
||||||
groups []string
|
|
||||||
extra map[string][]string
|
|
||||||
|
|
||||||
rt http.RoundTripper
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewCacheRoundTripper creates a roundtripper that reads the ETag on
|
// NewCacheRoundTripper creates a roundtripper that reads the ETag on
|
||||||
@ -105,7 +101,21 @@ func NewCacheRoundTripper(cacheDir string, rt http.RoundTripper) http.RoundTripp
|
|||||||
t := httpcache.NewTransport(diskcache.NewWithDiskv(d))
|
t := httpcache.NewTransport(diskcache.NewWithDiskv(d))
|
||||||
t.Transport = rt
|
t.Transport = rt
|
||||||
|
|
||||||
return t
|
return &cacheRoundTripper{rt: t}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (rt *cacheRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) {
|
||||||
|
return rt.rt.RoundTrip(req)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (rt *cacheRoundTripper) WrappedRoundTripper() http.RoundTripper { return rt.rt.Transport }
|
||||||
|
|
||||||
|
type authProxyRoundTripper struct {
|
||||||
|
username string
|
||||||
|
groups []string
|
||||||
|
extra map[string][]string
|
||||||
|
|
||||||
|
rt http.RoundTripper
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewAuthProxyRoundTripper provides a roundtripper which will add auth proxy fields to requests for
|
// NewAuthProxyRoundTripper provides a roundtripper which will add auth proxy fields to requests for
|
||||||
|
Loading…
Reference in New Issue
Block a user