[release-4.21] OCPBUGS-85041: add --copy-network when manual network config is detected#1446
[release-4.21] OCPBUGS-85041: add --copy-network when manual network config is detected#1446rwsu wants to merge 2 commits into
Conversation
When the agent receives the install step, check for NetworkManager keyfiles created by the user during the agent-tui session before constructing the coreos-installer command. If found, append --copy-network to the installer args so that network configuration created via the agent-tui persists into the installed OS. The next-step-runner runs in a container with --pid=host but without /etc/NetworkManager/system-connections mounted. The host's NM connections directory is accessed via /proc/1/root/etc/NetworkManager/system-connections, which resolves to the host's filesystem when the container shares the host's PID namespace. The agent-tui log file (/var/log/agent/agent-tui.log) is used to confirm the TUI ran on this node (i.e. we are in an ABI workflow). If absent, the check is skipped entirely to avoid affecting non-ABI workflows. The /var/log directory is mounted into the next-step-runner container so this path is accessible directly. The mtime of the agent log directory (/var/log/agent) is used as the TUI start time reference. Auto-generated keyfiles (nm-initrd-generator, pre-network-manager-config.sh for NMState configs) are created before the agent-tui starts and are excluded by the mtime comparison. User-created keyfiles via nmtui can only appear at or after the TUI starts. The comparison uses >= rather than > to handle filesystems with second-level mtime precision. When NMState static configs are provided via agent-config.yaml, assisted-service already adds --copy-network via StaticNetworkConfig so those keyfiles do not need to be detected here. --copy-network is not added if already present in the installer args set via the API. Assisted-by: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Replace directory mtime with birth time (via djherbis/times) for determining when the agent-tui started. The log directory is created fresh by ExecStartPre in agent-interactive-console.service on each agent ISO boot, so its birth time is set exactly once at service startup and is unaffected by subsequent file creation inside the directory. Also fix gofmt import ordering and the test fixture ordering bug where Chtimes was called before WriteFile (making it a no-op since WriteFile would bump the directory mtime). Additional test coverage and log improvements: - Add unit test for keyfile created after TUI start (tuiStart + 3s) - Clarify comments to distinguish keyfile mtime from TUI start btime - Log keyfile mtime when a manually-created keyfile is found Assisted-by: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
|
@rwsu: This pull request references Jira Issue OCPBUGS-85041, which is invalid:
Comment The bug has been updated to refer to the pull request using the external bug tracker. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository: openshift/coderabbit/.coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
/jira refresh |
|
@rwsu: This pull request references Jira Issue OCPBUGS-85041, which is valid. The bug has been moved to the POST state. 7 validation(s) were run on this bug
Requesting review from QA contact: DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
/test e2e-agent-compact-ipv4 |
|
@rwsu: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
|
/verified by @rwsu |
|
@rwsu: This PR has been marked as verified by DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
/approve |
|
/lgtm |
|
/assign @gamli75 |
|
/approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: andfasano, gamli75, rwsu The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
This is a manual cherry-pick of #1416