From 7a0853f892c2cd5f1922435f728049c06bfd0afe Mon Sep 17 00:00:00 2001 From: Jake Hyde Date: Mon, 26 Sep 2022 13:37:53 -0400 Subject: [PATCH] Add proxy to validate rest config --- pkg/k8splan/watcher.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/k8splan/watcher.go b/pkg/k8splan/watcher.go index 3b1bc432..84bb7f04 100644 --- a/pkg/k8splan/watcher.go +++ b/pkg/k8splan/watcher.go @@ -386,7 +386,8 @@ func validateKC(ctx context.Context, config *rest.Config) error { } config.Transport = utilnet.SetTransportDefaults(&http.Transport{ - DialTLS: func(network, addr string) (net.Conn, error) { + Proxy: http.ProxyFromEnvironment, + DialTLSContext: func(_ context.Context, network, addr string) (net.Conn, error) { conn, err = tls.Dial(network, addr, tlsConfig) return conn, err }, @@ -403,6 +404,7 @@ func validateKC(ctx context.Context, config *rest.Config) error { if config.UserAgent == "" { config.UserAgent = rest.DefaultKubernetesUserAgent() } + rest, err := rest.UnversionedRESTClientFor(config) if err != nil { return err