Skip to content

Conversation

@huali9
Copy link
Contributor

@huali9 huali9 commented Dec 16, 2025

auto OCP-80519 - [CAPI][Migration]MAPI to CAPI conversion should handle no MAPI ebs volumesize and OCP-81294 - [CAPI][Migration]MAPI to CAPI conversion should handle EFA network interface type
passed locally @sunzhaohua2 @miyadav @damdo PTAL, thanks!

liuhuali@Lius-MacBook-Pro cluster-capi-operator % go run ./vendor/github.com/onsi/ginkgo/v2/ginkgo -v --focus="MachineSet Migration MAPI Authoritative Tests" ./e2e/...
Running Suite: Cluster API Suite - /Users/liuhuali/project/cluster-capi-operator/e2e
====================================================================================
Random Seed: 1765854004

Will run 6 of 64 specs
------------------------------
[BeforeSuite] 
/Users/liuhuali/project/cluster-capi-operator/e2e/e2e_test.go:15
[BeforeSuite] PASSED [2.106 seconds]
------------------------------
SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
------------------------------
[sig-cluster-lifecycle][OCPFeatureGate:MachineAPIMigration] MachineSet Migration MAPI Authoritative Tests Convert MAPI MachineSets with AWS special fields with networkInterfaceType ENA and blockDevices without volumeSize should find MAPI MachineSet .status.authoritativeAPI to equal MachineAPI
/Users/liuhuali/project/cluster-capi-operator/e2e/machineset_migration_mapi_authoritative_test.go:429
  STEP: Creating MAPI MachineSet with networkInterfaceType: ENA and blockDevices without volumeSize @ 12/16/25 11:00:13.377
  STEP: Creating MAPI MachineSet ms-with-aws-special-fields with custom provider spec @ 12/16/25 11:00:13.378
  "level"=0 "msg"="cluster.x-k8s.io/v1beta1 MachineSet is deprecated; use cluster.x-k8s.io/v1beta2 MachineSet"
  STEP: Verifying there is a CAPI MachineSet mirror and AWSMachineTemplate for MAPI MachineSet ms-with-aws-special-fields @ 12/16/25 11:00:14.583
  "level"=0 "msg"="cluster.x-k8s.io/v1beta1 MachineSet is deprecated; use cluster.x-k8s.io/v1beta2 MachineSet"
  STEP: Verifying the MachineSet authoritative is MachineAPI @ 12/16/25 11:00:15.222
• [2.728 seconds]
------------------------------
[sig-cluster-lifecycle][OCPFeatureGate:MachineAPIMigration] MachineSet Migration MAPI Authoritative Tests Convert MAPI MachineSets with AWS special fields with networkInterfaceType ENA and blockDevices without volumeSize should verify MAPI MachineSet Synchronized condition is True
/Users/liuhuali/project/cluster-capi-operator/e2e/machineset_migration_mapi_authoritative_test.go:433
  STEP: Verifying the MAPI MachineSet Synchronized condition is True @ 12/16/25 11:00:15.527
• [0.307 seconds]
------------------------------
[sig-cluster-lifecycle][OCPFeatureGate:MachineAPIMigration] MachineSet Migration MAPI Authoritative Tests Convert MAPI MachineSets with AWS special fields with networkInterfaceType ENA and blockDevices without volumeSize should verify networkInterfaceType: ENA is preserved in MAPI MachineSet
/Users/liuhuali/project/cluster-capi-operator/e2e/machineset_migration_mapi_authoritative_test.go:437
• [0.309 seconds]
------------------------------
[sig-cluster-lifecycle][OCPFeatureGate:MachineAPIMigration] MachineSet Migration MAPI Authoritative Tests Convert MAPI MachineSets with AWS special fields with networkInterfaceType ENA and blockDevices without volumeSize should verify blockDevices without volumeSize are preserved in MAPI MachineSet
/Users/liuhuali/project/cluster-capi-operator/e2e/machineset_migration_mapi_authoritative_test.go:444
• [0.305 seconds]
------------------------------
[sig-cluster-lifecycle][OCPFeatureGate:MachineAPIMigration] MachineSet Migration MAPI Authoritative Tests Convert MAPI MachineSets with AWS special fields with networkInterfaceType ENA and blockDevices without volumeSize should verify AWS special fields are converted to CAPI AWSMachineTemplate
/Users/liuhuali/project/cluster-capi-operator/e2e/machineset_migration_mapi_authoritative_test.go:458
  STEP: Verifying networkInterfaceType: ENA is converted @ 12/16/25 11:00:16.754
  STEP: Verifying blockDevices volumeSize are defaulted to 120 @ 12/16/25 11:00:16.754
• [0.305 seconds]
------------------------------
[sig-cluster-lifecycle][OCPFeatureGate:MachineAPIMigration] MachineSet Migration MAPI Authoritative Tests Convert MAPI MachineSets with AWS special fields with networkInterfaceType ENA and blockDevices without volumeSize should create a Machine with AWS special fields converted correctly
/Users/liuhuali/project/cluster-capi-operator/e2e/machineset_migration_mapi_authoritative_test.go:472
  STEP: Verifying MAPI MachineSet status.Replicas is 1 @ 12/16/25 11:04:04.906
  STEP: Verifying CAPI MachineSet status.Replicas is 1 @ 12/16/25 11:04:05.193
  "level"=0 "msg"="cluster.x-k8s.io/v1beta1 MachineSet is deprecated; use cluster.x-k8s.io/v1beta2 MachineSet"
  STEP: Getting the created MAPI Machine @ 12/16/25 11:04:05.482
  STEP: Verify the MAPI Machine is Running @ 12/16/25 11:04:05.771
  STEP: Getting the CAPI Machine mirror and AWSMachine @ 12/16/25 11:04:06.059
  "level"=0 "msg"="cluster.x-k8s.io/v1beta1 Machine is deprecated; use cluster.x-k8s.io/v1beta2 Machine"
  STEP: Verifying AWSMachine has networkInterfaceType: ENA @ 12/16/25 11:04:06.631
  STEP: Verifying AWSMachine has correct blockDevice configuration @ 12/16/25 11:04:06.953
  STEP: Cleaning up Context 'with networkInterfaceType ENA and blockDevices without volumeSize' resources @ 12/16/25 11:04:07.26
  STEP: Deleting CAPI MachineSet ms-with-aws-special-fields @ 12/16/25 11:04:07.26
  STEP: Deleting MachineSet "ms-with-aws-special-fields" @ 12/16/25 11:04:07.261
  "level"=0 "msg"="cluster.x-k8s.io/v1beta1 MachineSet is deprecated; use cluster.x-k8s.io/v1beta2 MachineSet"
  STEP: Waiting for MachineSet "ms-with-aws-special-fields" to be deleted @ 12/16/25 11:04:07.568
  "level"=0 "msg"="cluster.x-k8s.io/v1beta1 Machine is deprecated; use cluster.x-k8s.io/v1beta2 Machine"
  "level"=0 "msg"="cluster.x-k8s.io/v1beta1 Machine is deprecated; use cluster.x-k8s.io/v1beta2 Machine"
  "level"=0 "msg"="cluster.x-k8s.io/v1beta1 Machine is deprecated; use cluster.x-k8s.io/v1beta2 Machine"
  "level"=0 "msg"="cluster.x-k8s.io/v1beta1 Machine is deprecated; use cluster.x-k8s.io/v1beta2 Machine"
  "level"=0 "msg"="cluster.x-k8s.io/v1beta1 Machine is deprecated; use cluster.x-k8s.io/v1beta2 Machine"
  "level"=0 "msg"="cluster.x-k8s.io/v1beta1 Machine is deprecated; use cluster.x-k8s.io/v1beta2 Machine"
  "level"=0 "msg"="cluster.x-k8s.io/v1beta1 Machine is deprecated; use cluster.x-k8s.io/v1beta2 Machine"
  "level"=0 "msg"="cluster.x-k8s.io/v1beta1 Machine is deprecated; use cluster.x-k8s.io/v1beta2 Machine"
  "level"=0 "msg"="cluster.x-k8s.io/v1beta1 Machine is deprecated; use cluster.x-k8s.io/v1beta2 Machine"
  "level"=0 "msg"="cluster.x-k8s.io/v1beta1 Machine is deprecated; use cluster.x-k8s.io/v1beta2 Machine"
  "level"=0 "msg"="cluster.x-k8s.io/v1beta1 Machine is deprecated; use cluster.x-k8s.io/v1beta2 Machine"
  "level"=0 "msg"="cluster.x-k8s.io/v1beta1 Machine is deprecated; use cluster.x-k8s.io/v1beta2 Machine"
  "level"=0 "msg"="cluster.x-k8s.io/v1beta1 Machine is deprecated; use cluster.x-k8s.io/v1beta2 Machine"
  "level"=0 "msg"="cluster.x-k8s.io/v1beta1 MachineSet is deprecated; use cluster.x-k8s.io/v1beta2 MachineSet"
  STEP: Deleting MAPI MachineSet ms-with-aws-special-fields @ 12/16/25 11:05:11.977
E1216 11:05:12.261225    7425 machinesets.go:772] Error querying api for machine object "ms-with-aws-special-fields": machinesets.machine.openshift.io "ms-with-aws-special-fields" not found, retrying...
  STEP: Deleting awsMachineTemplate ms-with-aws-special-fields-476fe6bb @ 12/16/25 11:05:13.206
  STEP: Deleting awsMachineTemplate "ms-with-aws-special-fields-476fe6bb" @ 12/16/25 11:05:13.206
• [296.762 seconds]
------------------------------
S
P [PENDING]
[sig-cluster-lifecycle][OCPFeatureGate:MachineAPIMigration] MachineSet Migration CAPI Authoritative Tests Create MAPI MachineSets with spec.authoritativeAPI: ClusterAPI and existing CAPI MachineSet with same name should verify that the non-authoritative MAPI MachineSet providerSpec has been updated to reflect the authoritative CAPI MachineSet mirror values
/Users/liuhuali/project/cluster-capi-operator/e2e/machineset_migration_capi_authoritative_test.go:62
------------------------------
SSSSSSSSSSSS

