Skip to content

Commit af9100c

Browse files
authored
Read PROXY env in more places when deploying (#4891)
1 parent 3224780 commit af9100c

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

pkg/kotsadmupstream/upstream.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,19 @@ func DownloadUpdate(appID string, update types.Update, skipPreflights bool, skip
234234
AppSelectedChannelID: a.SelectedChannelID,
235235
}
236236

237+
pullOptions.HTTPProxyEnvValue = os.Getenv("HTTP_PROXY")
238+
if pullOptions.HTTPProxyEnvValue == "" {
239+
pullOptions.HTTPProxyEnvValue = os.Getenv("http_proxy")
240+
}
241+
pullOptions.HTTPSProxyEnvValue = os.Getenv("HTTPS_PROXY")
242+
if pullOptions.HTTPSProxyEnvValue == "" {
243+
pullOptions.HTTPSProxyEnvValue = os.Getenv("https_proxy")
244+
}
245+
pullOptions.NoProxyEnvValue = os.Getenv("NO_PROXY")
246+
if pullOptions.NoProxyEnvValue == "" {
247+
pullOptions.NoProxyEnvValue = os.Getenv("no_proxy")
248+
}
249+
237250
_, err = pull.Pull(fmt.Sprintf("replicated://%s", beforeKotsKinds.License.Spec.AppSlug), pullOptions)
238251
if err != nil {
239252
if errors.Cause(err) != pull.ErrConfigNeeded {

pkg/online/online.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,19 @@ func CreateAppFromOnline(opts CreateOnlineAppOpts) (_ *kotsutil.KotsKinds, final
160160
SkipCompatibilityCheck: opts.SkipCompatibilityCheck,
161161
}
162162

163+
pullOptions.HTTPProxyEnvValue = os.Getenv("HTTP_PROXY")
164+
if pullOptions.HTTPProxyEnvValue == "" {
165+
pullOptions.HTTPProxyEnvValue = os.Getenv("http_proxy")
166+
}
167+
pullOptions.HTTPSProxyEnvValue = os.Getenv("HTTPS_PROXY")
168+
if pullOptions.HTTPSProxyEnvValue == "" {
169+
pullOptions.HTTPSProxyEnvValue = os.Getenv("https_proxy")
170+
}
171+
pullOptions.NoProxyEnvValue = os.Getenv("NO_PROXY")
172+
if pullOptions.NoProxyEnvValue == "" {
173+
pullOptions.NoProxyEnvValue = os.Getenv("no_proxy")
174+
}
175+
163176
if _, err := pull.Pull(opts.UpstreamURI, pullOptions); err != nil {
164177
if errors.Cause(err) != pull.ErrConfigNeeded {
165178
return nil, errors.Wrap(err, "failed to pull")

0 commit comments

Comments
 (0)