Skip to content

Commit f8bb47e

Browse files
committed
Add rendezvous IP to unconfigured-ignition
If the rendezvous IP is known, always create the rendezvous-host.env environment file in the unconfigured-ignition.
1 parent 5c8393c commit f8bb47e

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

pkg/asset/agent/image/unconfigured_ignition.go

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,16 @@ func (a *UnconfiguredIgnition) Generate(_ context.Context, dependencies asset.Pa
169169
rendezvousHostTemplateFile := ignition.FileFromString(fmt.Sprintf("%s.template", rendezvousHostEnvPath), "root", 0644, rendezvousHostTemplateData)
170170
config.Storage.Files = append(config.Storage.Files, rendezvousHostTemplateFile)
171171

172+
rendezvousIP, err := RetrieveRendezvousIP(agentConfig.Config, nil, nil)
173+
if err == nil {
174+
rendezvousHostData, err := getRendezvousHostEnvFromTemplate(rendezvousHostTemplateData, rendezvousIP)
175+
if err != nil {
176+
return err
177+
}
178+
rendezvousHostFile := ignition.FileFromString(rendezvousHostEnvPath, "root", 0644, rendezvousHostData)
179+
config.Storage.Files = append(config.Storage.Files, rendezvousHostFile)
180+
}
181+
172182
switch agentWorkflow.Workflow {
173183
case workflow.AgentWorkflowTypeInstall:
174184
agentTemplateData.ConfigImageFiles = strings.Join(GetConfigImageFiles(), ",")
@@ -179,17 +189,10 @@ func (a *UnconfiguredIgnition) Generate(_ context.Context, dependencies asset.Pa
179189
case workflow.AgentWorkflowTypeInstallInteractiveDisconnected:
180190
// Add the rendezvous host file. Agent TUI will interact with that file in case
181191
// the rendezvous IP wasn't previously configured, by managing it as a template file.
182-
var rendezvousHostData string
183-
if rendezvousIP, err := RetrieveRendezvousIP(agentConfig.Config, nil, nil); err == nil {
184-
rendezvousHostData, err := getRendezvousHostEnvFromTemplate(rendezvousHostTemplateData, rendezvousIP)
185-
if err != nil {
186-
return err
187-
}
188-
} else {
189-
rendezvousHostData = rendezvousHostTemplateData
192+
if rendezvousIP == "" {
193+
rendezvousHostFile := ignition.FileFromString(rendezvousHostEnvPath, "root", 0644, rendezvousHostTemplateData)
194+
config.Storage.Files = append(config.Storage.Files, rendezvousHostFile)
190195
}
191-
rendezvousHostFile := ignition.FileFromString(rendezvousHostEnvPath, "root", 0644, rendezvousHostData)
192-
config.Storage.Files = append(config.Storage.Files, rendezvousHostFile)
193196

194197
// Explicitly disable the load-config-iso service, not required in the current flow
195198
// (even though disabled by default, the udev rule may require it).

0 commit comments

Comments
 (0)