Skip to content

Fix various bugs with displaying VM resources on the topology#6217

Open
fxiang1 wants to merge 2 commits into
stolostron:mainfrom
fxiang1:feng-vm-bug
Open

Fix various bugs with displaying VM resources on the topology#6217
fxiang1 wants to merge 2 commits into
stolostron:mainfrom
fxiang1:feng-vm-bug

Conversation

@fxiang1
Copy link
Copy Markdown
Contributor

@fxiang1 fxiang1 commented May 15, 2026

📝 Summary

Ticket Summary (Title):
ACM 2.17 some elements of a VirtualMachine are not displayed correctly

Summary of fix:

  • Fixed Namespace node showing pending
  • Fixed VirtualMachineInstance node being duplicated and the status flipping between the two
  • Fixed ControllerRevision node being duplicated and not showing the status
  • The DataVolume and PVC showing pending is not fixed, opened a new Epic https://redhat.atlassian.net/browse/ACM-34113 for this

Ticket Link:
https://redhat.atlassian.net/browse/ACM-34020

Type of Change:

  • 🐞 Bug Fix
  • ✨ Feature
  • 🔧 Refactor
  • 💸 Tech Debt
  • 🧪 Test-related
  • 📄 Docs

✅ Checklist

General

  • PR title follows the convention (e.g. ACM-12340 Fix bug with...)
  • Code builds and runs locally without errors
  • No console logs, commented-out code, or unnecessary files
  • All commits are meaningful and well-labeled
  • All new display strings are externalized for localization (English only)
  • (Nice to have) JSDoc comments added for new functions and interfaces

If Feature

  • UI/UX reviewed (if applicable)
  • All acceptance criteria met
  • Unit test coverage added or updated
  • Relevant documentation or comments included

If Bugfix

  • Root cause and fix summary are documented in the ticket (for future reference / errata)
  • Fix tested thoroughly and resolves the issue
  • Test(s) added to prevent regression

🗒️ Notes for Reviewers

Before:
image

After:
image

Summary by CodeRabbit

  • New Features

    • Improved application topology so VirtualMachine, VirtualMachineInstance, and ControllerRevision are represented and attached correctly (VM-owned revisions/VMIs are shown as children, not standalone).
    • ControllerRevision expansion now supports multiple VM-associated revision children where applicable.
  • Bug Fixes

    • More reliable cluster targeting for ApplicationSet apps, including fallback resolution from the application name.
  • Tests

    • Added tests covering VM/ VMI/ ControllerRevision topology behaviors and controller-revision child generation.

Signed-off-by: fxiang1 <fxiang@redhat.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 15, 2026

📝 Walkthrough

Walkthrough

Adds VM-aware controllerRevision expansion and VMI/revision deduplication to ApplicationSet topology generation, and enhances cluster resolution by letting getAppTargetCluster fall back to the application name when destination lookup fails; includes unit tests for controllerRevision and VM/VMI behavior.

Changes

ApplicationSet VirtualMachine Topology

Layer / File(s) Summary
Cluster resolution utilities
frontend/src/routes/Applications/ApplicationDetails/ApplicationTopology/model/topologyUtils.ts, frontend/src/routes/Applications/ApplicationDetails/ApplicationTopology/model/resourceStatusesAppSet.ts
getAppTargetCluster gains optional appName fallback and new findClusterInAppName helper; fetchSingleAppResources now passes appName when resolving a target cluster.
ControllerRevision child creation and tests
frontend/src/routes/Applications/ApplicationDetails/ApplicationTopology/model/topologyUtils.ts, frontend/src/routes/Applications/ApplicationDetails/ApplicationTopology/model/topologyUtils.test.ts
createControllerRevisionChild accepts optional vmControllerRevisions?: Map<string,string[]> and expands virtualmachine parents into multiple controllerrevision children when mappings exist; tests added for generic, matched, and unmatched cases.
ApplicationSet topology VM and revision integration
frontend/src/routes/Applications/ApplicationDetails/ApplicationTopology/model/topologyAppSet.ts, frontend/src/routes/Applications/ApplicationDetails/ApplicationTopology/model/topologyAppSet.test.ts
processResources precomputes vmControllerRevisions, skips creating standalone VirtualMachineInstance nodes with kubevirt.io/vm and skips VM-owned ControllerRevision nodes, and passes the revisions map into createControllerRevisionChild; tests validate parent-child attachment and non-VM revision behavior.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • stolostron/console#6074: Modifies ApplicationSet status enrichment and resource fetching flow related to cluster-scoped status resolution used by ApplicationSet topology.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is partially related to the changeset—it refers to VM resource display issues, but lacks specificity about the three main fixes (VirtualMachineInstance duplication, ControllerRevision duplication, and Namespace pending state).
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.
Description check ✅ Passed PR description provides ticket link, change type, and notes for reviewers with before/after screenshots, but multiple checklist items remain unchecked.

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

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

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
Copy link
Copy Markdown

openshift-ci Bot commented May 15, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: fxiang1

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

The pull request process is described 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

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.

Actionable comments posted: 2

🤖 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/src/routes/Applications/ApplicationDetails/ApplicationTopology/model/topologyAppSet.test.ts`:
- Line 1437: The VM-owned ControllerRevision fixture names use only vmUid (e.g.,
the template string assigned to name: `revision-start-vm-${vmUid}-1`) but should
include the VM name segment; update those template strings to the documented
format by inserting the vmName variable before vmUid (e.g.,
`revision-start-vm-${vmName}-${vmUid}-1`) wherever the test creates
ControllerRevision fixtures (including the occurrence around the same pattern at
the other reported location).

In
`@frontend/src/routes/Applications/ApplicationDetails/ApplicationTopology/model/topologyAppSet.ts`:
- Around line 652-655: The regex used to extract the VM ControllerRevision UID
from deployableName (used when populating vmControllerRevisions) only matches
"...-vm-<uid>-<rev>" and therefore misses names that include the VM name segment
("...-vm-<vmName>-<uid>-<rev>"). Update the matching logic (the code referencing
deployableName and vmControllerRevisions.set) to accept an optional VM name
segment between "vm-" and the UID; for example change the pattern to allow one
segment before the UUID like
/.+-vm-(?:[^-]+-)?([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})-\d+$/
so uidMatch[1] still captures the UUID, and apply the same fix to the other
occurrence around lines where vmControllerRevisions is set (the second block
noted in the comment).
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 90dcc4ff-1899-4998-b869-74826c55684b

📥 Commits

Reviewing files that changed from the base of the PR and between f4dcdb0 and 5eafffc.

📒 Files selected for processing (5)
  • frontend/src/routes/Applications/ApplicationDetails/ApplicationTopology/model/resourceStatusesAppSet.ts
  • frontend/src/routes/Applications/ApplicationDetails/ApplicationTopology/model/topologyAppSet.test.ts
  • frontend/src/routes/Applications/ApplicationDetails/ApplicationTopology/model/topologyAppSet.ts
  • frontend/src/routes/Applications/ApplicationDetails/ApplicationTopology/model/topologyUtils.test.ts
  • frontend/src/routes/Applications/ApplicationDetails/ApplicationTopology/model/topologyUtils.ts

Signed-off-by: fxiang1 <fxiang@redhat.com>
@fxiang1
Copy link
Copy Markdown
Contributor Author

fxiang1 commented May 15, 2026

/retest

1 similar comment
@fxiang1
Copy link
Copy Markdown
Contributor Author

fxiang1 commented May 15, 2026

/retest

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant