Skip to content

OCPBUGS-86311: fix: validate agent-config interface names match networkConfig#10567

Open
chdeshpa-hue wants to merge 3 commits into
openshift:mainfrom
chdeshpa-hue:fix/agent-validate-interface-names-match-networkconfig
Open

OCPBUGS-86311: fix: validate agent-config interface names match networkConfig#10567
chdeshpa-hue wants to merge 3 commits into
openshift:mainfrom
chdeshpa-hue:fix/agent-validate-interface-names-match-networkconfig

Conversation

@chdeshpa-hue
Copy link
Copy Markdown
Contributor

@chdeshpa-hue chdeshpa-hue commented May 21, 2026

Summary

  • Add validateInterfaceNamesMatchNetworkConfig() to validateAgentHosts() in pkg/asset/agent/agentconfig/agenthosts.go that cross-validates hosts[].interfaces[].name values exist in hosts[].networkConfig interfaces
  • Error message lists available networkConfig interface names to guide users toward correct configuration
  • Fix 3 pre-existing test fixtures where interfaces[] names (enp3s1) did not match networkConfig names (eth0) — these were silently inconsistent before the new validation

Problem

openshift-install agent create image accepts agent-config.yaml where hosts[].interfaces[] names don't match hosts[].networkConfig interface names. At boot, the pre-network-manager-config.sh script uses interfaces[] names to find and rename .nmconnection files generated from networkConfig. When names mismatch:

  • sed replacements find zero matches (the script says "updated" but replaces nothing)
  • Connection profiles reference non-existent device names
  • Simple ethernet may work by accident (NetworkManager MAC fallback), but bonds, VLANs, and bridges fail completely with no connectivity and no useful error

Only the agent-config.yaml path is affected. The install-config.yaml path derives interface names FROM networkConfig in getInstallConfigDefaults(), so names always match by construction.

Test plan

  • New test: interface-name-mismatch-with-networkconfig — single ethernet, name mismatch rejected
  • New test: interface-name-matches-networkconfig — single ethernet, matching names pass
  • New test: bond-networkconfig-with-matching-interfaces — bond with 2 slaves, matching names pass
  • New test: bond-networkconfig-with-mismatched-interfaces — bond with 2 slaves, mismatch rejected
  • All 24 unit tests pass (20 pre-existing + 4 new)
  • Edge cases: no networkConfig (skipped), no interfaces (skipped), unparseable YAML (skipped), unnamed interfaces (skipped)
  • Runtime-verified: built patched binary, tested on Nutanix bastion with mismatched bond config (correctly rejected) and matching bond config (correctly accepted)

Made with Cursor

Summary by CodeRabbit

  • New Features

    • Emit a non-blocking warning (in both install and add-nodes flows) when a host's interface name is not present in its provided network configuration; warnings are skipped for empty network payloads or empty interface names and ignore malformed YAML.
  • Tests

    • Expanded coverage for interface-name checks across install vs add-nodes flows, bonded interfaces, empty/malformed network payloads, and matching vs mismatched scenarios.

openshift-install agent does not cross-validate that interface names in
hosts[].interfaces[] match the names used in hosts[].networkConfig. When
names mismatch, the pre-network-manager-config.sh script silently fails
to rename .nmconnection files at boot time, causing complete network
failure for bond/VLAN/bridge topologies with no diagnostic.

Add validateInterfaceNamesMatchNetworkConfig() to validateAgentHosts()
that ensures every interfaces[].name exists in the networkConfig
interfaces list. The error message lists valid networkConfig names to
guide users toward the correct configuration.

Only the agent-config.yaml path is affected; install-config.yaml derives
interface names from networkConfig automatically, so names always match.

Co-authored-by: Cursor <cursoragent@cursor.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 21, 2026

Note

.coderabbit.yaml has unrecognized properties

CodeRabbit is using all valid settings from your configuration. Unrecognized properties (listed below) have been ignored and may indicate typos or deprecated fields that can be removed.

⚠️ Parsing warnings (1)
Validation error: Unrecognized key: "tools"
⚙️ Configuration instructions
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
📝 Walkthrough

Walkthrough

Adds runtime warnings in AgentHosts.Generate to Warnf when a host interface name (from agent-config or add-nodes-config) is not present in that host's NMState networkConfig YAML; tests and fixtures expanded for bond, match/mismatch, empty, and malformed network-config cases.

Changes

Interface-name warning and tests

Layer / File(s) Summary
AgentHosts Generate wiring and warning
pkg/asset/agent/agentconfig/agenthosts.go
After appending hosts from agentConfig.Config.Hosts (install) or addNodesConfig.Config.Hosts (add-nodes), call warnInterfaceNamesNotInNetworkConfig for each host; add helper that parses host.NetworkConfig.Raw as NMState interfaces[].name and Warnfs for any non-empty host interface Name not present in that set (silently ignores YAML unmarshal errors and no-ops on empty inputs).
Tests, fixtures and helpers
pkg/asset/agent/agentconfig/agenthosts_test.go
Add agentNetworkConfigBond fixture; switch generated host interface names to eth0; extend TestAgentHosts_Generate with match/mismatch and bonded cases plus install/add-nodes scenarios; add helpers getAgentConfigBondMatching, getAgentConfigBondMismatched, getAgentConfigMismatchedInterfaceName, getAgentConfigMatchingInterfaceName, HostBuilder.rawNetworkConfig, and edge-case generators for empty and malformed network config.

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 14 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (14 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: validating that agent-config interface names match networkConfig names, addressing OCPBUGS-86311.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed All 29 test names in agenthosts_test.go are static, descriptive strings with no dynamic content like UUIDs, timestamps, IPs, or generated identifiers. Uses standard Go testing (t.Run), not Ginkgo.
Test Structure And Quality ✅ Passed The test file uses standard Go table-driven tests with testing.T, not Ginkgo. The custom check applies only to Ginkgo tests, which this PR doesn't contain.
Microshift Test Compatibility ✅ Passed PR modifies only standard Go unit tests (pkg/asset/agent/agentconfig/agenthosts_test.go), not Ginkgo e2e tests. Check is not applicable.
Single Node Openshift (Sno) Test Compatibility ✅ Passed PR adds only standard Go unit tests to pkg/asset/agent/agentconfig/agenthosts_test.go, not Ginkgo e2e tests. SNO compatibility check only applies to Ginkgo e2e tests.
Topology-Aware Scheduling Compatibility ✅ Passed PR modifies installer provisioning config validation, not deployment manifests or scheduling constraints. No pod affinity, topology spread, or replica topology-dependence introduced.
Ote Binary Stdout Contract ✅ Passed PR modifies agent-config asset generation code, not an OTE test binary. Uses logrus (writes to stderr by default), no fmt.Print or klog to stdout. No OTE stdout contract violations.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed PR adds only standard Go unit tests (TestAgentHosts_Generate), not Ginkgo e2e tests. Check is not applicable.
No-Weak-Crypto ✅ Passed No weak crypto patterns found. Changes add configuration validation using YAML unmarshaling and basic string comparison only.
Container-Privileges ✅ Passed PR modifies only Go source files for network interface validation logic; no container/K8s manifests, privilege escalation settings, or privileged container configurations are present or modified.
No-Sensitive-Data-In-Logs ✅ Passed The new warning function logs only interface names (e.g., eth0, bond0) and interface lists from networkConfig - non-sensitive network identifiers. Sensitive data like BMC credentials are not logged.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.12.2)

Error: can't load config: unsupported version of the configuration: "" See https://golangci-lint.run/docs/product/migration-guide for migration instructions
The command is terminated due to an error: can't load config: unsupported version of the configuration: "" See https://golangci-lint.run/docs/product/migration-guide for migration instructions


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@openshift-ci openshift-ci Bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label May 21, 2026
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 21, 2026

Hi @chdeshpa-hue. Thanks for your PR.

I'm waiting for a openshift member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

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 kubernetes-sigs/prow repository.

@chdeshpa-hue chdeshpa-hue changed the title fix: validate agent-config interface names match networkConfig OCPBUGS-86311: fix: validate agent-config interface names match networkConfig May 21, 2026
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label May 21, 2026
@openshift-ci-robot
Copy link
Copy Markdown
Contributor

@chdeshpa-hue: This pull request references Jira Issue OCPBUGS-86311, which is invalid:

  • expected the bug to target the "5.0.0" version, but no target version was set

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

The bug has been updated to refer to the pull request using the external bug tracker.

Details

In response to this:

Summary

  • Add validateInterfaceNamesMatchNetworkConfig() to validateAgentHosts() in pkg/asset/agent/agentconfig/agenthosts.go that cross-validates hosts[].interfaces[].name values exist in hosts[].networkConfig interfaces
  • Error message lists available networkConfig interface names to guide users toward correct configuration
  • Fix 3 pre-existing test fixtures where interfaces[] names (enp3s1) did not match networkConfig names (eth0) — these were silently inconsistent before the new validation

Problem

openshift-install agent create image accepts agent-config.yaml where hosts[].interfaces[] names don't match hosts[].networkConfig interface names. At boot, the pre-network-manager-config.sh script uses interfaces[] names to find and rename .nmconnection files generated from networkConfig. When names mismatch:

  • sed replacements find zero matches (the script says "updated" but replaces nothing)
  • Connection profiles reference non-existent device names
  • Simple ethernet may work by accident (NetworkManager MAC fallback), but bonds, VLANs, and bridges fail completely with no connectivity and no useful error

Only the agent-config.yaml path is affected. The install-config.yaml path derives interface names FROM networkConfig in getInstallConfigDefaults(), so names always match by construction.

Test plan

  • New test: interface-name-mismatch-with-networkconfig — single ethernet, name mismatch rejected
  • New test: interface-name-matches-networkconfig — single ethernet, matching names pass
  • New test: bond-networkconfig-with-matching-interfaces — bond with 2 slaves, matching names pass
  • New test: bond-networkconfig-with-mismatched-interfaces — bond with 2 slaves, mismatch rejected
  • All 24 unit tests pass (20 pre-existing + 4 new)
  • Edge cases: no networkConfig (skipped), no interfaces (skipped), unparseable YAML (skipped), unnamed interfaces (skipped)
  • Runtime-verified: built patched binary, tested on Nutanix bastion with mismatched bond config (correctly rejected) and matching bond config (correctly accepted)

Made with Cursor

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.

@openshift-ci-robot openshift-ci-robot added the jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. label May 21, 2026
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 21, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign zaneb for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci Bot requested review from bfournie and rwsu May 21, 2026 09:42
@chdeshpa-hue
Copy link
Copy Markdown
Contributor Author

/jira refresh

@openshift-ci-robot openshift-ci-robot added jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. and removed jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels May 21, 2026
@openshift-ci-robot
Copy link
Copy Markdown
Contributor

@chdeshpa-hue: This pull request references Jira Issue OCPBUGS-86311, which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (5.0.0) matches configured target version for branch (5.0.0)
  • bug is in the state New, which is one of the valid states (NEW, ASSIGNED, POST)
Details

In response to this:

/jira refresh

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.

@chdeshpa-hue
Copy link
Copy Markdown
Contributor Author

cc: @rwsu @bfournie

if !ncNames[iface.Name] {
errMsg := "interface name \"" + iface.Name + "\" not found in networkConfig interfaces [" + strings.Join(ncNameList, ", ") + "]; " +
"the interfaces[].name values are logical names that must match the interface names used in networkConfig " +
"so that the MAC-to-interface mapping works correctly at boot time"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is true. Or rather, it is true that the names need to match for the MAC-to-interface mapping to work. But if the interface name correctly matches the one defined by the kernel (or if the nmstate uses identifier: mac-address), then you don't need the MAC-to-interface mapping in order for it to choose the right interface.

And in fact there is at least one important case where we rely on this: when using an unmodified baremetal IPI install-config to do an agent install without an agent-config.yaml. Baremetal IPI does not support a MAC-to-interface mapping, so the input must always match up to the true interface names. It does, however, require providing one MAC address to identify the host, and so when we internally generate the host list we just use a bogus name for that interface that doesn't match the ones in the nmstate config. This change will break that feature.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the thorough review @zaneb — both points are well taken.

You're right that the baremetal IPI → agent path (where getInstallConfigDefaults generates the fallback "boot" interface name at L276-280) would be broken by this validation. I missed that topology entirely — the validation assumed all interfaces[] entries are user-provided, which isn't true for that flow.

And I appreciate the clarification on the nmstate-as-opaque-blob principle. I can see how relying on parsing its internal structure creates a fragile coupling.

Given these constraints, would you be open to a narrower alternative?

Option A: Move the diagnostic to the boot script itself
Enhance pre-network-manager-config.sh to emit a clear error when sed finds zero matches during the rename step — something like "WARNING: interface 'foo' from agent-config not found in generated .nmconnection files". This keeps the installer from parsing nmstate at all and catches the failure at the point where it actually matters.

Option B: Warn-only at build time, scoped to agent-config.yaml path
Only run the check when interfaces[] comes from a user-provided agent-config.yaml (not from getInstallConfigDefaults), and emit a warning instead of a hard error. This still gives users early feedback for the common bond/VLAN misconfiguration case without blocking the baremetal IPI path.

The underlying problem we're solving is that bond/VLAN/bridge topologies silently get zero connectivity when names mismatch, and users get no useful diagnostic. Either option would address that without violating the design principles. Happy to rework the PR if either direction seems reasonable to you.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I like the Option B proposal.

Warning instead of error, and keeping it on the agent-config path rather than after data from install-config and agent-config are combined, would address my main concerns.

Better if we continue to treat the NMState as opaque and get the info we want from the keyfiles, but given that we are already not following this principle to some extent and that there will only be a warning instead of an error, I would not block on that.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @zaneb — I've updated the PR to implement your suggested approach:

  1. Warning instead of error — uses logrus.Warnf so it never blocks legitimate configs (e.g. identifier: mac-address cases)

  2. Scoped to user-authored hosts only — the hostsFromAgentConfig guard ensures it only fires for:

    • agent-config.yaml hosts (Install workflow)
    • nodes-config.yaml hosts (oc adm node-image create / AddNodes workflow — ref OCPBUGS-86420)

    It never fires for the getInstallConfigDefaults path (where the synthetic "boot" interface name is generated from baremetal IPI install-config)

  3. NMState treated as opaque — the check only extracts interface names (top-level interfaces[].name), consistent with the existing parsing already in the file. No deeper structural assumptions.

Test coverage includes the inert install-config path, AddNodes mismatch/match, empty interface names, and malformed networkConfig graceful handling.

}

var netInterfaces nmStateInterface
if err := yaml.Unmarshal(host.NetworkConfig.Raw, &netInterfaces); err != nil {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was part of our design principles that we treat nmstate as an opaque blob and not rely on knowing the internal structure of it, which may change over time.

Addresses @zaneb's review: the interface name cross-check against
networkConfig is now a warning (logrus.Warnf) instead of a hard error,
and runs for both agent-config.yaml and nodes-config.yaml (oc adm
node-image create) paths — but never for install-config baremetal hosts
where getInstallConfigDefaults generates synthetic interface names.

This ensures the baremetal IPI fallback path (which generates a bogus
"boot" interface name) is never affected, while giving users early
visibility into potential name mismatches that could cause connectivity
failures at boot time.

Test coverage added for:
- install-config inert path (no warning fires)
- AddNodes workflow mismatch (warns) and match (no warning)
- empty interface name (skipped gracefully)
- malformed networkConfig YAML (no panic)
- bond interfaces matching and mismatching

Ref: OCPBUGS-86420
Co-authored-by: Cursor <cursoragent@cursor.com>
@openshift-ci-robot
Copy link
Copy Markdown
Contributor

@chdeshpa-hue: This pull request references Jira Issue OCPBUGS-86311, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (5.0.0) matches configured target version for branch (5.0.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, POST)
Details

In response to this:

Summary

  • Add validateInterfaceNamesMatchNetworkConfig() to validateAgentHosts() in pkg/asset/agent/agentconfig/agenthosts.go that cross-validates hosts[].interfaces[].name values exist in hosts[].networkConfig interfaces
  • Error message lists available networkConfig interface names to guide users toward correct configuration
  • Fix 3 pre-existing test fixtures where interfaces[] names (enp3s1) did not match networkConfig names (eth0) — these were silently inconsistent before the new validation

Problem

openshift-install agent create image accepts agent-config.yaml where hosts[].interfaces[] names don't match hosts[].networkConfig interface names. At boot, the pre-network-manager-config.sh script uses interfaces[] names to find and rename .nmconnection files generated from networkConfig. When names mismatch:

  • sed replacements find zero matches (the script says "updated" but replaces nothing)
  • Connection profiles reference non-existent device names
  • Simple ethernet may work by accident (NetworkManager MAC fallback), but bonds, VLANs, and bridges fail completely with no connectivity and no useful error

Only the agent-config.yaml path is affected. The install-config.yaml path derives interface names FROM networkConfig in getInstallConfigDefaults(), so names always match by construction.

Test plan

  • New test: interface-name-mismatch-with-networkconfig — single ethernet, name mismatch rejected
  • New test: interface-name-matches-networkconfig — single ethernet, matching names pass
  • New test: bond-networkconfig-with-matching-interfaces — bond with 2 slaves, matching names pass
  • New test: bond-networkconfig-with-mismatched-interfaces — bond with 2 slaves, mismatch rejected
  • All 24 unit tests pass (20 pre-existing + 4 new)
  • Edge cases: no networkConfig (skipped), no interfaces (skipped), unparseable YAML (skipped), unnamed interfaces (skipped)
  • Runtime-verified: built patched binary, tested on Nutanix bastion with mismatched bond config (correctly rejected) and matching bond config (correctly accepted)

Made with Cursor

Summary by CodeRabbit

  • New Features

  • Emit a non-blocking warning when a host's interface name doesn't match logical names in its supplied network configuration—only for hosts coming from user/agent-provided config.

  • Tests

  • Expanded test coverage for interface-name checks across install vs add-nodes flows, bonded interfaces, empty or malformed network payloads, and matching vs mismatched scenarios.

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.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
pkg/asset/agent/agentconfig/agenthosts.go (1)

182-217: 💤 Low value

Consider deduplicating warnings per host.

The warning logic emits one Warnf per mismatched interface. If a host has multiple mismatched interfaces, this produces multiple log lines with the same networkConfig list. Consider collecting all mismatched names and emitting a single warning per host.

📋 Example refactor to deduplicate warnings
+	var mismatched []string
 	for _, iface := range host.Interfaces {
 		if iface.Name == "" {
 			continue
 		}
 		if !ncNames[iface.Name] {
-			logrus.Warnf("agent-config: interface name %q not found in networkConfig interfaces %v; "+
-				"connectivity may fail if interface names do not match at boot time",
-				iface.Name, ncNameList)
+			mismatched = append(mismatched, iface.Name)
 		}
 	}
+	if len(mismatched) > 0 {
+		logrus.Warnf("agent-config: interface names %v not found in networkConfig interfaces %v; "+
+			"connectivity may fail if interface names do not match at boot time",
+			mismatched, ncNameList)
+	}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/asset/agent/agentconfig/agenthosts.go` around lines 182 - 217, In
warnInterfaceNamesNotInNetworkConfig, instead of calling logrus.Warnf for each
mismatched iface, collect mismatched interface names (e.g. into a slice like
mismatchedNames) while iterating host.Interfaces (skip empty names and use
ncNames to check membership), and after the loop emit a single logrus.Warnf that
includes the host identifier, the deduplicated mismatchedNames and the
ncNameList; ensure you only log when mismatchedNames is non-empty to preserve
the existing early-return behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@pkg/asset/agent/agentconfig/agenthosts.go`:
- Around line 182-217: In warnInterfaceNamesNotInNetworkConfig, instead of
calling logrus.Warnf for each mismatched iface, collect mismatched interface
names (e.g. into a slice like mismatchedNames) while iterating host.Interfaces
(skip empty names and use ncNames to check membership), and after the loop emit
a single logrus.Warnf that includes the host identifier, the deduplicated
mismatchedNames and the ncNameList; ensure you only log when mismatchedNames is
non-empty to preserve the existing early-return behavior.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: b97e3420-d29f-4dd5-85c6-5cc36f9f770d

📥 Commits

Reviewing files that changed from the base of the PR and between 5497dd0 and 94d155e.

📒 Files selected for processing (2)
  • pkg/asset/agent/agentconfig/agenthosts.go
  • pkg/asset/agent/agentconfig/agenthosts_test.go

@zaneb
Copy link
Copy Markdown
Member

zaneb commented Jun 4, 2026

/ok-to-test

@openshift-ci openshift-ci Bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jun 4, 2026
if len(a.Hosts) > 0 {
// nodes-config.yaml hosts are user-authored like agent-config.yaml hosts,
// unlike install-config hosts which have code-generated interface names.
a.hostsFromAgentConfig = true
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems a bit clunky. Could we not just do the validation here directly?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done — good call.

Removed the hostsFromAgentConfig field entirely. The warning is now called directly in Generate() at the two branches where we already know the hosts are user-authored (agent-config install path + AddNodes path). The install-config fallback (baremetal IPI with synthetic "boot" name) never reaches it, so no guard is needed.

Net: −14 lines, +8 lines, one fewer struct field, same behavior.

Address reviewer feedback: instead of a hostsFromAgentConfig bool flag
checked inside the generic validation loop, call the warning directly in
Generate() at the two branches where user-authored hosts are already
known (agent-config and AddNodes paths).

The install-config fallback path (baremetal IPI with synthetic "boot"
interface name) never reaches the warning call, so no guard is needed.

Co-authored-by: Cursor <cursoragent@cursor.com>
@chdeshpa-hue
Copy link
Copy Markdown
Contributor Author

/retest-required

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
pkg/asset/agent/agentconfig/agenthosts.go (1)

206-208: ⚡ Quick win

Include hostname and make warning prefix more generic.

The warning message could be more helpful:

  1. It doesn't include host.Hostname, making it hard to identify which host has the issue when multiple hosts are configured.
  2. The "agent-config:" prefix is misleading when the warning is triggered from the AddNodes workflow (line 97).
♻️ Suggested improvement
 		if !ncNames[iface.Name] {
-			logrus.Warnf("agent-config: interface name %q not found in networkConfig interfaces %v; "+
+			logrus.Warnf("host %q: interface name %q not found in networkConfig interfaces %v; "+
 				"connectivity may fail if interface names do not match at boot time",
-				iface.Name, ncNameList)
+				host.Hostname, iface.Name, ncNameList)
 		}

This makes it clear which host has the issue and works for both agent-config and add-nodes-config sources.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/asset/agent/agentconfig/agenthosts.go` around lines 206 - 208, Update the
warning log in agenthosts.go to include the host's hostname and use a generic
prefix instead of "agent-config"; when emitting the message that currently
references iface.Name and ncNameList, also include host.Hostname and replace
"agent-config:" with a neutral prefix like "host-config:" or "host:" so the
warning applies correctly for both the agent-config and AddNodes workflows
(refer to the log call that uses logrus.Warnf with iface.Name, ncNameList and
the host variable).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@pkg/asset/agent/agentconfig/agenthosts.go`:
- Around line 206-208: Update the warning log in agenthosts.go to include the
host's hostname and use a generic prefix instead of "agent-config"; when
emitting the message that currently references iface.Name and ncNameList, also
include host.Hostname and replace "agent-config:" with a neutral prefix like
"host-config:" or "host:" so the warning applies correctly for both the
agent-config and AddNodes workflows (refer to the log call that uses
logrus.Warnf with iface.Name, ncNameList and the host variable).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 45ba9e69-308f-4ea0-94c2-c0539f6f498e

📥 Commits

Reviewing files that changed from the base of the PR and between 94d155e and f8e0958.

📒 Files selected for processing (1)
  • pkg/asset/agent/agentconfig/agenthosts.go

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented Jun 8, 2026

@chdeshpa-hue: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-agent-compact-ipv4-appliance-diskimage f8e0958 link false /test e2e-agent-compact-ipv4-appliance-diskimage
ci/prow/e2e-agent-two-node-fencing-ipv4 f8e0958 link false /test e2e-agent-two-node-fencing-ipv4
ci/prow/e2e-agent-compact-ipv6-minimaliso f8e0958 link false /test e2e-agent-compact-ipv6-minimaliso
ci/prow/e2e-agent-compact-ipv4-rhel10-techpreview f8e0958 link false /test e2e-agent-compact-ipv4-rhel10-techpreview

Full PR test history. Your PR dashboard.

Details

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 kubernetes-sigs/prow repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. ok-to-test Indicates a non-member PR verified by an org member that is safe to test.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants