Skip to content

ACM-34695 Enable setting Automation templates for HCP clusters#6347

Open
jeswanke wants to merge 6 commits into
stolostron:mainfrom
jeswanke:ACM-34695-Enable-setting-Automation-templates-for-HCP-clusters
Open

ACM-34695 Enable setting Automation templates for HCP clusters#6347
jeswanke wants to merge 6 commits into
stolostron:mainfrom
jeswanke:ACM-34695-Enable-setting-Automation-templates-for-HCP-clusters

Conversation

@jeswanke

@jeswanke jeswanke commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

📝 Summary

CleanShot 2026-06-16 at 16 08 03@2x CleanShot 2026-06-16 at 16 11 07@2x

Ticket Summary (Title):
ACM-34695 Enable setting Automation templates for HCP clusters

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

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

Summary by CodeRabbit

  • New Features / Improvements
    • Enhanced KubeVirt managed cluster creation with automation-aware control data (automation controls can be conditionally included).
    • Updated the KubeVirt managed cluster template to show cluster-curator content earlier in the ManagedCluster spec.
  • Bug Fixes
    • Fixed the create-cluster UI flow to advance only after the automation template step is displayed.
  • Tests
    • Updated create-cluster integration tests to synchronize on the automation step before continuing.
    • Refreshed KubeVirt unit test coverage and adjusted PolicyWizard test mocking.

Signed-off-by: John Swanke <jswanke@redhat.com>
@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: ae1a0f52-f046-4eb5-a027-ad2e9790f359

📥 Commits

Reviewing files that changed from the base of the PR and between c4ffc4d and 49a921a.

📒 Files selected for processing (3)
  • frontend/src/routes/Infrastructure/Clusters/ManagedClusters/CreateCluster/CreateCluster.tsx
  • frontend/src/routes/Infrastructure/Clusters/ManagedClusters/CreateCluster/controlData/ControlDataKubeVirt.js
  • frontend/src/routes/Infrastructure/Clusters/ManagedClusters/CreateCluster/controlData/ControlDataKubeVirt.test.js
🚧 Files skipped from review as they are similar to previous changes (1)
  • frontend/src/routes/Infrastructure/Clusters/ManagedClusters/CreateCluster/controlData/ControlDataKubeVirt.js

📝 Walkthrough

Walkthrough

Adds an includeAutomation parameter (default true) to getControlDataKubeVirt, conditionally appending automationControlData to wizard steps. The KubeVirt Handlebars template gains a {{>clusterCurator}} partial rendered after hubAcceptsClient: true. Tests are expanded with comprehensive coverage—mocked OCP image metadata, snapshot updates with new parameter signature, and new unit tests for control inclusion, release-image filtering by hypershift supported versions, and OperatorAlert href behavior. Six integration test flows synchronize on the new automation step. A policy wizard test receives a missing nockIgnorePlacementDebug() call.

Changes

KubeVirt Automation Feature

Layer / File(s) Summary
Core automation parameter and conditional data inclusion
controlData/ControlDataKubeVirt.js
Adds automationControlData import from ControlDataHelpers. Extends getControlDataKubeVirt function signature with includeAutomation = true parameter (placed between hypershiftSupportedVersions and includeKlusterletAddonConfig). Conditionally spreads automationControlData(t) into the initial control array when includeAutomation is enabled.
Template partial and caller integration
templates/kubevirt-template.hbs, CreateCluster.tsx
kubevirt-template.hbs renders {{>clusterCurator}} partial after hubAcceptsClient: true in the ManagedCluster spec. CreateCluster.tsx updates the getControlDataKubeVirt call signature, reordering arguments and explicitly passing true for the automation parameter.
Unit test infrastructure and comprehensive assertions
controlData/ControlDataKubeVirt.test.js
Adds Testing Library render and screen imports. Defines mocked OCP image metadata and overrides LOAD_OCP_IMAGES mock in ControlDataHelpers. Introduces findControl helper for control lookup by id. Snapshot assertions updated to reflect new parameter ordering. New unit tests verify: automation controls conditionally omitted when disabled; warning controls omitted when absent; klusterlet addon config active state toggled by MCE flag; hosted-cluster wizard and storage mapping step properties including startWithNone flags and providerId connection; hypershift release-image filtering by supported versions (returning no images for empty input); OperatorAlert install-link href built from localCluster.consoleURL when present, empty when absent.
KubeVirt test flow automation step synchronization
CreateCluster.test.tsx
Six KubeVirt cluster creation test flows updated to await the "Automation template" screen and click "Next" before proceeding to cluster-creation nocks and "Create" action. Changes affect both external-infrastructure and no-external-infrastructure variants with and without credential interactions.

Policy Wizard Test Fix

