Skip to content

Commit c1ac237

Browse files
committed
support adding multiple hosts
1 parent 28fdc6e commit c1ac237

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

data/data/agent/systemd/units/apply-host-config.service

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ EnvironmentFile=/usr/local/share/assisted-service/assisted-service.env
1414
ExecStartPre=/bin/rm -f %t/%n.ctr-id
1515
ExecStartPre=/bin/mkdir -p %t/agent-installer /etc/assisted/hostconfig
1616
ExecStartPre=/usr/local/bin/wait-for-assisted-service.sh
17-
ExecStart=podman run --net host --cidfile=%t/%n.ctr-id --cgroups=no-conmon --log-driver=journald --restart=on-failure:10 --pod-id-file=%t/assisted-service-pod.pod-id --replace --name=apply-host-config -v /etc/assisted/hostconfig:/etc/assisted/hostconfig -v %t/agent-installer:/var/run/agent-installer:z --env SERVICE_BASE_URL --env INFRA_ENV_ID $SERVICE_IMAGE /usr/local/bin/agent-installer-client configure
17+
ExecStart=podman run --net host --cidfile=%t/%n.ctr-id --cgroups=no-conmon --log-driver=journald --restart=on-failure:10 --pod-id-file=%t/assisted-service-pod.pod-id --replace --name=apply-host-config -v /etc/assisted/hostconfig:/etc/assisted/hostconfig -v %t/agent-installer:/var/run/agent-installer:z --env SERVICE_BASE_URL --env INFRA_ENV_ID --env WORKFLOW_TYPE $SERVICE_IMAGE /usr/local/bin/agent-installer-client configure
1818
ExecStop=/usr/bin/podman stop --ignore --cidfile=%t/%n.ctr-id
1919
ExecStopPost=/usr/bin/podman rm -f --ignore --cidfile=%t/%n.ctr-id
2020

pkg/asset/agent/image/ignition.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ func (a *Ignition) Generate(dependencies asset.Parents) error {
262262

263263
rendezvousHostFile := ignition.FileFromString(rendezvousHostEnvPath,
264264
"root", 0644,
265-
getRendezvousHostEnv(agentTemplateData.ServiceProtocol, a.RendezvousIP))
265+
getRendezvousHostEnv(agentTemplateData.ServiceProtocol, a.RendezvousIP, agentWorkflow.Workflow))
266266
config.Storage.Files = append(config.Storage.Files, rendezvousHostFile)
267267

268268
err = addBootstrapScripts(&config, agentManifests.ClusterImageSet.Spec.ReleaseImage)
@@ -390,7 +390,7 @@ func getTemplateData(name, pullSecret, releaseImageList, releaseImage,
390390
}
391391
}
392392

393-
func getRendezvousHostEnv(serviceProtocol, nodeZeroIP string) string {
393+
func getRendezvousHostEnv(serviceProtocol, nodeZeroIP string, workflowType workflow.AgentWorkflowType) string {
394394
serviceBaseURL := url.URL{
395395
Scheme: serviceProtocol,
396396
Host: net.JoinHostPort(nodeZeroIP, "8090"),
@@ -405,7 +405,8 @@ func getRendezvousHostEnv(serviceProtocol, nodeZeroIP string) string {
405405
return fmt.Sprintf(`NODE_ZERO_IP=%s
406406
SERVICE_BASE_URL=%s
407407
IMAGE_SERVICE_BASE_URL=%s
408-
`, nodeZeroIP, serviceBaseURL.String(), imageServiceBaseURL.String())
408+
WORKFLOW_TYPE=%s
409+
`, nodeZeroIP, serviceBaseURL.String(), imageServiceBaseURL.String(), workflowType)
409410
}
410411

411412
func getAddNodesEnv(clusterInfo joiner.ClusterInfo) string {

pkg/asset/agent/image/ignition_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,9 @@ func TestIgnition_getTemplateData(t *testing.T) {
112112

113113
func TestIgnition_getRendezvousHostEnv(t *testing.T) {
114114
nodeZeroIP := "2001:db8::dead:beef"
115-
rendezvousHostEnv := getRendezvousHostEnv("http", nodeZeroIP)
115+
rendezvousHostEnv := getRendezvousHostEnv("http", nodeZeroIP, workflow.AgentWorkflowTypeInstall)
116116
assert.Equal(t,
117-
"NODE_ZERO_IP="+nodeZeroIP+"\nSERVICE_BASE_URL=http://["+nodeZeroIP+"]:8090/\nIMAGE_SERVICE_BASE_URL=http://["+nodeZeroIP+"]:8888/\n",
117+
"NODE_ZERO_IP="+nodeZeroIP+"\nSERVICE_BASE_URL=http://["+nodeZeroIP+"]:8090/\nIMAGE_SERVICE_BASE_URL=http://["+nodeZeroIP+"]:8888/\nWORKFLOW_TYPE=install\n",
118118
rendezvousHostEnv)
119119
}
120120

0 commit comments

Comments
 (0)