Skip to content

Commit c37fc74

Browse files
committed
Configure install/add-node dependencies in systemd
There are two pairs of services that are always needed together in the agent ISO. For installing a cluster, agent-register-cluster.service followed (later) by start-cluster-installation.service. For adding a node to a cluster, agent-import-cluster.service followed (later) by agent-add-node.service. Reflect these dependencies in the systemd units' Install sections, so that we only need to enable either start-cluster-installation.service or agent-add-node.service to ensure all of the required services are enabled. This will simplify the implementation of adding a node via the appliance, where one flow or the other will need to be triggered in response to the config ISO being attached. Do not make either unit a requirement of multi-user.target, as they conflict. That allows us to enable both units (i.e. execute their Install sections) in the ignition. This ensures that when we start start-cluster-installation.service upon seeing a config ISO attached to the appliance, agent-register-cluster.service also gets started. This service was previously inadvertantly disabled by 9716c1f. Up to then, we also relied on enabling start-cluster-installation.service in the unconfigured ignition. However, due to the remnants of an implementation that existed prior to 204c4ae, there is still code in load-config-iso.sh to enable the service after the config drive is attached. This would be needed for an interactive ISO, but for the applicance we changed to enabling the service in the ignition. In future we will need to choose whether to start start-cluster-installation.service or agent-add-node.service based on the contents of the config drive, so continue to do this at runtime rather than simply re-enabling the former in the unconfigured ignition.
1 parent 0ce6be8 commit c37fc74

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

data/data/agent/systemd/units/agent-import-cluster.service.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ RestartSec=30
2525
RemainAfterExit=true
2626

2727
[Install]
28-
WantedBy=multi-user.target
28+
WantedBy=agent-add-node.service

data/data/agent/systemd/units/agent-register-cluster.service.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ RestartSec=30
2424
RemainAfterExit=true
2525

2626
[Install]
27-
WantedBy=multi-user.target
27+
WantedBy=start-cluster-installation.service

pkg/asset/agent/image/ignition.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ func (a *Ignition) Generate(dependencies asset.Parents) error {
166166
numMasters = agentManifests.AgentClusterInstall.Spec.ProvisionRequirements.ControlPlaneAgents
167167
numWorkers = agentManifests.AgentClusterInstall.Spec.ProvisionRequirements.WorkerAgents
168168
// Enable specific install services
169-
enabledServices = append(enabledServices, "agent-register-cluster.service", "start-cluster-installation.service")
169+
enabledServices = append(enabledServices, "start-cluster-installation.service")
170170
// Version is retrieved from the embedded data
171171
openshiftVersion, err = version.Version()
172172
if err != nil {
@@ -185,7 +185,7 @@ func (a *Ignition) Generate(dependencies asset.Parents) error {
185185
numMasters = 0
186186
numWorkers = len(addNodesConfig.Config.Hosts)
187187
// Enable add-nodes specific services
188-
enabledServices = append(enabledServices, "agent-import-cluster.service", "agent-add-node.service")
188+
enabledServices = append(enabledServices, "agent-add-node.service")
189189
// Generate add-nodes.env file
190190
addNodesEnvFile := ignition.FileFromString(addNodesEnvPath, "root", 0644, getAddNodesEnv(*clusterInfo))
191191
config.Storage.Files = append(config.Storage.Files, addNodesEnvFile)
@@ -327,6 +327,8 @@ func getDefaultEnabledServices() []string {
327327
return []string{
328328
"agent-interactive-console.service",
329329
330+
"agent-register-cluster.service",
331+
"agent-import-cluster.service",
330332
"agent-register-infraenv.service",
331333
"agent.service",
332334
"assisted-service-db.service",

0 commit comments

Comments
 (0)