Skip to content

Commit c3e9b51

Browse files
Merge pull request #9153 from bfournie/agent-rendezvous-noproxy
OCPBUGS-30292: If agent proxy defined, add MachineNetwork to noProxy
2 parents 22e4625 + 52277e5 commit c3e9b51

File tree

13 files changed

+112
-28
lines changed

13 files changed

+112
-28
lines changed

cmd/openshift-install/testdata/agent/image/configurations/compact.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,4 @@ rendezvousIP: 192.168.111.20
5454
[Manager]
5555
DefaultEnvironment=HTTP_PROXY="http://192.168.111.1:8215"
5656
DefaultEnvironment=HTTPS_PROXY="http://192.168.111.1:8215"
57-
DefaultEnvironment=NO_PROXY="172.22.0.0/24,virthost.ostest.test.metalkube.org,192.168.111.20"
57+
DefaultEnvironment=NO_PROXY="172.22.0.0/24,virthost.ostest.test.metalkube.org,192.168.111.0/24"

cmd/openshift-install/testdata/agent/image/configurations/control-plane-4-replicas.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ rendezvousIP: 192.168.111.20
5555
[Manager]
5656
DefaultEnvironment=HTTP_PROXY="http://192.168.111.1:8215"
5757
DefaultEnvironment=HTTPS_PROXY="http://192.168.111.1:8215"
58-
DefaultEnvironment=NO_PROXY="172.22.0.0/24,virthost.ostest.test.metalkube.org,192.168.111.20"
58+
DefaultEnvironment=NO_PROXY="172.22.0.0/24,virthost.ostest.test.metalkube.org,192.168.111.0/24"
5959
-- expected/agent-cluster-install.yaml --
6060
apiVersion: extensions.hive.openshift.io/v1beta1
6161
kind: AgentClusterInstall
@@ -90,7 +90,7 @@ spec:
9090
proxy:
9191
httpProxy: http://192.168.111.1:8215
9292
httpsProxy: http://192.168.111.1:8215
93-
noProxy: 172.22.0.0/24,virthost.ostest.test.metalkube.org
93+
noProxy: 172.22.0.0/24,virthost.ostest.test.metalkube.org,192.168.111.0/24
9494
sshPublicKey: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDK6UTEydcEKzuNdPaofn8Z2DwgHqdcionLZBiPf/zIRNco++etLsat7Avv7yt04DINQd5zjxIFgG8jblaUB5E5C9ClUcMwb52GO0ay2Y9v1uBv1a4WhI3peKktAzYNk0EBMQlJtXPjRMrC9ylBPh+DsBHMu+KmDnfk7PIwyN4efC8k5kSRuPWoNdme1rz2+umU8FSmaWTHIajrbspf4GQbsntA5kuKEtDbfoNCU97o2KrRnUbeg3a8hwSjfh3u6MhlnGcg5K2Ij+zivEsWGCLKYUtE1ErqwfIzwWmJ6jnV66XCQGHf4Q1iIxqF7s2a1q24cgG2Z/iDXfqXrCIfy4P7b/Ztak3bdT9jfAdVZtdO5/r7I+O5hYhF86ayFlDWzZWP/ByiSb+q4CQbfVgK3BMmiAv2MqLHdhesmD/SmIcoOWUF6rFmRKZVFFpKpt5ATNTgUJ3JRowoXrrDruVXClUGRiCS6Zabd1rZ3VmTchaPJwtzQMdfIWISXj+Ig+C4UK0=
9595
status:
9696
debugInfo:

