Skip to content

Commit

Permalink
AGENT-615: Split create-cluster-and-infraenv.service
Browse files Browse the repository at this point in the history
The service has been removed and split into
agent-register-cluster.service
agent-register-infraenv.service

Both services continuously retries until their respective resource
has been registered with the assisted-service REST-API or if the
client sees that a resource as already been registered.

Requires: openshift/assisted-service#5376
Signed-off-by: Richard Su <rwsu@redhat.com>
  • Loading branch information
rwsu committed Oct 20, 2023
1 parent 3c3f41c commit b48cf4a
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 10 deletions.
2 changes: 1 addition & 1 deletion data/data/agent/files/usr/local/bin/install-status.sh
Expand Up @@ -4,7 +4,7 @@
source "issue_status.sh"

inactive_services() {
local services="assisted-service.service create-cluster-and-infraenv.service apply-host-config.service start-cluster-installation.service"
local services="assisted-service.service agent-register-cluster.service agent-register-infraenv.service apply-host-config.service start-cluster-installation.service"
for s in ${services}; do
if ! systemctl is-active "${s}" >/dev/null; then
printf "%s " "${s}"
Expand Down
3 changes: 2 additions & 1 deletion data/data/agent/files/usr/local/bin/set-node-zero.sh
Expand Up @@ -67,7 +67,8 @@ if [ "${IS_NODE_ZERO}" = "true" ]; then
# definitions:
# apply-host-config.service
# assisted-service-pod.service
# create-cluster-and-infraenv.service
# agent-register-cluster.service
# agent-register-infraenv.service
# install-status.service
# start-cluster-installation.service
BOOTSTRAP_HOST_MAC=${NODE_ZERO_MAC}
Expand Down
@@ -1,5 +1,5 @@
[Unit]
Description=Service that creates initial cluster and infraenv
Description=Service that registers the cluster
Wants=network-online.target assisted-service.service
PartOf=assisted-service-pod.service
After=network-online.target assisted-service.service
Expand All @@ -8,18 +8,19 @@ ConditionPathExists=/etc/assisted/node0
[Service]
Environment=PODMAN_SYSTEMD_UNIT=%n
Environment=OPENSHIFT_INSTALL_RELEASE_IMAGE_MIRROR={{.ReleaseImageMirror}}
Environment=IMAGE_TYPE_ISO={{.ImageTypeISO}}
EnvironmentFile=/etc/assisted/rendezvous-host.env
EnvironmentFile=/usr/local/share/assisted-service/agent-images.env
EnvironmentFile=/usr/local/share/assisted-service/assisted-service.env
ExecStartPre=/bin/rm -f %t/%n.ctr-id
ExecStartPre=/usr/local/bin/wait-for-assisted-service.sh
ExecStart=podman run --net host --cidfile=%t/%n.ctr-id --cgroups=no-conmon --log-driver=journald --rm --pod-id-file=%t/assisted-service-pod.pod-id --replace --name=create-cluster-and-infraenv --restart=on-failure -v /etc/assisted/manifests:/manifests -v /etc/assisted/extra-manifests:/extra-manifests -v /etc/pki/ca-trust:/etc/pki/ca-trust:z {{ if .HaveMirrorConfig }}-v /etc/containers:/etc/containers{{ end }} --env SERVICE_BASE_URL --env OPENSHIFT_INSTALL_RELEASE_IMAGE_MIRROR --env IMAGE_TYPE_ISO $SERVICE_IMAGE /usr/local/bin/agent-installer-client register
ExecStart=podman run --net host --cidfile=%t/%n.ctr-id --cgroups=no-conmon --log-driver=journald --rm --pod-id-file=%t/assisted-service-pod.pod-id --replace --name=agent-register-cluster -v /etc/assisted/manifests:/manifests -v /etc/assisted/extra-manifests:/extra-manifests -v /etc/pki/ca-trust:/etc/pki/ca-trust:z {{ if .HaveMirrorConfig }}-v /etc/containers:/etc/containers{{ end }} --env SERVICE_BASE_URL --env OPENSHIFT_INSTALL_RELEASE_IMAGE_MIRROR $SERVICE_IMAGE /usr/local/bin/agent-installer-client registerCluster
ExecStop=/usr/bin/podman stop --ignore --cidfile=%t/%n.ctr-id
ExecStopPost=/usr/bin/podman rm -f --ignore --cidfile=%t/%n.ctr-id

KillMode=none
Type=oneshot
Restart=on-failure
RestartSec=30
RemainAfterExit=true

[Install]
Expand Down
@@ -0,0 +1,26 @@
[Unit]
Description=Service that registers the infraenv
Wants=network-online.target assisted-service.service
PartOf=assisted-service-pod.service
After=network-online.target assisted-service.service agent-register-cluster.service
ConditionPathExists=/etc/assisted/node0

[Service]
Environment=PODMAN_SYSTEMD_UNIT=%n
Environment=IMAGE_TYPE_ISO={{.ImageTypeISO}}
EnvironmentFile=/etc/assisted/rendezvous-host.env
EnvironmentFile=/usr/local/share/assisted-service/agent-images.env
EnvironmentFile=/usr/local/share/assisted-service/assisted-service.env
ExecStartPre=/bin/rm -f %t/%n.ctr-id
ExecStart=podman run --net host --cidfile=%t/%n.ctr-id --cgroups=no-conmon --log-driver=journald --rm --pod-id-file=%t/assisted-service-pod.pod-id --replace --name=agent-register-infraenv -v /etc/assisted/manifests:/manifests --env SERVICE_BASE_URL --env IMAGE_TYPE_ISO $SERVICE_IMAGE /usr/local/bin/agent-installer-client registerInfraEnv
ExecStop=/usr/bin/podman stop --ignore --cidfile=%t/%n.ctr-id
ExecStopPost=/usr/bin/podman rm -f --ignore --cidfile=%t/%n.ctr-id

KillMode=none
Type=oneshot
Restart=on-failure
RestartSec=30
RemainAfterExit=true

[Install]
WantedBy=multi-user.target
4 changes: 2 additions & 2 deletions data/data/agent/systemd/units/apply-host-config.service
@@ -1,9 +1,9 @@
[Unit]
Description=Service that applies host-specific configuration
Wants=network-online.target
Requires=create-cluster-and-infraenv.service
Requires=agent-register-infraenv.service
PartOf=assisted-service-pod.service
After=network-online.target create-cluster-and-infraenv.service
After=network-online.target agent-register-infraenv.service
ConditionPathExists=/etc/assisted/node0

[Service]
Expand Down
4 changes: 2 additions & 2 deletions data/data/agent/systemd/units/install-status.service
@@ -1,7 +1,7 @@
[Unit]
Description=Service that monitors host-specific configuration status
Wants=network-online.target create-cluster-and-infraenv.service
After=network-online.target create-cluster-and-infraenv.service
Wants=network-online.target agent-register-infraenv.service
After=network-online.target agent-register-infraenv.service
ConditionPathExists=/etc/assisted/node0

[Service]
Expand Down
3 changes: 2 additions & 1 deletion pkg/asset/agent/image/ignition.go
Expand Up @@ -249,11 +249,12 @@ func getDefaultEnabledServices() []string {
return []string{
"agent-interactive-console.service",
"agent-interactive-console-serial@.service",
"agent-register-infraenv.service",
"agent-register-cluster.service",
"agent.service",
"assisted-service-db.service",
"assisted-service-pod.service",
"assisted-service.service",
"create-cluster-and-infraenv.service",
"node-zero.service",
"multipathd.service",
"selinux.service",
Expand Down

0 comments on commit b48cf4a

Please sign in to comment.