1
0
mirror of https://github.com/rancher/steve.git synced 2025-05-09 16:36:38 +00:00

Fix "Unable to cancel request for *client.addQuery" warnings ()

This commit is contained in:
Alejandro Ruiz 2025-02-20 18:03:03 +01:00 committed by Kevin McDermott
parent 75feceeb86
commit f6d47eb908

View File

@ -10,6 +10,7 @@ import (
"github.com/rancher/apiserver/pkg/types"
"github.com/rancher/steve/pkg/attributes"
utilnet "k8s.io/apimachinery/pkg/util/net"
"k8s.io/apiserver/pkg/endpoints/request"
"k8s.io/client-go/dynamic"
"k8s.io/client-go/kubernetes"
@ -33,6 +34,8 @@ type addQuery struct {
next http.RoundTripper
}
var _ utilnet.RoundTripperWrapper = (*addQuery)(nil)
func (a *addQuery) RoundTrip(req *http.Request) (*http.Response, error) {
q := req.URL.Query()
for k, v := range a.values {
@ -43,6 +46,10 @@ func (a *addQuery) RoundTrip(req *http.Request) (*http.Response, error) {
return a.next.RoundTrip(req)
}
func (a *addQuery) WrappedRoundTripper() http.RoundTripper {
return a.next
}
func NewFactory(cfg *rest.Config, impersonate bool) (*Factory, error) {
clientCfg := rest.CopyConfig(cfg)
updateConfigFromEnvironment(clientCfg)