Ran 6 of 64 Specs in 302.827 seconds
SUCCESS! -- 6 Passed | 0 Failed | 1 Pending | 57 Skipped
PASS

Ginkgo ran 1 suite in 5m9.283392641s
Test Suite Passed

Summary by CodeRabbit

  • Tests
    • Added comprehensive test suite validating AWS special fields conversion from MAPI to CAPI MachineSets, including NetworkInterfaceType, BlockDevices encryption, and RootVolume configuration preservation during migration scenarios.

✏️ Tip: You can customize this high-level summary in your review settings.

@openshift-ci-robot
Copy link

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: LGTM mode

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Dec 16, 2025
@openshift-ci-robot
Copy link

openshift-ci-robot commented Dec 16, 2025

@huali9: This pull request references OCPCLOUD-2993 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 story to target the "4.22.0" version, but no target version was set.

Details

In response to this:

auto OCP-80519 - [CAPI][Migration]MAPI to CAPI conversion should handle no MAPI ebs volumesize and OCP-81294 - [CAPI][Migration]MAPI to CAPI conversion should handle EFA network interface type
passed locally @sunzhaohua2 @miyadav @damdo PTAL, thanks!

liuhuali@Lius-MacBook-Pro cluster-capi-operator % go run ./vendor/github.com/onsi/ginkgo/v2/ginkgo -v --focus="MachineSet Migration MAPI Authoritative Tests" ./e2e/...
Running Suite: Cluster API Suite - /Users/liuhuali/project/cluster-capi-operator/e2e
====================================================================================
Random Seed: 1765854004

Will run 6 of 64 specs
------------------------------
[BeforeSuite] 
/Users/liuhuali/project/cluster-capi-operator/e2e/e2e_test.go:15
[BeforeSuite] PASSED [2.106 seconds]
------------------------------
SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
------------------------------
[sig-cluster-lifecycle][OCPFeatureGate:MachineAPIMigration] MachineSet Migration MAPI Authoritative Tests Convert MAPI MachineSets with AWS special fields with networkInterfaceType ENA and blockDevices without volumeSize should find MAPI MachineSet .status.authoritativeAPI to equal MachineAPI
/Users/liuhuali/project/cluster-capi-operator/e2e/machineset_migration_mapi_authoritative_test.go:429
 STEP: Creating MAPI MachineSet with networkInterfaceType: ENA and blockDevices without volumeSize @ 12/16/25 11:00:13.377
 STEP: Creating MAPI MachineSet ms-with-aws-special-fields with custom provider spec @ 12/16/25 11:00:13.378
 "level"=0 "msg"="cluster.x-k8s.io/v1beta1 MachineSet is deprecated; use cluster.x-k8s.io/v1beta2 MachineSet"
 STEP: Verifying there is a CAPI MachineSet mirror and AWSMachineTemplate for MAPI MachineSet ms-with-aws-special-fields @ 12/16/25 11:00:14.583
 "level"=0 "msg"="cluster.x-k8s.io/v1beta1 MachineSet is deprecated; use cluster.x-k8s.io/v1beta2 MachineSet"
 STEP: Verifying the MachineSet authoritative is MachineAPI @ 12/16/25 11:00:15.222
• [2.728 seconds]
------------------------------
[sig-cluster-lifecycle][OCPFeatureGate:MachineAPIMigration] MachineSet Migration MAPI Authoritative Tests Convert MAPI MachineSets with AWS special fields with networkInterfaceType ENA and blockDevices without volumeSize should verify MAPI MachineSet Synchronized condition is True
/Users/liuhuali/project/cluster-capi-operator/e2e/machineset_migration_mapi_authoritative_test.go:433
 STEP: Verifying the MAPI MachineSet Synchronized condition is True @ 12/16/25 11:00:15.527
• [0.307 seconds]
------------------------------
[sig-cluster-lifecycle][OCPFeatureGate:MachineAPIMigration] MachineSet Migration MAPI Authoritative Tests Convert MAPI MachineSets with AWS special fields with networkInterfaceType ENA and blockDevices without volumeSize should verify networkInterfaceType: ENA is preserved in MAPI MachineSet
/Users/liuhuali/project/cluster-capi-operator/e2e/machineset_migration_mapi_authoritative_test.go:437
• [0.309 seconds]
------------------------------
[sig-cluster-lifecycle][OCPFeatureGate:MachineAPIMigration] MachineSet Migration MAPI Authoritative Tests Convert MAPI MachineSets with AWS special fields with networkInterfaceType ENA and blockDevices without volumeSize should verify blockDevices without volumeSize are preserved in MAPI MachineSet
/Users/liuhuali/project/cluster-capi-operator/e2e/machineset_migration_mapi_authoritative_test.go:444
• [0.305 seconds]
------------------------------
[sig-cluster-lifecycle][OCPFeatureGate:MachineAPIMigration] MachineSet Migration MAPI Authoritative Tests Convert MAPI MachineSets with AWS special fields with networkInterfaceType ENA and blockDevices without volumeSize should verify AWS special fields are converted to CAPI AWSMachineTemplate
/Users/liuhuali/project/cluster-capi-operator/e2e/machineset_migration_mapi_authoritative_test.go:458
 STEP: Verifying networkInterfaceType: ENA is converted @ 12/16/25 11:00:16.754
 STEP: Verifying blockDevices volumeSize are defaulted to 120 @ 12/16/25 11:00:16.754
• [0.305 seconds]
------------------------------
[sig-cluster-lifecycle][OCPFeatureGate:MachineAPIMigration] MachineSet Migration MAPI Authoritative Tests Convert MAPI MachineSets with AWS special fields with networkInterfaceType ENA and blockDevices without volumeSize should create a Machine with AWS special fields converted correctly
/Users/liuhuali/project/cluster-capi-operator/e2e/machineset_migration_mapi_authoritative_test.go:472
 STEP: Verifying MAPI MachineSet status.Replicas is 1 @ 12/16/25 11:04:04.906
 STEP: Verifying CAPI MachineSet status.Replicas is 1 @ 12/16/25 11:04:05.193
 "level"=0 "msg"="cluster.x-k8s.io/v1beta1 MachineSet is deprecated; use cluster.x-k8s.io/v1beta2 MachineSet"
 STEP: Getting the created MAPI Machine @ 12/16/25 11:04:05.482
 STEP: Verify the MAPI Machine is Running @ 12/16/25 11:04:05.771
 STEP: Getting the CAPI Machine mirror and AWSMachine @ 12/16/25 11:04:06.059
 "level"=0 "msg"="cluster.x-k8s.io/v1beta1 Machine is deprecated; use cluster.x-k8s.io/v1beta2 Machine"
 STEP: Verifying AWSMachine has networkInterfaceType: ENA @ 12/16/25 11:04:06.631
 STEP: Verifying AWSMachine has correct blockDevice configuration @ 12/16/25 11:04:06.953
 STEP: Cleaning up Context 'with networkInterfaceType ENA and blockDevices without volumeSize' resources @ 12/16/25 11:04:07.26
 STEP: Deleting CAPI MachineSet ms-with-aws-special-fields @ 12/16/25 11:04:07.26
 STEP: Deleting MachineSet "ms-with-aws-special-fields" @ 12/16/25 11:04:07.261
 "level"=0 "msg"="cluster.x-k8s.io/v1beta1 MachineSet is deprecated; use cluster.x-k8s.io/v1beta2 MachineSet"
 STEP: Waiting for MachineSet "ms-with-aws-special-fields" to be deleted @ 12/16/25 11:04:07.568
 "level"=0 "msg"="cluster.x-k8s.io/v1beta1 Machine is deprecated; use cluster.x-k8s.io/v1beta2 Machine"
 "level"=0 "msg"="cluster.x-k8s.io/v1beta1 Machine is deprecated; use cluster.x-k8s.io/v1beta2 Machine"
 "level"=0 "msg"="cluster.x-k8s.io/v1beta1 Machine is deprecated; use cluster.x-k8s.io/v1beta2 Machine"
 "level"=0 "msg"="cluster.x-k8s.io/v1beta1 Machine is deprecated; use cluster.x-k8s.io/v1beta2 Machine"
 "level"=0 "msg"="cluster.x-k8s.io/v1beta1 Machine is deprecated; use cluster.x-k8s.io/v1beta2 Machine"
 "level"=0 "msg"="cluster.x-k8s.io/v1beta1 Machine is deprecated; use cluster.x-k8s.io/v1beta2 Machine"
 "level"=0 "msg"="cluster.x-k8s.io/v1beta1 Machine is deprecated; use cluster.x-k8s.io/v1beta2 Machine"
 "level"=0 "msg"="cluster.x-k8s.io/v1beta1 Machine is deprecated; use cluster.x-k8s.io/v1beta2 Machine"
 "level"=0 "msg"="cluster.x-k8s.io/v1beta1 Machine is deprecated; use cluster.x-k8s.io/v1beta2 Machine"
 "level"=0 "msg"="cluster.x-k8s.io/v1beta1 Machine is deprecated; use cluster.x-k8s.io/v1beta2 Machine"
 "level"=0 "msg"="cluster.x-k8s.io/v1beta1 Machine is deprecated; use cluster.x-k8s.io/v1beta2 Machine"
 "level"=0 "msg"="cluster.x-k8s.io/v1beta1 Machine is deprecated; use cluster.x-k8s.io/v1beta2 Machine"
 "level"=0 "msg"="cluster.x-k8s.io/v1beta1 Machine is deprecated; use cluster.x-k8s.io/v1beta2 Machine"
 "level"=0 "msg"="cluster.x-k8s.io/v1beta1 MachineSet is deprecated; use cluster.x-k8s.io/v1beta2 MachineSet"
 STEP: Deleting MAPI MachineSet ms-with-aws-special-fields @ 12/16/25 11:05:11.977
E1216 11:05:12.261225    7425 machinesets.go:772] Error querying api for machine object "ms-with-aws-special-fields": machinesets.machine.openshift.io "ms-with-aws-special-fields" not found, retrying...
 STEP: Deleting awsMachineTemplate ms-with-aws-special-fields-476fe6bb @ 12/16/25 11:05:13.206
 STEP: Deleting awsMachineTemplate "ms-with-aws-special-fields-476fe6bb" @ 12/16/25 11:05:13.206
