mirror of
https://github.com/kubernetes-sigs/prometheus-adapter.git
synced 2026-04-06 01:38:10 +00:00
feat(round-trip): add DebuggWrapper for http client
Signed-off-by: 7sunarni <710720732@qq.com>
This commit is contained in:
parent
c2ae4cdaf1
commit
a3ad2aeffc
1 changed files with 18 additions and 12 deletions
|
|
@ -393,7 +393,9 @@ func makeKubeconfigHTTPClient(inClusterAuth bool, kubeConfigPath string) (*http.
|
||||||
|
|
||||||
// return the default client if we're using no auth
|
// return the default client if we're using no auth
|
||||||
if !inClusterAuth && kubeConfigPath == "" {
|
if !inClusterAuth && kubeConfigPath == "" {
|
||||||
return http.DefaultClient, nil
|
return &http.Client{
|
||||||
|
Transport: transport.DebugWrappers(http.DefaultTransport),
|
||||||
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var authConf *rest.Config
|
var authConf *rest.Config
|
||||||
|
|
@ -436,23 +438,27 @@ func makePrometheusCAClient(caFilePath string, tlsCertFilePath string, tlsKeyFil
|
||||||
return nil, fmt.Errorf("failed to read TLS key pair: %v", err)
|
return nil, fmt.Errorf("failed to read TLS key pair: %v", err)
|
||||||
}
|
}
|
||||||
return &http.Client{
|
return &http.Client{
|
||||||
Transport: &http.Transport{
|
Transport: transport.DebugWrappers(
|
||||||
TLSClientConfig: &tls.Config{
|
&http.Transport{
|
||||||
RootCAs: pool,
|
TLSClientConfig: &tls.Config{
|
||||||
Certificates: []tls.Certificate{tlsClientCerts},
|
RootCAs: pool,
|
||||||
MinVersion: tls.VersionTLS12,
|
Certificates: []tls.Certificate{tlsClientCerts},
|
||||||
|
MinVersion: tls.VersionTLS12,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
),
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return &http.Client{
|
return &http.Client{
|
||||||
Transport: &http.Transport{
|
Transport: transport.DebugWrappers(
|
||||||
TLSClientConfig: &tls.Config{
|
&http.Transport{
|
||||||
RootCAs: pool,
|
TLSClientConfig: &tls.Config{
|
||||||
MinVersion: tls.VersionTLS12,
|
RootCAs: pool,
|
||||||
|
MinVersion: tls.VersionTLS12,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
),
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue