Skip to content

Commit 7a30df7

Browse files
committed
Don't template systemd dependencies
In systemd unit files, After= only affects ordering and can reference units that don't exist or exist but are not enabled, so there is no reason to use templating. In the appliance use case we will need the agent image that is installed to disk to contain systemd units that work for either installing or adding a node (when the appropriate config is added), so both units must have the correct ordering.
1 parent 8c792a9 commit 7a30df7

File tree

3 files changed

+2
-6
lines changed

3 files changed

+2
-6
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Description=Service that registers the infraenv
33
Wants=network-online.target assisted-service.service
44
PartOf=assisted-service-pod.service
5-
After=network-online.target assisted-service.service {{ if eq .WorkflowType "install" }}agent-register-cluster.service{{ end }}{{ if eq .WorkflowType "addnodes" }}agent-import-cluster.service{{ end }}
5+
After=network-online.target assisted-service.service agent-register-cluster.service agent-import-cluster.service
66
ConditionPathExists=/etc/assisted/node0
77

88
[Service]

pkg/asset/agent/image/ignition.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ type agentTemplateData struct {
7474
ImageTypeISO string
7575
PublicKeyPEM string
7676
PrivateKeyPEM string
77-
WorkflowType workflow.AgentWorkflowType
7877
CaBundleMount string
7978
}
8079

@@ -256,7 +255,6 @@ func (a *Ignition) Generate(dependencies asset.Parents) error {
256255
imageTypeISO,
257256
keyPairAsset.PrivateKey,
258257
keyPairAsset.PublicKey,
259-
agentWorkflow.Workflow,
260258
caBundleMount)
261259

262260
err = bootstrap.AddStorageFiles(&config, "/", "agent/files", agentTemplateData)
@@ -374,7 +372,6 @@ func getTemplateData(name, pullSecret, releaseImageList, releaseImage,
374372
proxy *v1beta1.Proxy,
375373
imageTypeISO,
376374
privateKey, publicKey string,
377-
workflow workflow.AgentWorkflowType,
378375
caBundleMount string) *agentTemplateData {
379376
return &agentTemplateData{
380377
ServiceProtocol: "http",
@@ -393,7 +390,6 @@ func getTemplateData(name, pullSecret, releaseImageList, releaseImage,
393390
ImageTypeISO: imageTypeISO,
394391
PrivateKeyPEM: privateKey,
395392
PublicKeyPEM: publicKey,
396-
WorkflowType: workflow,
397393
CaBundleMount: caBundleMount,
398394
}
399395
}

pkg/asset/agent/image/ignition_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ func TestIgnition_getTemplateData(t *testing.T) {
9292
privateKey := "-----BEGIN EC PUBLIC KEY-----\nMFkwEwYHKoAiDHV4tg==\n-----END EC PUBLIC KEY-----\n"
9393
publicKey := "-----BEGIN EC PRIVATE KEY-----\nMHcCAQEEIOSCfDNmx0qe6dncV4tg==\n-----END EC PRIVATE KEY-----\n"
9494

95-
templateData := getTemplateData(clusterName, pullSecret, releaseImageList, releaseImage, releaseImageMirror, haveMirrorConfig, publicContainerRegistries, agentClusterInstall.Spec.ProvisionRequirements.ControlPlaneAgents, agentClusterInstall.Spec.ProvisionRequirements.WorkerAgents, infraEnvID, osImage, proxy, "minimal-iso", privateKey, publicKey, workflow.AgentWorkflowTypeInstall, "")
95+
templateData := getTemplateData(clusterName, pullSecret, releaseImageList, releaseImage, releaseImageMirror, haveMirrorConfig, publicContainerRegistries, agentClusterInstall.Spec.ProvisionRequirements.ControlPlaneAgents, agentClusterInstall.Spec.ProvisionRequirements.WorkerAgents, infraEnvID, osImage, proxy, "minimal-iso", privateKey, publicKey, "")
9696
assert.Equal(t, clusterName, templateData.ClusterName)
9797
assert.Equal(t, "http", templateData.ServiceProtocol)
9898
assert.Equal(t, pullSecret, templateData.PullSecret)

0 commit comments

Comments
 (0)