• [296.762 seconds]
------------------------------
S
P [PENDING]
[sig-cluster-lifecycle][OCPFeatureGate:MachineAPIMigration] MachineSet Migration CAPI Authoritative Tests Create MAPI MachineSets with spec.authoritativeAPI: ClusterAPI and existing CAPI MachineSet with same name should verify that the non-authoritative MAPI MachineSet providerSpec has been updated to reflect the authoritative CAPI MachineSet mirror values
/Users/liuhuali/project/cluster-capi-operator/e2e/machineset_migration_capi_authoritative_test.go:62
------------------------------
SSSSSSSSSSSS

Ran 6 of 64 Specs in 302.827 seconds
SUCCESS! -- 6 Passed | 0 Failed | 1 Pending | 57 Skipped
PASS

Ginkgo ran 1 suite in 5m9.283392641s
Test Suite Passed

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.

@coderabbitai
Copy link

coderabbitai bot commented Dec 16, 2025

Walkthrough

Adds a new helper function for creating MAPI MachineSets with customizable AWS provider spec updates and introduces an e2e test suite validating AWS special fields conversion from MAPI to CAPI AWSMachineTemplate, including networkInterfaceType and BlockDevices preservation.

Changes

Cohort / File(s) Change Summary
Helper Function
e2e/machineset_migration_helpers.go
Adds createMAPIMachineSetWithProviderSpecUpdates function to construct MAPI MachineSets with customizable provider spec via updateFunc parameter; unmarshals/applies updates to AWSMachineProviderConfig, marshals back, creates MachineSet, waits for CAPI mirror, and returns the created MachineSet.
E2E Test Suite
e2e/machineset_migration_mapi_authoritative_test.go
Introduces test suite validating AWS special fields conversion (networkInterfaceType preservation, BlockDevices with encryption/volume type/IOPS handling); adds k8s.io/utils/ptr import. Note: test suite block appears duplicated in file.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Review the updateFunc contract in the helper function for proper error handling and side effects
  • Verify the duplicate test block issue and confirm whether it's intentional or an oversight requiring removal
  • Validate test assertions adequately cover AWS field conversion edge cases (nil VolumeSize, default sizes, encryption flags)

Poem

🐰 A helper hops to customize specs with grace,
While tests leap far to validate the conversion race,
AWS fields migrate from old to new,
But watch for duplicates—there's one test (or two!)

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main changes: adding support for network interface type (ENA) and handling MAPI EBS volumeSize (no size) conversion during MAPI to CAPI migration.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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

@openshift-ci openshift-ci bot requested review from RadekManak and damdo December 16, 2025 03:21
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Dec 16, 2025

[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 mdbooth 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-robot
Copy link

openshift-ci-robot commented Dec 16, 2025

@huali9: This pull request references OCPCLOUD-2993 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 story to target the "4.22.0" version, but no target version was set.

Details

In response to this:

auto OCP-80519 - [CAPI][Migration]MAPI to CAPI conversion should handle no MAPI ebs volumesize and OCP-81294 - [CAPI][Migration]MAPI to CAPI conversion should handle EFA network interface type
passed locally @sunzhaohua2 @miyadav @damdo PTAL, thanks!

liuhuali@Lius-MacBook-Pro cluster-capi-operator % go run ./vendor/github.com/onsi/ginkgo/v2/ginkgo -v --focus="MachineSet Migration MAPI Authoritative Tests" ./e2e/...
Running Suite: Cluster API Suite - /Users/liuhuali/project/cluster-capi-operator/e2e
====================================================================================
Random Seed: 1765854004

Will run 6 of 64 specs
------------------------------
[BeforeSuite] 
/Users/liuhuali/project/cluster-capi-operator/e2e/e2e_test.go:15
[BeforeSuite] PASSED [2.106 seconds]
------------------------------
SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
------------------------------
[sig-cluster-lifecycle][OCPFeatureGate:MachineAPIMigration] MachineSet Migration MAPI Authoritative Tests Convert MAPI MachineSets with AWS special fields with networkInterfaceType ENA and blockDevices without volumeSize should find MAPI MachineSet .status.authoritativeAPI to equal MachineAPI
/Users/liuhuali/project/cluster-capi-operator/e2e/machineset_migration_mapi_authoritative_test.go:429
 STEP: Creating MAPI MachineSet with networkInterfaceType: ENA and blockDevices without volumeSize @ 12/16/25 11:00:13.377
 STEP: Creating MAPI MachineSet ms-with-aws-special-fields with custom provider spec @ 12/16/25 11:00:13.378
 "level"=0 "msg"="cluster.x-k8s.io/v1beta1 MachineSet is deprecated; use cluster.x-k8s.io/v1beta2 MachineSet"
 STEP: Verifying there is a CAPI MachineSet mirror and AWSMachineTemplate for MAPI MachineSet ms-with-aws-special-fields @ 12/16/25 11:00:14.583
 "level"=0 "msg"="cluster.x-k8s.io/v1beta1 MachineSet is deprecated; use cluster.x-k8s.io/v1beta2 MachineSet"
 STEP: Verifying the MachineSet authoritative is MachineAPI @ 12/16/25 11:00:15.222
• [2.728 seconds]
------------------------------
[sig-cluster-lifecycle][OCPFeatureGate:MachineAPIMigration] MachineSet Migration MAPI Authoritative Tests Convert MAPI MachineSets with AWS special fields with networkInterfaceType ENA and blockDevices without volumeSize should verify MAPI MachineSet Synchronized condition is True
/Users/liuhuali/project/cluster-capi-operator/e2e/machineset_migration_mapi_authoritative_test.go:433
 STEP: Verifying the MAPI MachineSet Synchronized condition is True @ 12/16/25 11:00:15.527
• [0.307 seconds]
------------------------------
[sig-cluster-lifecycle][OCPFeatureGate:MachineAPIMigration] MachineSet Migration MAPI Authoritative Tests Convert MAPI MachineSets with AWS special fields with networkInterfaceType ENA and blockDevices without volumeSize should verify networkInterfaceType: ENA is preserved in MAPI MachineSet
/Users/liuhuali/project/cluster-capi-operator/e2e/machineset_migration_mapi_authoritative_test.go:437
• [0.309 seconds]
------------------------------
[sig-cluster-lifecycle][OCPFeatureGate:MachineAPIMigration] MachineSet Migration MAPI Authoritative Tests Convert MAPI MachineSets with AWS special fields with networkInterfaceType ENA and blockDevices without volumeSize should verify blockDevices without volumeSize are preserved in MAPI MachineSet
/Users/liuhuali/project/cluster-capi-operator/e2e/machineset_migration_mapi_authoritative_test.go:444
• [0.305 seconds]
------------------------------
[sig-cluster-lifecycle][OCPFeatureGate:MachineAPIMigration] MachineSet Migration MAPI Authoritative Tests Convert MAPI MachineSets with AWS special fields with networkInterfaceType ENA and blockDevices without volumeSize should verify AWS special fields are converted to CAPI AWSMachineTemplate
/Users/liuhuali/project/cluster-capi-operator/e2e/machineset_migration_mapi_authoritative_test.go:458
 STEP: Verifying networkInterfaceType: ENA is converted @ 12/16/25 11:00:16.754
 STEP: Verifying blockDevices volumeSize are defaulted to 120 @ 12/16/25 11:00:16.754
• [0.305 seconds]
------------------------------
[sig-cluster-lifecycle][OCPFeatureGate:MachineAPIMigration] MachineSet Migration MAPI Authoritative Tests Convert MAPI MachineSets with AWS special fields with networkInterfaceType ENA and blockDevices without volumeSize should create a Machine with AWS special fields converted correctly
/Users/liuhuali/project/cluster-capi-operator/e2e/machineset_migration_mapi_authoritative_test.go:472
 STEP: Verifying MAPI MachineSet status.Replicas is 1 @ 12/16/25 11:04:04.906
 STEP: Verifying CAPI MachineSet status.Replicas is 1 @ 12/16/25 11:04:05.193
 "level"=0 "msg"="cluster.x-k8s.io/v1beta1 MachineSet is deprecated; use cluster.x-k8s.io/v1beta2 MachineSet"
 STEP: Getting the created MAPI Machine @ 12/16/25 11:04:05.482
 STEP: Verify the MAPI Machine is Running @ 12/16/25 11:04:05.771
 STEP: Getting the CAPI Machine mirror and AWSMachine @ 12/16/25 11:04:06.059
 "level"=0 "msg"="cluster.x-k8s.io/v1beta1 Machine is deprecated; use cluster.x-k8s.io/v1beta2 Machine"
 STEP: Verifying AWSMachine has networkInterfaceType: ENA @ 12/16/25 11:04:06.631
 STEP: Verifying AWSMachine has correct blockDevice configuration @ 12/16/25 11:04:06.953
 STEP: Cleaning up Context 'with networkInterfaceType ENA and blockDevices without volumeSize' resources @ 12/16/25 11:04:07.26
 STEP: Deleting CAPI MachineSet ms-with-aws-special-fields @ 12/16/25 11:04:07.26
 STEP: Deleting MachineSet "ms-with-aws-special-fields" @ 12/16/25 11:04:07.261
 "level"=0 "msg"="cluster.x-k8s.io/v1beta1 MachineSet is deprecated; use cluster.x-k8s.io/v1beta2 MachineSet"
 STEP: Waiting for MachineSet "ms-with-aws-special-fields" to be deleted @ 12/16/25 11:04:07.568
 "level"=0 "msg"="cluster.x-k8s.io/v1beta1 Machine is deprecated; use cluster.x-k8s.io/v1beta2 Machine"
 "level"=0 "msg"="cluster.x-k8s.io/v1beta1 Machine is deprecated; use cluster.x-k8s.io/v1beta2 Machine"
 "level"=0 "msg"="cluster.x-k8s.io/v1beta1 Machine is deprecated; use cluster.x-k8s.io/v1beta2 Machine"
 "level"=0 "msg"="cluster.x-k8s.io/v1beta1 Machine is deprecated; use cluster.x-k8s.io/v1beta2 Machine"
 "level"=0 "msg"="cluster.x-k8s.io/v1beta1 Machine is deprecated; use cluster.x-k8s.io/v1beta2 Machine"
 "level"=0 "msg"="cluster.x-k8s.io/v1beta1 Machine is deprecated; use cluster.x-k8s.io/v1beta2 Machine"
 "level"=0 "msg"="cluster.x-k8s.io/v1beta1 Machine is deprecated; use cluster.x-k8s.io/v1beta2 Machine"
 "level"=0 "msg"="cluster.x-k8s.io/v1beta1 Machine is deprecated; use cluster.x-k8s.io/v1beta2 Machine"
 "level"=0 "msg"="cluster.x-k8s.io/v1beta1 Machine is deprecated; use cluster.x-k8s.io/v1beta2 Machine"
 "level"=0 "msg"="cluster.x-k8s.io/v1beta1 Machine is deprecated; use cluster.x-k8s.io/v1beta2 Machine"
 "level"=0 "msg"="cluster.x-k8s.io/v1beta1 Machine is deprecated; use cluster.x-k8s.io/v1beta2 Machine"
 "level"=0 "msg"="cluster.x-k8s.io/v1beta1 Machine is deprecated; use cluster.x-k8s.io/v1beta2 Machine"
 "level"=0 "msg"="cluster.x-k8s.io/v1beta1 Machine is deprecated; use cluster.x-k8s.io/v1beta2 Machine"
 "level"=0 "msg"="cluster.x-k8s.io/v1beta1 MachineSet is deprecated; use cluster.x-k8s.io/v1beta2 MachineSet"
 STEP: Deleting MAPI MachineSet ms-with-aws-special-fields @ 12/16/25 11:05:11.977
E1216 11:05:12.261225    7425 machinesets.go:772] Error querying api for machine object "ms-with-aws-special-fields": machinesets.machine.openshift.io "ms-with-aws-special-fields" not found, retrying...
 STEP: Deleting awsMachineTemplate ms-with-aws-special-fields-476fe6bb @ 12/16/25 11:05:13.206
 STEP: Deleting awsMachineTemplate "ms-with-aws-special-fields-476fe6bb" @ 12/16/25 11:05:13.206
• [296.762 seconds]
------------------------------
S
P [PENDING]
[sig-cluster-lifecycle][OCPFeatureGate:MachineAPIMigration] MachineSet Migration CAPI Authoritative Tests Create MAPI MachineSets with spec.authoritativeAPI: ClusterAPI and existing CAPI MachineSet with same name should verify that the non-authoritative MAPI MachineSet providerSpec has been updated to reflect the authoritative CAPI MachineSet mirror values
/Users/liuhuali/project/cluster-capi-operator/e2e/machineset_migration_capi_authoritative_test.go:62
------------------------------
SSSSSSSSSSSS

Ran 6 of 64 Specs in 302.827 seconds
SUCCESS! -- 6 Passed | 0 Failed | 1 Pending | 57 Skipped
PASS

Ginkgo ran 1 suite in 5m9.283392641s
Test Suite Passed

Summary by CodeRabbit

  • Tests
  • Added comprehensive test suite validating AWS special fields conversion from MAPI to CAPI MachineSets, including NetworkInterfaceType, BlockDevices encryption, and RootVolume configuration preservation during migration scenarios.

✏️ Tip: You can customize this high-level summary in your review settings.

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

@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

🧹 Nitpick comments (1)
e2e/machineset_migration_mapi_authoritative_test.go (1)

493-510: Consider simplifying the Eventually assertion.

The manual boolean checks in the Eventually block could be more concise and easier to maintain. Consider using Gomega matchers for better readability and error messages.

Apply this diff to use Gomega matchers:

 			By("Verifying AWSMachine has correct blockDevice configuration")
-			Eventually(func() bool {
-				freshAWSMachine := capiframework.GetAWSMachine(cl, awsMachine.Name, capiframework.CAPINamespace)
-				if freshAWSMachine.Spec.RootVolume == nil {
-					return false
-				}
-				if freshAWSMachine.Spec.RootVolume.Encrypted == nil || !*freshAWSMachine.Spec.RootVolume.Encrypted {
-					return false
-				}
-				if freshAWSMachine.Spec.RootVolume.Type != awsv1.VolumeTypeGP3 {
-					return false
-				}
-				if freshAWSMachine.Spec.RootVolume.Size != int64(120) {
-					return false
-				}
-				return true
-			}, capiframework.WaitMedium, capiframework.RetryMedium).Should(BeTrue(),
+			Eventually(func() *awsv1.AWSMachine {
+				return capiframework.GetAWSMachine(cl, awsMachine.Name, capiframework.CAPINamespace)
+			}, capiframework.WaitMedium, capiframework.RetryMedium).Should(
+				SatisfyAll(
+					HaveField("Spec.RootVolume.Encrypted", Not(BeNil())),
+					HaveField("Spec.RootVolume.Encrypted", PointTo(BeTrue())),
+					HaveField("Spec.RootVolume.Type", Equal(awsv1.VolumeTypeGP3)),
+					HaveField("Spec.RootVolume.Size", BeNumerically("==", 120)),
+				),
 				"AWSMachine should have blockDevice configuration from MAPI MachineSet",
 			)
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between bd0557a and 3c8e918.

📒 Files selected for processing (2)
  • e2e/machineset_migration_helpers.go (1 hunks)
  • e2e/machineset_migration_mapi_authoritative_test.go (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
e2e/machineset_migration_helpers.go (3)
pkg/conversion/mapi2capi/interface.go (1)
  • MachineSet (29-31)
e2e/framework/machineset.go (1)
  • CreateMachineSet (49-94)
e2e/framework/framework.go (3)
  • CAPINamespace (14-14)
  • WaitShort (23-23)
  • RetryShort (17-17)
🔇 Additional comments (3)
e2e/machineset_migration_helpers.go (1)

369-417: LGTM! Well-structured helper function.

The implementation follows existing patterns and provides a clean extension point for customizing AWS provider specs during MAPI MachineSet creation. The marshal/unmarshal approach is consistent with other helpers in the file, and proper error handling and wait logic are in place.

e2e/machineset_migration_mapi_authoritative_test.go (2)

8-8: LGTM! Appropriate import for pointer helpers.

The ptr package import is correctly used throughout the test for creating pointer literals with ptr.To().


399-411: Good test coverage for BlockDevices without VolumeSize.

The test correctly validates the conversion of BlockDevices that lack an explicit VolumeSize, setting up encryption, volume type, and intentionally omitting VolumeSize to verify the defaulting behavior (expected default is 120 as verified on line 469). This aligns with the PR objective for OCP-80519.

mapiMachineSet = createMAPIMachineSetWithProviderSpecUpdates(ctx, cl, 1, mapiMSSpecialFieldsName,
func(providerSpec *mapiv1beta1.AWSMachineProviderConfig) {
// Set networkInterfaceType to ENA
providerSpec.NetworkInterfaceType = "ENA"
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

# First, let's look at the test file to see the context around the mentioned lines
cd /tmp && find . -name "machineset_migration_mapi_authoritative_test.go" 2>/dev/null | head -1

Repository: openshift/cluster-capi-operator

Length of output: 57


🏁 Script executed:

# List files to understand repo structure
git ls-files "**/*machineset_migration*" 2>/dev/null

Repository: openshift/cluster-capi-operator

Length of output: 361


🏁 Script executed:

# Search for the test file
find . -type f -name "*machineset_migration_mapi_authoritative_test.go" 2>/dev/null

Repository: openshift/cluster-capi-operator

Length of output: 128


🏁 Script executed:

# Get NetworkInterfaceType related constants and conversion logic
rg -n "NetworkInterfaceType" --type=go -A 3 -B 1 | head -150

Repository: openshift/cluster-capi-operator

Length of output: 8980


🏁 Script executed:

# Search for ENA, EFA, ENI definitions
rg -n "const.*NetworkInterfaceType" --type=go -A 5

Repository: openshift/cluster-capi-operator

Length of output: 57


🏁 Script executed:

# Look for conversion or mapping logic between network interface types
rg -n "(ENA|EFA|ENI).*NetworkInterface|NetworkInterface.*(ENA|EFA|ENI)" --type=go

Repository: openshift/cluster-capi-operator

Length of output: 2378


🏁 Script executed:

cat -n e2e/machineset_migration_mapi_authoritative_test.go | sed -n '460,495p'

Repository: openshift/cluster-capi-operator

Length of output: 2258


🏁 Script executed:

# Also check if there are any constants defined for the network interface types
rg -n "AWSENANetworkInterfaceType|AWSEFANetworkInterfaceType" --type=go -B 2 -A 1

Repository: openshift/cluster-capi-operator

Length of output: 2047


🏁 Script executed:

cat -n e2e/machineset_migration_mapi_authoritative_test.go | sed -n '385,400p'

Repository: openshift/cluster-capi-operator

Length of output: 998


🏁 Script executed:

# Check if there's a PR or issue reference for OCP-81294
rg -n "OCP-81294|81294" --type=go --type=md

Repository: openshift/cluster-capi-operator

Length of output: 57


Fix assertion message on line 489 to match the expected value.

The test correctly sets NetworkInterfaceType to "ENA" in the MAPI MachineSet (line 396), which is intentionally converted to NetworkInterfaceTypeENI in CAPI per the conversion logic in pkg/conversion/mapi2capi/aws.go (lines 695-696). The assertions on lines 463 and 488 correctly expect NetworkInterfaceTypeENI. However, the assertion message on line 489 says "AWSMachine should have networkInterfaceType set to ENA" when the actual check is for NetworkInterfaceTypeENI. Update the message to say "set to ENI" to match the assertion.

🤖 Prompt for AI Agents
In e2e/machineset_migration_mapi_authoritative_test.go around lines 396–396 and
specifically fix the assertion message at line 489: the test sets
providerSpec.NetworkInterfaceType = "ENA" (line 396) which the conversion maps
to NetworkInterfaceTypeENI, and the assertion at line 488 correctly checks for
NetworkInterfaceTypeENI but the message on line 489 mistakenly says "set to
ENA"; update that assertion message to say "set to ENI" so the message matches
the expected value being asserted.

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Dec 16, 2025

@huali9: all tests passed!

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