Layer / File(s) Summary
Placement mock alignment in tolerations test
wizards/Governance/Policy/policyWizard.test.tsx
Added nockIgnorePlacementDebug() call before rendering PolicyWizard in the tolerations-persistence test case to align mock setup with adjacent placement-related tests.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 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 (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: enabling automation template functionality for HCP clusters, directly reflecting the primary modifications across test files, control data, and template configuration.
Description check ✅ Passed The description includes all required template sections (summary with ticket link, change type selection, general checklist items, and reviewer notes). Content is substantive with visual examples and context about implementation scope.
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.

✏️ 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

openshift-ci Bot commented Jun 16, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jeswanke

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

Signed-off-by: John Swanke <jswanke@redhat.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
frontend/src/routes/Infrastructure/Clusters/ManagedClusters/CreateCluster/controlData/ControlDataKubeVirt.test.js (1)

63-67: ⚡ Quick win

Cover the new includeAutomation = false branch.

Line 63 and Line 66 only validate the enabled path. Add one disabled-path assertion so regressions don’t silently re-introduce automation controls when explicitly turned off.

Proposed test addition
 it('generates correctly for MCE', () => {
   expect(getControlDataKubeVirt(t, handleModalToggle, true, <Warning />, false, localCluster, [])).toMatchSnapshot()
 })
+it('omits automation controls when includeAutomation is false', () => {
+  expect(getControlDataKubeVirt(t, handleModalToggle, false, <Warning />, true, {}, [])).toMatchSnapshot()
+})
🤖 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/src/routes/Infrastructure/Clusters/ManagedClusters/CreateCluster/controlData/ControlDataKubeVirt.test.js`
around lines 63 - 67, Add a new test case in the ManagedClusters test file to
verify the disabled automation path for the getControlDataKubeVirt function.
Create an additional it() test block that calls getControlDataKubeVirt with the
includeAutomation parameter (5th parameter) explicitly set to false, and include
a toMatchSnapshot() assertion to capture the expected output when automation is
disabled. This ensures regressions won't silently reintroduce automation
controls when they are meant to be turned off.
🤖 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
`@frontend/src/routes/Infrastructure/Clusters/ManagedClusters/CreateCluster/controlData/ControlDataKubeVirt.test.js`:
- Around line 63-67: Add a new test case in the ManagedClusters test file to
verify the disabled automation path for the getControlDataKubeVirt function.
Create an additional it() test block that calls getControlDataKubeVirt with the
includeAutomation parameter (5th parameter) explicitly set to false, and include
a toMatchSnapshot() assertion to capture the expected output when automation is
disabled. This ensures regressions won't silently reintroduce automation
controls when they are meant to be turned off.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: f779b74f-cff4-4a49-bd16-86096578ae3b

📥 Commits

Reviewing files that changed from the base of the PR and between ee57ce7 and 3b17cb5.

⛔ Files ignored due to path filters (1)
  • frontend/src/routes/Infrastructure/Clusters/ManagedClusters/CreateCluster/controlData/__snapshots__/ControlDataKubeVirt.test.js.snap is excluded by !**/*.snap, !**/*.snap
📒 Files selected for processing (6)
  • frontend/src/routes/Infrastructure/Clusters/ManagedClusters/CreateCluster/CreateCluster.test.tsx
  • frontend/src/routes/Infrastructure/Clusters/ManagedClusters/CreateCluster/CreateCluster.tsx
  • frontend/src/routes/Infrastructure/Clusters/ManagedClusters/CreateCluster/controlData/ControlDataKubeVirt.js
  • frontend/src/routes/Infrastructure/Clusters/ManagedClusters/CreateCluster/controlData/ControlDataKubeVirt.test.js
  • frontend/src/routes/Infrastructure/Clusters/ManagedClusters/CreateCluster/templates/kubevirt-template.hbs
  • frontend/src/wizards/Governance/Policy/policyWizard.test.tsx

@jeswanke

Copy link
Copy Markdown
Contributor Author

/test unit-tests-sonarcloud

jeswanke added 3 commits June 17, 2026 13:15
Signed-off-by: John Swanke <jswanke@redhat.com>
Signed-off-by: John Swanke <jswanke@redhat.com>
Signed-off-by: John Swanke <jswanke@redhat.com>
@fxiang1

fxiang1 commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

@jeswanke This looks pretty good so far. One concern I have is what about the bare metal(Host inventory) HCP cluster wizard? Kevin mentioned that code should be in the console repo, but maybe that's not the case?

We've decided the CIM team will handle bare metal.

@jeswanke

Copy link
Copy Markdown
Contributor Author

/retest

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
60.0% Coverage on New Code (required ≥ 70%)
C Maintainability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

Signed-off-by: John Swanke <jswanke@redhat.com>
@openshift-ci

openshift-ci Bot commented Jun 18, 2026

Copy link
Copy Markdown

@jeswanke: 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/unit-tests-sonarcloud 49a921a link true /test unit-tests-sonarcloud

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants