mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 03:41:45 +00:00
client-go exec: make sure round tripper can be unwrapped
Signed-off-by: Monis Khan <mok@vmware.com>
This commit is contained in:
parent
d3bd8a3aab
commit
249aefebe3
@ -38,6 +38,7 @@ import (
|
|||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
"k8s.io/apimachinery/pkg/runtime/serializer"
|
"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"
|
||||||
"k8s.io/client-go/pkg/apis/clientauthentication/install"
|
"k8s.io/client-go/pkg/apis/clientauthentication/install"
|
||||||
clientauthenticationv1 "k8s.io/client-go/pkg/apis/clientauthentication/v1"
|
clientauthenticationv1 "k8s.io/client-go/pkg/apis/clientauthentication/v1"
|
||||||
@ -316,11 +317,17 @@ func (a *Authenticator) UpdateTransportConfig(c *transport.Config) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var _ utilnet.RoundTripperWrapper = &roundTripper{}
|
||||||
|
|
||||||
type roundTripper struct {
|
type roundTripper struct {
|
||||||
a *Authenticator
|
a *Authenticator
|
||||||
base http.RoundTripper
|
base http.RoundTripper
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r *roundTripper) WrappedRoundTripper() http.RoundTripper {
|
||||||
|
return r.base
|
||||||
|
}
|
||||||
|
|
||||||
func (r *roundTripper) RoundTrip(req *http.Request) (*http.Response, error) {
|
func (r *roundTripper) RoundTrip(req *http.Request) (*http.Response, error) {
|
||||||
// If a user has already set credentials, use that. This makes commands like
|
// If a user has already set credentials, use that. This makes commands like
|
||||||
// "kubectl get --token (token) pods" work.
|
// "kubectl get --token (token) pods" work.
|
||||||
|
Loading…
Reference in New Issue
Block a user