From 1fc54f820e7641cda403232ba068daba1665a88b Mon Sep 17 00:00:00 2001 From: divolgin Date: Wed, 4 Sep 2024 15:31:13 -0700 Subject: [PATCH] Pass-through PROXY environment to Replicated SDK deployment --- pkg/rewrite/rewrite.go | 3 +++ pkg/upstream/helm.go | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/pkg/rewrite/rewrite.go b/pkg/rewrite/rewrite.go index c8390cd8e3..e62f0ea6f4 100644 --- a/pkg/rewrite/rewrite.go +++ b/pkg/rewrite/rewrite.go @@ -111,6 +111,9 @@ func Rewrite(rewriteOptions RewriteOptions) error { IsAirgap: rewriteOptions.IsAirgap, KotsadmID: k8sutil.GetKotsadmID(clientset), AppID: rewriteOptions.AppID, + HTTPProxyEnvValue: rewriteOptions.HTTPProxyEnvValue, + HTTPSProxyEnvValue: rewriteOptions.HTTPSProxyEnvValue, + NoProxyEnvValue: rewriteOptions.NoProxyEnvValue, } if err = upstream.WriteUpstream(u, writeUpstreamOptions); err != nil { log.FinishSpinnerWithError() diff --git a/pkg/upstream/helm.go b/pkg/upstream/helm.go index e2b5c0494e..f05d21d9d9 100644 --- a/pkg/upstream/helm.go +++ b/pkg/upstream/helm.go @@ -278,6 +278,24 @@ func buildReplicatedValues(u *types.Upstream, options types.WriteOptions) (map[s replicatedValues["license"] = string(MustMarshalLicense(u.License)) } + replicatedValues["extraEnv"] = []struct { + Name string `yaml:"name"` + Value string `yaml:"value"` + }{ + { + Name: "HTTP_PROXY", + Value: options.HTTPProxyEnvValue, + }, + { + Name: "HTTPS_PROXY", + Value: options.HTTPSProxyEnvValue, + }, + { + Name: "NO_PROXY", + Value: options.NoProxyEnvValue, + }, + } + return replicatedValues, nil }