Skip to content

CONSOLE-5284: Put new node inventory items behind tech-preview#16414

Open
jeff-phillips-18 wants to merge 1 commit intoopenshift:mainfrom
jeff-phillips-18:node-inventory-items-flagged
Open

CONSOLE-5284: Put new node inventory items behind tech-preview#16414
jeff-phillips-18 wants to merge 1 commit intoopenshift:mainfrom
jeff-phillips-18:node-inventory-items-flagged

Conversation

@jeff-phillips-18
Copy link
Copy Markdown
Member

@jeff-phillips-18 jeff-phillips-18 commented May 8, 2026

Analysis / Root cause:
New node inventory items (bare metal hardware metrics and virtual machines) need to be gated behind the tech-preview NODE_MGMT_V1 feature flag as part of the node management v1 feature rollout.

Solution description:

  • Added FLAG_NODE_MGMT_V1 flag check to the node dashboard InventoryCard component
  • Wrapped BareMetalInventoryItems and virtual machine inventory items in a conditional render based on the flag
  • This ensures the new inventory items (disks, NICs, CPUs, and VMs) are only displayed when the node management v1 feature is enabled via tech-preview

**Screenshots **:

*** Before / With Tech-Preview:
image

*** After / without Tech-Preview
image

Test setup:

  1. Ensure a cluster with nodes is available
  2. Test with the NODE_MGMT_V1 feature flag both enabled and disabled
  3. For bare metal tests, ensure a node with an associated BareMetalHost resource
  4. For VM tests, ensure KubeVirt plugin is active and VMs are scheduled on the node

Test cases:

  • With NODE_MGMT_V1 flag disabled: BareMetalInventoryItems and VM inventory items should not be displayed on node dashboard
  • With NODE_MGMT_V1 flag enabled: BareMetalInventoryItems (disks, NICs, CPUs) should be displayed when a BareMetalHost is associated with the node
  • With NODE_MGMT_V1 flag enabled: VM inventory count should be displayed when KubeVirt plugin is active and VMs exist on the node
  • Pod inventory item continues to display correctly regardless of flag state

Browser conformance:

  • Chrome
  • Firefox
  • Safari (or Epiphany on Linux)

Additional info:
This change is part of the larger node management v1 feature work tracked in CONSOLE-5284. The feature flag allows for controlled rollout and testing of the new inventory items.

Reviewers and assignees:
/cc @jhadvig

Summary by CodeRabbit

  • New Features
    • Inventory section display is now feature-gated, enabling selective visibility of node management and virtual machine inventory details.

@openshift-ci openshift-ci Bot requested a review from jhadvig May 8, 2026 13:45
@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 8, 2026
@openshift-ci-robot
Copy link
Copy Markdown
Contributor

openshift-ci-robot commented May 8, 2026

@jeff-phillips-18: This pull request references CONSOLE-5284 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the bug to target either version "5.0." or "openshift-5.0.", but it targets "openshift-4.22" instead.

Details

In response to this:

Analysis / Root cause:
New node inventory items (bare metal hardware metrics and virtual machines) need to be gated behind the tech-preview NODE_MGMT_V1 feature flag as part of the node management v1 feature rollout.

Solution description:

  • Added FLAG_NODE_MGMT_V1 flag check to the node dashboard InventoryCard component
  • Wrapped BareMetalInventoryItems and virtual machine inventory items in a conditional render based on the flag
  • This ensures the new inventory items (disks, NICs, CPUs, and VMs) are only displayed when the node management v1 feature is enabled via tech-preview

**Screenshots **:

*** Before / With Tech-Preview:
image

*** After / without Tech-Preview
image

Test setup:

  1. Ensure a cluster with nodes is available
  2. Test with the NODE_MGMT_V1 feature flag both enabled and disabled
  3. For bare metal tests, ensure a node with an associated BareMetalHost resource
  4. For VM tests, ensure KubeVirt plugin is active and VMs are scheduled on the node

Test cases:

  • With NODE_MGMT_V1 flag disabled: BareMetalInventoryItems and VM inventory items should not be displayed on node dashboard
  • With NODE_MGMT_V1 flag enabled: BareMetalInventoryItems (disks, NICs, CPUs) should be displayed when a BareMetalHost is associated with the node
  • With NODE_MGMT_V1 flag enabled: VM inventory count should be displayed when KubeVirt plugin is active and VMs exist on the node
  • Pod inventory item continues to display correctly regardless of flag state

Browser conformance:

  • Chrome
  • Firefox
  • Safari (or Epiphany on Linux)

Additional info:
This change is part of the larger node management v1 feature work tracked in CONSOLE-5284. The feature flag allows for controlled rollout and testing of the new inventory items.

Reviewers and assignees:
/cc @jhadvig

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 openshift-ci Bot added the component/core Related to console core functionality label May 8, 2026
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 8, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: jeff-phillips-18
Once this PR has been reviewed and has the lgtm label, please assign vikram-raj 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

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 8, 2026

📝 Walkthrough

Walkthrough

The InventoryCard component gates inventory display sections behind a feature flag (FLAG_NODE_MGMT_V1) using the useFlag hook. A new nodeMgmtV1Enabled boolean is introduced to conditionally render the BareMetalInventoryItems section and the virtual machines inventory group (including the VM count link and associated loading/error states). The underlying rendering logic for virtual machines remains unchanged; it is now nested under the feature-flag condition.

🚥 Pre-merge checks | ✅ 12
✅ Passed checks (12 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly references the Jira issue CONSOLE-5284 and accurately describes the main change: gating new node inventory items behind a feature flag for tech-preview rollout.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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 Custom check is not applicable. PR modifies only React/TypeScript component code and Jest tests, not Ginkgo tests. Ginkgo is a Go testing framework; this PR contains no Go test changes.
Test Structure And Quality ✅ Passed PR contains no Ginkgo test code. Custom check is for Ginkgo test quality; not applicable. PR modifies TypeScript/React components and includes Jest tests.
Microshift Test Compatibility ✅ Passed No Ginkgo e2e tests are added in this PR. The check applies only to new e2e tests; this PR modifies only a React component file (InventoryCard.tsx). Not applicable.
Single Node Openshift (Sno) Test Compatibility ✅ Passed PR adds no Ginkgo e2e tests—it modifies frontend React component InventoryCard.tsx only. SNO test compatibility check is not applicable to non-test code changes.
Topology-Aware Scheduling Compatibility ✅ Passed PR modifies only a React UI component with feature flag gating. No deployment manifests, operator code, controllers, or scheduling constraints. Not applicable to topology-aware scheduling check.
Ote Binary Stdout Contract ✅ Passed Check not applicable. PR modifies frontend React/TS component. OTE stdout contract applies to Go binaries (main, init, TestMain, suite setup), not frontend components.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed PR modifies React/TypeScript frontend component (InventoryCard.tsx), not adding Ginkgo e2e tests. Custom check is inapplicable to frontend code changes.
Description check ✅ Passed The PR description comprehensively covers all required template sections with clear analysis, solution details, screenshots, test setup, test cases, browser conformance verification, and additional context.

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

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

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

Copy link
Copy Markdown
Contributor

@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.

Actionable comments posted: 1

🤖 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.

Inline comments:
In
`@frontend/packages/console-app/src/components/nodes/node-dashboard/InventoryCard.tsx`:
- Around line 61-64: The VM watch hook useWatchVirtualMachineInstances is being
invoked unconditionally (creating side effects) even when FLAG_NODE_MGMT_V1 is
off; modify the hook or its usage so watching is gated by the feature flag:
update useWatchVirtualMachineInstances to accept an enabled boolean (e.g.,
useWatchVirtualMachineInstances(nodeName: string, enabled = true)) or, if you
cannot change the hook, only call it when nodeMgmtV1Enabled && showVms and
provide safe fallback values for vms, vmsLoaded, and vmsLoadError; in
InventoryCard.tsx replace the unconditional call with a guarded call using
nodeMgmtV1Enabled (and showVms) so the VM watch traffic only starts when
FLAG_NODE_MGMT_V1 is true.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Enterprise

Run ID: 3569d736-5944-47b0-ac9a-35fe6aa34216

📥 Commits

Reviewing files that changed from the base of the PR and between 2291108 and 7c39c36.

📒 Files selected for processing (1)
  • frontend/packages/console-app/src/components/nodes/node-dashboard/InventoryCard.tsx
📜 Review details
🔇 Additional comments (1)
frontend/packages/console-app/src/components/nodes/node-dashboard/InventoryCard.tsx (1)

95-124: Good boundary for tech-preview UI gating.

This correctly keeps Pods/Images always visible while placing bare metal + VM inventory UI behind nodeMgmtV1Enabled.

Comment on lines 61 to 64
const nodeMgmtV1Enabled = useFlag(FLAG_NODE_MGMT_V1);
const showVms = useIsKubevirtPluginActive();

const [vms, vmsLoaded, vmsLoadError] = useWatchVirtualMachineInstances(obj.metadata.name);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Gate VM watch side effects behind the feature flag, not just rendering.

Line 64 still invokes useWatchVirtualMachineInstances(...) unconditionally, so VM watch traffic can continue even when FLAG_NODE_MGMT_V1 is off. That weakens the tech-preview gate and adds avoidable API/RBAC churn.

Proposed fix
   const nodeMgmtV1Enabled = useFlag(FLAG_NODE_MGMT_V1);
   const showVms = useIsKubevirtPluginActive();
+  const shouldShowVms = nodeMgmtV1Enabled && showVms;

-  const [vms, vmsLoaded, vmsLoadError] = useWatchVirtualMachineInstances(obj.metadata.name);
+  const [vms, vmsLoaded, vmsLoadError] = useWatchVirtualMachineInstances(
+    obj.metadata.name,
+    shouldShowVms,
+  );
-              {showVms ? (
+              {shouldShowVms ? (
// If needed in NodeVmUtils:
useWatchVirtualMachineInstances(nodeName: string, enabled = true)
🤖 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
`@frontend/packages/console-app/src/components/nodes/node-dashboard/InventoryCard.tsx`
around lines 61 - 64, The VM watch hook useWatchVirtualMachineInstances is being
invoked unconditionally (creating side effects) even when FLAG_NODE_MGMT_V1 is
off; modify the hook or its usage so watching is gated by the feature flag:
update useWatchVirtualMachineInstances to accept an enabled boolean (e.g.,
useWatchVirtualMachineInstances(nodeName: string, enabled = true)) or, if you
cannot change the hook, only call it when nodeMgmtV1Enabled && showVms and
provide safe fallback values for vms, vmsLoaded, and vmsLoadError; in
InventoryCard.tsx replace the unconditional call with a guarded call using
nodeMgmtV1Enabled (and showVms) so the VM watch traffic only starts when
FLAG_NODE_MGMT_V1 is true.

@jeff-phillips-18 jeff-phillips-18 force-pushed the node-inventory-items-flagged branch from 7c39c36 to 8ac9499 Compare May 8, 2026 17:42
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 8, 2026

@jeff-phillips-18: The following test 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/frontend 8ac9499 link true /test frontend

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

component/core Related to console core functionality jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants