mirror of
https://github.com/kubernetes-sigs/prometheus-adapter.git
synced 2026-04-05 17:27:51 +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
|
||||
if !inClusterAuth && kubeConfigPath == "" {
|
||||
return http.DefaultClient, nil
|
||||
return &http.Client{
|
||||
Transport: transport.DebugWrappers(http.DefaultTransport),
|
||||
}, nil
|
||||
}
|
||||
|
||||
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 &http.Client{
|
||||
Transport: &http.Transport{
|
||||
TLSClientConfig: &tls.Config{
|
||||
RootCAs: pool,
|
||||
Certificates: []tls.Certificate{tlsClientCerts},
|
||||
MinVersion: tls.VersionTLS12,
|
||||
Transport: transport.DebugWrappers(
|
||||
&http.Transport{
|
||||
TLSClientConfig: &tls.Config{
|
||||
RootCAs: pool,
|
||||
Certificates: []tls.Certificate{tlsClientCerts},
|
||||
MinVersion: tls.VersionTLS12,
|
||||
},
|
||||
},
|
||||
},
|
||||
),
|
||||
}, nil
|
||||
}
|
||||
|
||||
return &http.Client{
|
||||
Transport: &http.Transport{
|
||||
TLSClientConfig: &tls.Config{
|
||||
RootCAs: pool,
|
||||
MinVersion: tls.VersionTLS12,
|
||||
Transport: transport.DebugWrappers(
|
||||
&http.Transport{
|
||||
TLSClientConfig: &tls.Config{
|
||||
RootCAs: pool,
|
||||
MinVersion: tls.VersionTLS12,
|
||||
},
|
||||
},
|
||||
},
|
||||
),
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue