From d9f958ceebd14a9cd29c184a6dfeeb9b37aef3e6 Mon Sep 17 00:00:00 2001 From: galal-hussein Date: Fri, 3 May 2019 02:55:05 +0200 Subject: [PATCH 1/2] Add no_proxy environment to server --- pkg/server/server.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/pkg/server/server.go b/pkg/server/server.go index b44ab34138..43a7d4e920 100644 --- a/pkg/server/server.go +++ b/pkg/server/server.go @@ -10,6 +10,7 @@ import ( "os" "path/filepath" "strconv" + "strings" "time" "github.com/pkg/errors" @@ -48,6 +49,10 @@ func StartServer(ctx context.Context, config *Config) (string, error) { return "", err } + if err := setNoProxyEnv(&config.ControlConfig); err != nil { + return "", err + } + if err := control.Server(ctx, &config.ControlConfig); err != nil { return "", errors.Wrap(err, "starting kubernetes") } @@ -293,3 +298,12 @@ func writeToken(token, file, certs string) error { token = FormatToken(token, certs) return ioutil.WriteFile(file, []byte(token+"\n"), 0600) } + +func setNoProxyEnv(config *config.Control) error { + envList := strings.Join([]string{ + os.Getenv("NO_PROXY"), + config.ClusterIPRange.String(), + config.ServiceIPRange.String(), + }, ",") + return os.Setenv("NO_PROXY", envList) +} From f7376ad979b23996e3a79c0e3d42a04dd6e9f349 Mon Sep 17 00:00:00 2001 From: Erik Wilson Date: Fri, 3 May 2019 11:10:42 -0700 Subject: [PATCH 2/2] Update proxy environment for helm controller Add lowercase no_proxy and all_proxy/ALL_PROXY to environment for helm --- pkg/helm/controller.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/helm/controller.go b/pkg/helm/controller.go index dc7c60420e..c30384f66b 100644 --- a/pkg/helm/controller.go +++ b/pkg/helm/controller.go @@ -321,10 +321,13 @@ func keys(val map[string]intstr.IntOrString) []string { func setProxyEnv(job *batch.Job) { proxySysEnv := []string{ + "all_proxy", + "ALL_PROXY", "http_proxy", - "https_proxy", "HTTP_PROXY", + "https_proxy", "HTTPS_PROXY", + "no_proxy", "NO_PROXY", } for _, proxyEnv := range proxySysEnv {