cmd/openshift-install/testdata/agent/image/configurations/control-plane-5-replicas.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ rendezvousIP: 192.168.111.20
5555
[Manager]
5656
DefaultEnvironment=HTTP_PROXY="http://192.168.111.1:8215"
5757
DefaultEnvironment=HTTPS_PROXY="http://192.168.111.1:8215"
58-
DefaultEnvironment=NO_PROXY="172.22.0.0/24,virthost.ostest.test.metalkube.org,192.168.111.20"
58+
DefaultEnvironment=NO_PROXY="172.22.0.0/24,virthost.ostest.test.metalkube.org,192.168.111.0/24"
5959
-- expected/agent-cluster-install.yaml --
6060
apiVersion: extensions.hive.openshift.io/v1beta1
6161
kind: AgentClusterInstall
@@ -90,7 +90,7 @@ spec:
9090
proxy:
9191
httpProxy: http://192.168.111.1:8215
9292
httpsProxy: http://192.168.111.1:8215
93-
noProxy: 172.22.0.0/24,virthost.ostest.test.metalkube.org
93+
noProxy: 172.22.0.0/24,virthost.ostest.test.metalkube.org,192.168.111.0/24
9494
sshPublicKey: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDK6UTEydcEKzuNdPaofn8Z2DwgHqdcionLZBiPf/zIRNco++etLsat7Avv7yt04DINQd5zjxIFgG8jblaUB5E5C9ClUcMwb52GO0ay2Y9v1uBv1a4WhI3peKktAzYNk0EBMQlJtXPjRMrC9ylBPh+DsBHMu+KmDnfk7PIwyN4efC8k5kSRuPWoNdme1rz2+umU8FSmaWTHIajrbspf4GQbsntA5kuKEtDbfoNCU97o2KrRnUbeg3a8hwSjfh3u6MhlnGcg5K2Ij+zivEsWGCLKYUtE1ErqwfIzwWmJ6jnV66XCQGHf4Q1iIxqF7s2a1q24cgG2Z/iDXfqXrCIfy4P7b/Ztak3bdT9jfAdVZtdO5/r7I+O5hYhF86ayFlDWzZWP/ByiSb+q4CQbfVgK3BMmiAv2MqLHdhesmD/SmIcoOWUF6rFmRKZVFFpKpt5ATNTgUJ3JRowoXrrDruVXClUGRiCS6Zabd1rZ3VmTchaPJwtzQMdfIWISXj+Ig+C4UK0=
9595
status:
9696
debugInfo:

cmd/openshift-install/testdata/agent/image/manifests/default_manifests.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ isoIgnitionContains agent.x86_64.iso /etc/assisted/manifests/pull-secret.yaml
1414
-- install-config.yaml --
1515
apiVersion: v1
1616
baseDomain: test.metalkube.org
17+
proxy:
18+
httpProxy: http://192.168.111.1:8215
19+
httpsProxy: http://192.168.111.1:8215
20+
noProxy: 172.22.0.0/24,virthost.ostest.test.metalkube.org
1721
controlPlane:
1822
name: master
1923
replicas: 1
@@ -69,6 +73,10 @@ spec:
6973
platformType: None
7074
provisionRequirements:
7175
controlPlaneAgents: 1
76+
proxy:
77+
httpProxy: http://192.168.111.1:8215
78+
httpsProxy: http://192.168.111.1:8215
79+
noProxy: 172.22.0.0/24,virthost.ostest.test.metalkube.org,192.168.111.0/24
7280
sshPublicKey: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDK6UTEydcEKzuNdPaofn8Z2DwgHqdcionLZBiPf/zIRNco++etLsat7Avv7yt04DINQd5zjxIFgG8jblaUB5E5C9ClUcMwb52GO0ay2Y9v1uBv1a4WhI3peKktAzYNk0EBMQlJtXPjRMrC9ylBPh+DsBHMu+KmDnfk7PIwyN4efC8k5kSRuPWoNdme1rz2+umU8FSmaWTHIajrbspf4GQbsntA5kuKEtDbfoNCU97o2KrRnUbeg3a8hwSjfh3u6MhlnGcg5K2Ij+zivEsWGCLKYUtE1ErqwfIzwWmJ6jnV66XCQGHf4Q1iIxqF7s2a1q24cgG2Z/iDXfqXrCIfy4P7b/Ztak3bdT9jfAdVZtdO5/r7I+O5hYhF86ayFlDWzZWP/ByiSb+q4CQbfVgK3BMmiAv2MqLHdhesmD/SmIcoOWUF6rFmRKZVFFpKpt5ATNTgUJ3JRowoXrrDruVXClUGRiCS6Zabd1rZ3VmTchaPJwtzQMdfIWISXj+Ig+C4UK0=
7381
status:
7482
debugInfo:
@@ -124,6 +132,10 @@ spec:
124132
nmStateConfigLabelSelector:
125133
matchLabels:
126134
infraenvs.agent-install.openshift.io: ostest
135+
proxy:
136+
httpProxy: http://192.168.111.1:8215
137+
httpsProxy: http://192.168.111.1:8215
138+
noProxy: 172.22.0.0/24,virthost.ostest.test.metalkube.org,192.168.111.0/24
127139
pullSecretRef:
128140
name: ostest-pull-secret
129141
sshAuthorizedKey: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDK6UTEydcEKzuNdPaofn8Z2DwgHqdcionLZBiPf/zIRNco++etLsat7Avv7yt04DINQd5zjxIFgG8jblaUB5E5C9ClUcMwb52GO0ay2Y9v1uBv1a4WhI3peKktAzYNk0EBMQlJtXPjRMrC9ylBPh+DsBHMu+KmDnfk7PIwyN4efC8k5kSRuPWoNdme1rz2+umU8FSmaWTHIajrbspf4GQbsntA5kuKEtDbfoNCU97o2KrRnUbeg3a8hwSjfh3u6MhlnGcg5K2Ij+zivEsWGCLKYUtE1ErqwfIzwWmJ6jnV66XCQGHf4Q1iIxqF7s2a1q24cgG2Z/iDXfqXrCIfy4P7b/Ztak3bdT9jfAdVZtdO5/r7I+O5hYhF86ayFlDWzZWP/ByiSb+q4CQbfVgK3BMmiAv2MqLHdhesmD/SmIcoOWUF6rFmRKZVFFpKpt5ATNTgUJ3JRowoXrrDruVXClUGRiCS6Zabd1rZ3VmTchaPJwtzQMdfIWISXj+Ig+C4UK0=

data/data/agent/files/etc/systemd/system.conf.d/10-default-env.conf.template

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ DefaultEnvironment=HTTP_PROXY="{{replace .Proxy.HTTPProxy "%" "%%"}}"
77
DefaultEnvironment=HTTPS_PROXY="{{replace .Proxy.HTTPSProxy "%" "%%"}}"
88
{{end -}}
99
{{if .Proxy.NoProxy -}}
10-
DefaultEnvironment=NO_PROXY="{{.Proxy.NoProxy}},{{.RendezvousIP}}"
11-
{{else -}}
12-
DefaultEnvironment=NO_PROXY="{{.RendezvousIP}}"
10+
DefaultEnvironment=NO_PROXY="{{.Proxy.NoProxy}}"
1311
{{end -}}
1412
{{end -}}

pkg/asset/agent/image/ignition.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ type agentTemplateData struct {
8282
TokenExpiry string
8383
AuthType string
8484
CaBundleMount string
85-
RendezvousIP string
8685
}
8786

8887
// Name returns the human-friendly name of the asset.
@@ -290,7 +289,6 @@ func (a *Ignition) Generate(ctx context.Context, dependencies asset.Parents) err
290289
numMasters, numWorkers,
291290
osImage,
292291
infraEnv.Spec.Proxy,
293-
a.RendezvousIP,
294292
)
295293

296294
err = bootstrap.AddStorageFiles(&config, "/", "agent/files", agentTemplateData)
@@ -410,7 +408,7 @@ func getTemplateData(name, pullSecret, releaseImageList, releaseImage, releaseIm
410408
haveMirrorConfig bool,
411409
numMasters, numWorkers int,
412410
osImage *models.OsImage,
413-
proxy *v1beta1.Proxy, rendezvousIP string) *agentTemplateData {
411+
proxy *v1beta1.Proxy) *agentTemplateData {
414412
return &agentTemplateData{
415413
ServiceProtocol: "http",
416414
PullSecret: pullSecret,
@@ -431,7 +429,6 @@ func getTemplateData(name, pullSecret, releaseImageList, releaseImage, releaseIm
431429
Token: token,
432430
TokenExpiry: tokenExpiry,
433431
CaBundleMount: caBundleMount,
434-
RendezvousIP: rendezvousIP,
435432
}
436433
}
437434

pkg/asset/agent/image/ignition_test.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,7 @@ func TestIgnition_getTemplateData(t *testing.T) {
9494

9595
publicKey := "-----BEGIN EC PUBLIC KEY-----\nMHcCAQEEIOSCfDNmx0qe6dncV4tg==\n-----END EC PUBLIC KEY-----\n"
9696
token := "someToken"
97-
rendezvousIP := "192.168.111.80"
98-
templateData := getTemplateData(clusterName, pullSecret, releaseImageList, releaseImage, releaseImageMirror, publicContainerRegistries, "minimal-iso", infraEnvID, publicKey, gencrypto.AuthType, token, "", "", haveMirrorConfig, agentClusterInstall.Spec.ProvisionRequirements.ControlPlaneAgents, agentClusterInstall.Spec.ProvisionRequirements.WorkerAgents, osImage, proxy, rendezvousIP)
97+
templateData := getTemplateData(clusterName, pullSecret, releaseImageList, releaseImage, releaseImageMirror, publicContainerRegistries, "minimal-iso", infraEnvID, publicKey, gencrypto.AuthType, token, "", "", haveMirrorConfig, agentClusterInstall.Spec.ProvisionRequirements.ControlPlaneAgents, agentClusterInstall.Spec.ProvisionRequirements.WorkerAgents, osImage, proxy)
9998
assert.Equal(t, clusterName, templateData.ClusterName)
10099
assert.Equal(t, "http", templateData.ServiceProtocol)
101100
assert.Equal(t, pullSecret, templateData.PullSecret)
@@ -112,7 +111,6 @@ func TestIgnition_getTemplateData(t *testing.T) {
112111
assert.Equal(t, publicKey, templateData.PublicKeyPEM)
113112
assert.Equal(t, gencrypto.AuthType, templateData.AuthType)
114113
assert.Equal(t, token, templateData.Token)
115-
assert.Equal(t, rendezvousIP, templateData.RendezvousIP)
116114

117115
}
118116

pkg/asset/agent/manifests/agentclusterinstall.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ func (*AgentClusterInstall) Dependencies() []asset.Asset {
131131
&workflow.AgentWorkflow{},
132132
&agent.OptionalInstallConfig{},
133133
&agentconfig.AgentHosts{},
134+
&agentconfig.AgentConfig{},
134135
}
135136
}
136137

@@ -141,7 +142,8 @@ func (a *AgentClusterInstall) Generate(_ context.Context, dependencies asset.Par
141142
agentWorkflow := &workflow.AgentWorkflow{}
142143
installConfig := &agent.OptionalInstallConfig{}
143144
agentHosts := &agentconfig.AgentHosts{}
144-
dependencies.Get(agentWorkflow, agentHosts, installConfig)
145+
agentConfig := &agentconfig.AgentConfig{}
146+
dependencies.Get(agentWorkflow, agentHosts, installConfig, agentConfig)
145147

146148
// This manifest is not required for AddNodes workflow
147149
if agentWorkflow.Workflow == workflow.AgentWorkflowTypeAddNodes {
@@ -229,7 +231,12 @@ func (a *AgentClusterInstall) Generate(_ context.Context, dependencies asset.Par
229231
}
230232

231233
if installConfig.Config.Proxy != nil {
232-
agentClusterInstall.Spec.Proxy = (*hiveext.Proxy)(getProxy(installConfig.Config.Proxy))
234+
rendezvousIP := ""
235+
if agentConfig.Config != nil {
236+
rendezvousIP = agentConfig.Config.RendezvousIP
237+
}
238+
239+
agentClusterInstall.Spec.Proxy = (*hiveext.Proxy)(getProxy(installConfig.Config.Proxy, &installConfig.Config.Networking.MachineNetwork, rendezvousIP))
233240
}
234241

235242
if installConfig.Config.Platform.BareMetal != nil {

pkg/asset/agent/manifests/agentclusterinstall_test.go

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package manifests
22

33
import (
44
"context"
5+
"net"
56
"os"
67
"testing"
78

@@ -21,6 +22,7 @@ import (
2122
"github.com/openshift/installer/pkg/asset/agent/agentconfig"
2223
"github.com/openshift/installer/pkg/asset/agent/workflow"
2324
"github.com/openshift/installer/pkg/asset/mock"
25+
"github.com/openshift/installer/pkg/ipnet"
2426
"github.com/openshift/installer/pkg/types"
2527
externaltype "github.com/openshift/installer/pkg/types/external"
2628
)
@@ -39,11 +41,18 @@ func TestAgentClusterInstall_Generate(t *testing.T) {
3941
installConfigOverrides: `{"fips":true}`,
4042
})
4143

44+
_, machineNetCidr, _ := net.ParseCIDR("192.168.122.0/16") //nolint:errcheck
45+
machineNetwork := []types.MachineNetworkEntry{
46+
{
47+
CIDR: ipnet.IPNet{IPNet: *machineNetCidr},
48+
},
49+
}
50+
4251
installConfigWithProxy := getValidOptionalInstallConfig()
43-
installConfigWithProxy.Config.Proxy = (*types.Proxy)(getProxy(getProxyValidOptionalInstallConfig().Config.Proxy))
52+
installConfigWithProxy.Config.Proxy = (*types.Proxy)(getProxy(getProxyValidOptionalInstallConfig().Config.Proxy, &machineNetwork, "192.168.122.2"))
4453

4554
goodProxyACI := getGoodACI()
46-
goodProxyACI.Spec.Proxy = (*hiveext.Proxy)(getProxy(getProxyValidOptionalInstallConfig().Config.Proxy))
55+
goodProxyACI.Spec.Proxy = (*hiveext.Proxy)(getProxy(getProxyValidOptionalInstallConfig().Config.Proxy, &machineNetwork, "192.168.122.2"))
4756

4857
goodACIDualStackVIPs := getGoodACIDualStack()
4958
goodACIDualStackVIPs.Spec.APIVIPs = []string{"192.168.122.10", "2001:db8:1111:2222:ffff:ffff:ffff:cafe"}
@@ -150,6 +159,7 @@ func TestAgentClusterInstall_Generate(t *testing.T) {
150159
&workflow.AgentWorkflow{Workflow: workflow.AgentWorkflowTypeInstall},
151160
&agent.OptionalInstallConfig{},
152161
&agentconfig.AgentHosts{},
162+
&agentconfig.AgentConfig{},
153163
},
154164
expectedError: "missing configuration or manifest file",
155165
},
@@ -159,6 +169,7 @@ func TestAgentClusterInstall_Generate(t *testing.T) {
159169
&workflow.AgentWorkflow{Workflow: workflow.AgentWorkflowTypeInstall},
160170
getValidOptionalInstallConfig(),
161171
&agentconfig.AgentHosts{},
172+
&agentconfig.AgentConfig{},
162173
},
163174
expectedConfig: goodACI,
164175
},
@@ -168,6 +179,7 @@ func TestAgentClusterInstall_Generate(t *testing.T) {
168179
&workflow.AgentWorkflow{Workflow: workflow.AgentWorkflowTypeInstall},
169180
installConfigWithoutNetworkType,
170181
&agentconfig.AgentHosts{},
182+
&agentconfig.AgentConfig{},
171183
},
172184
expectedConfig: goodACI,
173185
},
@@ -177,6 +189,7 @@ func TestAgentClusterInstall_Generate(t *testing.T) {
177189
&workflow.AgentWorkflow{Workflow: workflow.AgentWorkflowTypeInstall},
178190
installConfigWithFIPS,
179191
&agentconfig.AgentHosts{},
192+
&agentconfig.AgentConfig{},
180193
},
181194
expectedConfig: goodFIPSACI,
182195
},
@@ -186,6 +199,7 @@ func TestAgentClusterInstall_Generate(t *testing.T) {
186199
&workflow.AgentWorkflow{Workflow: workflow.AgentWorkflowTypeInstall},
187200
installConfigWithProxy,
188201
&agentconfig.AgentHosts{},
202+
getValidAgentConfig(),
189203
},
190204
expectedConfig: goodProxyACI,
191205
},
@@ -195,6 +209,7 @@ func TestAgentClusterInstall_Generate(t *testing.T) {
195209
&workflow.AgentWorkflow{Workflow: workflow.AgentWorkflowTypeInstall},
196210
getValidOptionalInstallConfigDualStack(),
197211
&agentconfig.AgentHosts{},
212+
&agentconfig.AgentConfig{},
198213
},
199214
expectedConfig: getGoodACIDualStack(),
200215
},
@@ -204,6 +219,7 @@ func TestAgentClusterInstall_Generate(t *testing.T) {
204219
&workflow.AgentWorkflow{Workflow: workflow.AgentWorkflowTypeInstall},
205220
getValidOptionalInstallConfigDualStackDualVIPs(),
206221
&agentconfig.AgentHosts{},
222+
&agentconfig.AgentConfig{},
207223
},
208224
expectedConfig: goodACIDualStackVIPs,
209225
},
@@ -213,6 +229,7 @@ func TestAgentClusterInstall_Generate(t *testing.T) {
213229
&workflow.AgentWorkflow{Workflow: workflow.AgentWorkflowTypeInstall},
214230
installConfigWithCapabilities,
215231
&agentconfig.AgentHosts{},
232+
&agentconfig.AgentConfig{},
216233
},
217234
expectedConfig: goodCapabilitiesACI,
218235
},
@@ -222,6 +239,7 @@ func TestAgentClusterInstall_Generate(t *testing.T) {
222239
&workflow.AgentWorkflow{Workflow: workflow.AgentWorkflowTypeInstall},
223240
installConfigWithNetworkOverride,
224241
&agentconfig.AgentHosts{},
242+
&agentconfig.AgentConfig{},
225243
},
226244
expectedConfig: goodNetworkOverrideACI,
227245
},
@@ -231,6 +249,7 @@ func TestAgentClusterInstall_Generate(t *testing.T) {
231249
&workflow.AgentWorkflow{Workflow: workflow.AgentWorkflowTypeInstall},
232250
installConfigWithCPUPartitioning,
233251
&agentconfig.AgentHosts{},
252+
&agentconfig.AgentConfig{},
234253
},
235254
expectedConfig: goodCPUPartitioningACI,
236255
},
@@ -240,6 +259,7 @@ func TestAgentClusterInstall_Generate(t *testing.T) {
240259
&workflow.AgentWorkflow{Workflow: workflow.AgentWorkflowTypeInstall},
241260
installConfigWExternalPlatform,
242261
&agentconfig.AgentHosts{},
262+
&agentconfig.AgentConfig{},
243263
},
244264
expectedConfig: goodExternalPlatformACI,
245265
},
@@ -249,6 +269,7 @@ func TestAgentClusterInstall_Generate(t *testing.T) {
249269
&workflow.AgentWorkflow{Workflow: workflow.AgentWorkflowTypeInstall},
250270
installConfigWExternalOCIPlatform,
251271
&agentconfig.AgentHosts{},
272+
&agentconfig.AgentConfig{},
252273
},
253274
expectedConfig: goodExternalOCIPlatformACI,
254275
},
@@ -258,6 +279,7 @@ func TestAgentClusterInstall_Generate(t *testing.T) {
258279
&workflow.AgentWorkflow{Workflow: workflow.AgentWorkflowTypeInstall},
259280
getValidOptionalInstallConfigWithProvisioning(),
260281
getAgentHostsWithBMCConfig(),
282+
&agentconfig.AgentConfig{},
261283
},
262284
expectedConfig: goodBaremetalPlatformBMCACI,
263285
},
@@ -267,6 +289,7 @@ func TestAgentClusterInstall_Generate(t *testing.T) {
267289
&workflow.AgentWorkflow{Workflow: workflow.AgentWorkflowTypeInstall},
268290
installConfigWithTrustBundlePolicy,
269291
&agentconfig.AgentHosts{},
292+
&agentconfig.AgentConfig{},
270293
},
271294
expectedConfig: goodTrustBundlePolicyACI,
272295
},

pkg/asset/agent/manifests/common.go

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
package manifests
22

33
import (
4+
"fmt"
5+
"net"
6+
47
aiv1beta1 "github.com/openshift/assisted-service/api/v1beta1"
58
"github.com/openshift/installer/pkg/asset/agent"
9+
"github.com/openshift/installer/pkg/ipnet"
610
"github.com/openshift/installer/pkg/types"
711
"github.com/openshift/installer/pkg/version"
812
)
@@ -19,11 +23,37 @@ func getPullSecretName(clusterName string) string {
1923
return clusterName + "-pull-secret"
2024
}
2125

22-
func getProxy(proxy *types.Proxy) *aiv1beta1.Proxy {
26+
func getProxy(proxy *types.Proxy, machineNetwork *[]types.MachineNetworkEntry, rendezvousIP string) *aiv1beta1.Proxy {
27+
noProxy := proxy.NoProxy
28+
if (proxy.HTTPProxy != "" || proxy.HTTPSProxy != "") && rendezvousIP != "" {
29+
// if proxy set, add the machineNetwork corresponding to rendezvousIP to noproxy
30+
cidr := ""
31+
if machineNetwork != nil {
32+
for _, mn := range *machineNetwork {
33+
ipNet, err := ipnet.ParseCIDR(mn.CIDR.String())
34+
if err != nil {
35+
continue
36+
}
37+
ip := net.ParseIP(rendezvousIP)
38+
if ipNet.Contains(ip) {
39+
cidr = mn.CIDR.String()
40+
break
41+
}
42+
}
43+
}
44+
45+
if cidr != "" {
46+
if noProxy == "" {
47+
noProxy = cidr
48+
} else {
49+
noProxy = fmt.Sprintf("%s,%s", noProxy, cidr)
50+
}
51+
}
52+
}
2353
return &aiv1beta1.Proxy{
2454
HTTPProxy: proxy.HTTPProxy,
2555
HTTPSProxy: proxy.HTTPSProxy,
26-
NoProxy: proxy.NoProxy,
56+
NoProxy: noProxy,
2757
}
2858
}
2959

0 commit comments

Comments
 (0)