1
0
mirror of https://github.com/openshift/installer.git synced 2026-02-05 06:46:36 +01:00

AGENT-1205: Extract agent-tui during boot for interactive workflow

Created agent-extract-tui.service for the interactive-disconnected
workflow to extract the agent-tui and nmstate libraries during boot.

The files are extracted from the agent-install-utils image. In the
interactive-disconnected workflow, the image is available on the
local container storage. They need to be extracted before the
agent-interactive-console.service starts.
This commit is contained in:
Richard Su
2025-06-13 17:16:59 -04:00
parent 7c5b649e64
commit 4879a6edb9
10 changed files with 57 additions and 3 deletions

View File

@@ -0,0 +1,19 @@
#!/bin/bash
set -xeuo pipefail
/usr/local/bin/get-container-images.sh
source /usr/local/share/assisted-service/agent-images.env
echo "Extracting agent-tui and libnmstate from agent-installer-utils image $AGENT_INSTALLER_UTILS_IMAGE"
container_id=$(podman create $AGENT_INSTALLER_UTILS_IMAGE)
mnt=$(podman mount $container_id)
cp ${mnt}/usr/bin/agent-tui /usr/local/bin
cp ${mnt}/usr/lib64/libnmstate.so.* /usr/local/bin
podman unmount $container_id
podman rm $container_id
restorecon -FRv /usr/local/bin

View File

@@ -14,5 +14,6 @@ SERVICE_IMAGE=$(image_for agent-installer-api-server)
CONTROLLER_IMAGE=$(image_for agent-installer-csr-approver)
INSTALLER_IMAGE=$(image_for agent-installer-orchestrator)
AGENT_DOCKER_IMAGE=$(image_for agent-installer-node-agent)
AGENT_INSTALLER_UTILS_IMAGE=$(image_for agent-installer-utils)
INSTALLER_UI_IMAGE=localhost/agent-installer-ui:latest
EOF

View File

@@ -0,0 +1,19 @@
[Unit]
Description=Extract agent-tui at boot
After=selinux.service
Before=agent-interactive-console.service
ConditionPathExists=/etc/assisted/rendezvous-host.env
ConditionPathExists=/etc/assisted/interactive-ui
[Service]
Type=oneshot
EnvironmentFile=/etc/assisted/rendezvous-host.env
# Temporarily load assisted-install-ui here. It was previously in agent-extract-tui.service in the
# agent-install-utils repo but that service is being removed.
# TODO: Remove after assisted-install-ui is productized.
ExecStartPre=/bin/bash -c "podman tag $(podman load -q -i /run/media/iso/images/assisted-install-ui/assisted-install-ui.tar | awk '{print $NF}') localhost/agent-installer-ui:latest"
ExecStart=/usr/local/bin/agent-extract-tui.sh
TimeoutStartSec=0
[Install]
WantedBy=getty@tty1.service

View File

@@ -1,6 +1,6 @@
[Unit]
Description=Get interactive user configuration at boot on %I
After=dev-fb0.device dev-%i.device network-pre.target NetworkManager.service pre-network-manager-config.service selinux.service
After=dev-fb0.device dev-%i.device network-pre.target NetworkManager.service pre-network-manager-config.service selinux.service agent-extract-tui.service
Before=serial-getty@%i.service network.target network.service agent.service node-zero.service NetworkManager-wait-online.service
ConditionPathExists=/usr/local/bin/agent-tui
ConditionPathExists=!/dev/fb0

View File

@@ -1,6 +1,6 @@
[Unit]
Description=Get interactive user configuration at boot
After=dev-fb0.device network-pre.target NetworkManager.service pre-network-manager-config.service selinux.service
After=dev-fb0.device network-pre.target NetworkManager.service pre-network-manager-config.service selinux.service agent-extract-tui.service
Before=getty@tty1.service network.target network.service agent.service node-zero.service NetworkManager-wait-online.service
ConditionPathExists=/usr/local/bin/agent-tui
ConditionPathExists=/dev/fb0

View File

@@ -60,4 +60,6 @@ so no connectivity checks to the release image is needed.
The interactive workflow allows the user to install a cluster by using the assisted UI running on the rendezvous node. In this workflow
the agent-tui is also used interactively to configure which node will be the rendezvous host, and to configure accordingly the other nodes.
* agent-extract-tui - extracts agent-tui and nmstate libraries from the agent-installer-utils image during boot
* agent-start-ui - runs the assisted UI on the rendezvous node

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 42 KiB

View File

@@ -379,6 +379,7 @@ func commonFiles() []string {
"/root/.docker/config.json",
"/root/assisted.te",
"/usr/local/bin/agent-config-image-wait.sh",
"/usr/local/bin/agent-extract-tui.sh",
"/usr/local/bin/agent-gather",
"/usr/local/bin/extract-agent.sh",
"/usr/local/bin/get-container-images.sh",

View File

@@ -194,6 +194,9 @@ func (a *UnconfiguredIgnition) Generate(_ context.Context, dependencies asset.Pa
interactiveUIFile := ignition.FileFromString("/etc/assisted/interactive-ui", "root", 0644, "")
config.Storage.Files = append(config.Storage.Files, interactiveUIFile)
// Enable the agent-extract-tui service
enabledServices = append(enabledServices, "agent-extract-tui.service")
// Let's disable the assisted-service authentication.
agentTemplateData.AuthType = "none"
}

View File

@@ -39,7 +39,16 @@ func TestUnconfiguredIgnition_Generate(t *testing.T) {
serviceEnabledMap: map[string]bool{
"pre-network-manager-config.service": false,
"oci-eval-user-data.service": true,
"agent-check-config-image.service": true},
"agent-check-config-image.service": true,
"agent-extract-tui.service": false},
},
{
name: "interactive-disconnected-workflow-should-have-agent-extract-tui-service-enabled",
overrideDeps: []asset.Asset{
&workflow.AgentWorkflow{Workflow: workflow.AgentWorkflowTypeInstallInteractiveDisconnected},
},
serviceEnabledMap: map[string]bool{
"agent-extract-tui.service": true},
},
{
name: "with-mirror-configs",