Skip to content

Commit 4bbb027

Browse files
Merge pull request openshift#8297 from zaneb/appliance-register-cluster
OCPBUGS-32519: Fix appliance CI jobs
2 parents 388a35c + cefe677 commit 4bbb027

File tree

10 files changed

+26
-13
lines changed

10 files changed

+26
-13
lines changed

data/data/agent/files/usr/local/bin/agent-gather

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,12 @@ function gather_database_data() {
105105
( >&2 echo " Done")
106106
}
107107

108+
function gather_systemd_units() {
109+
( >&2 echo -n "Gathering systemd data" )
110+
mkdir -p "${ARTIFACTS_DIR}/etc/systemd"
111+
cp -a /etc/systemd/system "${ARTIFACTS_DIR}/etc/systemd/"
112+
}
113+
108114
function Help()
109115
{
110116
echo "Gathers the necessary data for troubleshooting OpenShift's agent based installation"
@@ -147,6 +153,7 @@ gather_network_data
147153
gather_storage_data
148154
gather_container_status
149155
gather_database_data
156+
gather_systemd_units
150157

151158
# Set permissions so regular users can delete the extracted content
152159
find "$ARTIFACTS_DIR" -type d -exec chmod a+rwx "{}" \;

data/data/agent/files/usr/local/bin/load-config-iso.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ copy_archive_contents() {
8282
is_enabled=$(systemctl is-enabled "$service")
8383
if [[ "${is_enabled}" == "disabled" ]]; then
8484
echo "Service ${service} is disabled, enabling it"
85-
systemctl enable "${service}"
85+
systemctl --no-block --now enable "${service}"
8686
fi
8787
done
8888

data/data/agent/systemd/units/agent-add-node.service

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
Description=Adds the current node to an already existing cluster
33
Wants=network-online.target
44
Requires=apply-host-config.service
5+
Conflicts=start-cluster-installation.service
56
PartOf=assisted-service-pod.service
67
After=network-online.target apply-host-config.service
78
ConditionPathExists=/etc/assisted/node0
9+
ConditionPathExists=/etc/assisted/add-nodes.env
810

911
[Service]
1012
EnvironmentFile=/usr/local/share/assisted-service/assisted-service.env

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
[Unit]
22
Description=Imports an already existing cluster
33
Wants=network-online.target assisted-service.service
4+
Conflicts=agent-register-cluster.service
45
PartOf=assisted-service-pod.service
56
After=network-online.target assisted-service.service
67
ConditionPathExists=/etc/assisted/node0
8+
ConditionPathExists=/etc/assisted/add-nodes.env
79

810
[Service]
911
Environment=PODMAN_SYSTEMD_UNIT=%n
@@ -25,4 +27,4 @@ RestartSec=30
2527
RemainAfterExit=true
2628

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

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
[Unit]
22
Description=Service that registers the cluster
33
Wants=network-online.target assisted-service.service
4+
Conflicts=agent-import-cluster.service
45
PartOf=assisted-service-pod.service
56
After=network-online.target assisted-service.service
67
ConditionPathExists=/etc/assisted/node0
8+
ConditionPathExists=!/etc/assisted/add-nodes.env
79

810
[Service]
911
Environment=PODMAN_SYSTEMD_UNIT=%n
@@ -24,4 +26,4 @@ RestartSec=30
2426
RemainAfterExit=true
2527

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

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

Lines changed: 2 additions & 2 deletions
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]
@@ -23,4 +23,4 @@ RestartSec=30
2323
RemainAfterExit=true
2424

2525
[Install]
26-
WantedBy=multi-user.target
26+
WantedBy=start-cluster-installation.service agent-add-node.service

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ Type=oneshot
2323
RemainAfterExit=true
2424

2525
[Install]
26-
WantedBy=multi-user.target
26+
WantedBy=start-cluster-installation.service agent-add-node.service

data/data/agent/systemd/units/start-cluster-installation.service

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
Description=Service that starts cluster installation
33
Wants=network-online.target
44
Requires=apply-host-config.service
5+
Conflicts=agent-add-node.service
56
PartOf=assisted-service-pod.service
67
After=network-online.target apply-host-config.service
78
ConditionPathExists=/etc/assisted/node0
9+
ConditionPathExists=!/etc/assisted/add-nodes.env
810

911
[Service]
1012
EnvironmentFile=/usr/local/share/assisted-service/assisted-service.env

pkg/asset/agent/image/ignition.go

Lines changed: 4 additions & 6 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

@@ -166,7 +165,7 @@ func (a *Ignition) Generate(dependencies asset.Parents) error {
166165
numMasters = agentManifests.AgentClusterInstall.Spec.ProvisionRequirements.ControlPlaneAgents
167166
numWorkers = agentManifests.AgentClusterInstall.Spec.ProvisionRequirements.WorkerAgents
168167
// Enable specific install services
169-
enabledServices = append(enabledServices, "agent-register-cluster.service", "start-cluster-installation.service")
168+
enabledServices = append(enabledServices, "start-cluster-installation.service")
170169
// Version is retrieved from the embedded data
171170
openshiftVersion, err = version.Version()
172171
if err != nil {
@@ -185,7 +184,7 @@ func (a *Ignition) Generate(dependencies asset.Parents) error {
185184
numMasters = 0
186185
numWorkers = len(addNodesConfig.Config.Hosts)
187186
// Enable add-nodes specific services
188-
enabledServices = append(enabledServices, "agent-import-cluster.service", "agent-add-node.service")
187+
enabledServices = append(enabledServices, "agent-add-node.service")
189188
// Generate add-nodes.env file
190189
addNodesEnvFile := ignition.FileFromString(addNodesEnvPath, "root", 0644, getAddNodesEnv(*clusterInfo))
191190
config.Storage.Files = append(config.Storage.Files, addNodesEnvFile)
@@ -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)
@@ -327,6 +325,8 @@ func getDefaultEnabledServices() []string {
327325
return []string{
328326
"agent-interactive-console.service",
329327
328+
"agent-register-cluster.service",
329+
"agent-import-cluster.service",
330330
"agent-register-infraenv.service",
331331
"agent.service",
332332
"assisted-service-db.service",
@@ -372,7 +372,6 @@ func getTemplateData(name, pullSecret, releaseImageList, releaseImage,
372372
proxy *v1beta1.Proxy,
373373
imageTypeISO,
374374
privateKey, publicKey string,
375-
workflow workflow.AgentWorkflowType,
376375
caBundleMount string) *agentTemplateData {
377376
return &agentTemplateData{
378377
ServiceProtocol: "http",
@@ -391,7 +390,6 @@ func getTemplateData(name, pullSecret, releaseImageList, releaseImage,
391390
ImageTypeISO: imageTypeISO,
392391
PrivateKeyPEM: privateKey,
393392
PublicKeyPEM: publicKey,
394-
WorkflowType: workflow,
395393
CaBundleMount: caBundleMount,
396394
}
397395
}

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)