Skip to content

Commit 76e4b01

Browse files
Merge pull request #9584 from andfasano/agent-ui-show-url
AGENT-467: show the agent ui url when available
2 parents b6f0232 + 81c93de commit 76e4b01

File tree

5 files changed

+42
-11
lines changed

5 files changed

+42
-11
lines changed

cmd/openshift-install/testdata/agent/unconfigured-ignition/configurations/interactive.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,4 +94,6 @@ SERVICE_BASE_URL=http://{{.RendezvousIP}}:8090/
9494
IMAGE_SERVICE_BASE_URL=http://{{.RendezvousIP}}:8888/
9595
PULL_SECRET_TOKEN=
9696
USER_AUTH_TOKEN=
97-
WORKFLOW_TYPE=install-interactive-disconnected
97+
WORKFLOW_TYPE=install-interactive-disconnected
98+
AIUI_APP_API_URL=http://{{.RendezvousIP}}:8090/
99+
AIUI_URL=http://{{.RendezvousIP}}:3001/

data/data/agent/files/usr/local/bin/install-status.sh

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,20 @@
22

33
# shellcheck disable=SC1091
44
source "issue_status.sh"
5+
source "/etc/assisted/rendezvous-host.env"
56

67
inactive_services() {
7-
local services="assisted-service.service agent-register-infraenv.service apply-host-config.service"
8-
if [ ! -e "/etc/assisted/add-nodes.env" ]; then
9-
# install workflow
10-
services+=" agent-register-cluster.service start-cluster-installation.service"
11-
else
8+
local services="assisted-service.service"
9+
10+
if [ -f "/etc/assisted/interactive-ui" ]; then
11+
# interactive workflow
12+
services+=" agent-start-ui.service"
13+
elif [ -f "/etc/assisted/add-nodes.env" ]; then
1214
# add nodes workflow
13-
services+=" agent-import-cluster.service agent-add-node.service"
15+
services+=" agent-import-cluster.service agent-register-infraenv.service apply-host-config.service agent-add-node.service"
16+
else
17+
# install workflow
18+
services+=" agent-register-cluster.service agent-register-infraenv.service apply-host-config.service start-cluster-installation.service"
1419
fi
1520
for s in ${services}; do
1621
if ! systemctl is-active "${s}" >/dev/null; then
@@ -46,8 +51,18 @@ check_host_config() {
4651
fi
4752
}
4853

54+
check_ui() {
55+
local ui_issue="90_ui-availability"
56+
if systemctl is-active --quiet "agent-start-ui"; then
57+
echo "\e{green}Please go to \e{lightgreen}$AIUI_URL\e{reset}\e{green} in your browser to continue the installation\e{reset}" | set_issue "${ui_issue}"
58+
else
59+
clear_issue "${ui_issue}"
60+
fi
61+
}
62+
4963
while true; do
5064
check_services
5165
check_host_config
66+
check_ui
5267
sleep 5
5368
done

data/data/agent/systemd/units/agent-start-ui.service.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ EnvironmentFile=/usr/local/share/assisted-service/agent-images.env
1515
EnvironmentFile=/etc/assisted/rendezvous-host.env
1616
ExecStartPre=/bin/rm -f %t/%n.ctr-id
1717
ExecStartPre=/usr/local/bin/wait-for-assisted-service.sh
18-
ExecStart=/bin/bash -c "AIUI_APP_API_URL=${SERVICE_BASE_URL} podman run --net host --cidfile=%t/%n.ctr-id --cgroups=no-conmon --log-driver=journald --restart=on-failure:10 --pod-id-file=%t/assisted-service-pod.pod-id --replace --name=agent-installer-ui --env AIUI_APP_API_URL $INSTALLER_UI_IMAGE"
18+
ExecStart=/usr/bin/podman run --net host --cidfile=%t/%n.ctr-id --cgroups=no-conmon --log-driver=journald --restart=on-failure:10 --pod-id-file=%t/assisted-service-pod.pod-id --replace -d --name=agent-installer-ui --env AIUI_APP_API_URL $INSTALLER_UI_IMAGE
1919
ExecStop=/usr/bin/podman stop --ignore --cidfile=%t/%n.ctr-id
2020
ExecStopPost=/usr/bin/podman rm -f --ignore --cidfile=%t/%n.ctr-id
2121

data/data/agent/systemd/units/install-status.service

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[Unit]
22
Description=Service that monitors host-specific configuration status
3-
Wants=network-online.target agent-register-infraenv.service
4-
After=network-online.target agent-register-infraenv.service
3+
Wants=network-online.target assisted-service-pod.service
4+
After=network-online.target assisted-service-pod.service
55
ConditionPathExists=/etc/assisted/node0
66

77
[Service]

pkg/asset/agent/image/ignition.go

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,13 +464,27 @@ func getRendezvousHostEnv(serviceProtocol, nodeZeroIP, agentAuthtoken, userAuthT
464464
// and ensure successful authentication.
465465
// In the absence of PULL_SECRET_TOKEN, the cluster installation will wait forever.
466466

467-
return fmt.Sprintf(`NODE_ZERO_IP=%s
467+
rendezvousHostEnv := fmt.Sprintf(`NODE_ZERO_IP=%s
468468
SERVICE_BASE_URL=%s
469469
IMAGE_SERVICE_BASE_URL=%s
470470
PULL_SECRET_TOKEN=%s
471471
USER_AUTH_TOKEN=%s
472472
WORKFLOW_TYPE=%s
473473
`, nodeZeroIP, serviceBaseURL.String(), imageServiceBaseURL.String(), agentAuthtoken, userAuthToken, workflowType)
474+
475+
if workflowType == workflow.AgentWorkflowTypeInstallInteractiveDisconnected {
476+
uiBaseURL := url.URL{
477+
Scheme: serviceProtocol,
478+
Host: net.JoinHostPort(nodeZeroIP, "3001"),
479+
Path: "/",
480+
}
481+
uiEnv := fmt.Sprintf(`AIUI_APP_API_URL=%s
482+
AIUI_URL=%s
483+
`, serviceBaseURL.String(), uiBaseURL.String())
484+
rendezvousHostEnv = fmt.Sprintf("%s%s", rendezvousHostEnv, uiEnv)
485+
}
486+
487+
return rendezvousHostEnv
474488
}
475489

476490
func getAddNodesEnv(clusterInfo joiner.ClusterInfo, authTokenExpiry string) string {

0 commit comments

Comments
 (0)