From d92ef13286e2966abfe7e90f9ef763cc6a3fd0bc Mon Sep 17 00:00:00 2001 From: Monis Khan Date: Fri, 29 Oct 2021 17:59:52 -0400 Subject: [PATCH] client-go exec: make sure round tripper can be unwrapped Signed-off-by: Monis Khan Kubernetes-commit: 249aefebe340ce4de4a67446c8b6b43c2121044e --- plugin/pkg/client/auth/exec/exec.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/plugin/pkg/client/auth/exec/exec.go b/plugin/pkg/client/auth/exec/exec.go index 229a4cca..e405e3dc 100644 --- a/plugin/pkg/client/auth/exec/exec.go +++ b/plugin/pkg/client/auth/exec/exec.go @@ -38,6 +38,7 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/runtime/serializer" + utilnet "k8s.io/apimachinery/pkg/util/net" "k8s.io/client-go/pkg/apis/clientauthentication" "k8s.io/client-go/pkg/apis/clientauthentication/install" clientauthenticationv1 "k8s.io/client-go/pkg/apis/clientauthentication/v1" @@ -316,11 +317,17 @@ func (a *Authenticator) UpdateTransportConfig(c *transport.Config) error { return nil } +var _ utilnet.RoundTripperWrapper = &roundTripper{} + type roundTripper struct { a *Authenticator base http.RoundTripper } +func (r *roundTripper) WrappedRoundTripper() http.RoundTripper { + return r.base +} + func (r *roundTripper) RoundTrip(req *http.Request) (*http.Response, error) { // If a user has already set credentials, use that. This makes commands like // "kubectl get --token (token) pods" work.