Skip to content

Commit 5d11100

Browse files
Merge pull request openshift#6827 from bfournie/podman-proxy
OCPBUGS-4997: Set the configured proxy settings for agent installer
2 parents 3410439 + 7842727 commit 5d11100

File tree

4 files changed

+26
-9
lines changed

4 files changed

+26
-9
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{{if .Proxy -}}
2+
[Manager]
3+
{{if .Proxy.HTTPProxy -}}
4+
DefaultEnvironment=HTTP_PROXY="{{.Proxy.HTTPProxy}}"
5+
{{end -}}
6+
{{if .Proxy.HTTPSProxy -}}
7+
DefaultEnvironment=HTTPS_PROXY="{{.Proxy.HTTPSProxy}}"
8+
{{end -}}
9+
{{if .Proxy.NoProxy -}}
10+
DefaultEnvironment=NO_PROXY="{{.Proxy.NoProxy}}"
11+
{{end -}}
12+
{{end -}}

data/data/agent/systemd/units/agent.service.template

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,6 @@ Type=simple
33
Restart=always
44
RestartSec=3
55
StartLimitInterval=0
6-
Environment=HTTP_PROXY=
7-
Environment=http_proxy=
8-
Environment=HTTPS_PROXY=
9-
Environment=https_proxy=
10-
Environment=NO_PROXY=
11-
Environment=no_proxy=
126
TimeoutStartSec=3000
137
ExecStartPre=/usr/local/bin/extract-agent.sh
148
ExecStart=/usr/local/bin/start-agent.sh

pkg/asset/agent/image/ignition.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ type agentTemplateData struct {
6464
InfraEnvID string
6565
ClusterName string
6666
OSImage *models.OsImage
67+
Proxy *v1beta1.Proxy
6768
}
6869

6970
// Name returns the human-friendly name of the asset.
@@ -164,7 +165,8 @@ func (a *Ignition) Generate(dependencies asset.Parents) error {
164165
publicContainerRegistries,
165166
agentManifests.AgentClusterInstall,
166167
infraEnvID,
167-
osImage)
168+
osImage,
169+
infraEnv.Spec.Proxy)
168170

169171
err = bootstrap.AddStorageFiles(&config, "/", "agent/files", agentTemplateData)
170172
if err != nil {
@@ -257,7 +259,8 @@ func getTemplateData(name, pullSecret, nodeZeroIP, releaseImageList, releaseImag
257259
releaseImageMirror string, haveMirrorConfig bool, publicContainerRegistries string,
258260
agentClusterInstall *hiveext.AgentClusterInstall,
259261
infraEnvID string,
260-
osImage *models.OsImage) *agentTemplateData {
262+
osImage *models.OsImage,
263+
proxy *v1beta1.Proxy) *agentTemplateData {
261264
serviceBaseURL := url.URL{
262265
Scheme: "http",
263266
Host: net.JoinHostPort(nodeZeroIP, "8090"),
@@ -281,6 +284,7 @@ func getTemplateData(name, pullSecret, nodeZeroIP, releaseImageList, releaseImag
281284
InfraEnvID: infraEnvID,
282285
ClusterName: name,
283286
OSImage: osImage,
287+
Proxy: proxy,
284288
}
285289
}
286290

pkg/asset/agent/image/ignition_test.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,15 @@ func TestIgnition_getTemplateData(t *testing.T) {
7979
URL: &isoURL,
8080
Version: &ver,
8181
}
82+
83+
proxy := &aiv1beta1.Proxy{
84+
HTTPProxy: "http://1.1.1.1:80",
85+
HTTPSProxy: "https://1.1.1.1:443",
86+
NoProxy: "valid-proxy.com,172.30.0.0/16",
87+
}
8288
clusterName := "test-agent-cluster-install.test"
8389

84-
templateData := getTemplateData(clusterName, pullSecret, nodeZeroIP, releaseImageList, releaseImage, releaseImageMirror, haveMirrorConfig, publicContainerRegistries, agentClusterInstall, infraEnvID, osImage)
90+
templateData := getTemplateData(clusterName, pullSecret, nodeZeroIP, releaseImageList, releaseImage, releaseImageMirror, haveMirrorConfig, publicContainerRegistries, agentClusterInstall, infraEnvID, osImage, proxy)
8591
assert.Equal(t, clusterName, templateData.ClusterName)
8692
assert.Equal(t, "http", templateData.ServiceProtocol)
8793
assert.Equal(t, "http://"+nodeZeroIP+":8090/", templateData.ServiceBaseURL)
@@ -98,6 +104,7 @@ func TestIgnition_getTemplateData(t *testing.T) {
98104
assert.Equal(t, publicContainerRegistries, templateData.PublicContainerRegistries)
99105
assert.Equal(t, infraEnvID, templateData.InfraEnvID)
100106
assert.Equal(t, osImage, templateData.OSImage)
107+
assert.Equal(t, proxy, templateData.Proxy)
101108
}
102109

103110
func TestIgnition_addStaticNetworkConfig(t *testing.T) {

0 commit comments

Comments
 (0)