Bug 86417: installer: sync MAPI master machine edits to CAPI AWSMachine manifests#10568
Bug 86417: installer: sync MAPI master machine edits to CAPI AWSMachine manifests#10568chdeshpa-hue wants to merge 1 commit into
Conversation
…ne manifests On AWS 4.22+ (CAPI-based IPI), control plane EC2 instances are provisioned from cluster-api/machines/ AWSMachine objects, not from MAPI Machine objects in openshift/. The two asset generators (machines.Master and machines.ClusterAPI) are independent siblings — neither depends on the other. Users who edit openshift/ master manifests after "create manifests" but before "create cluster" experience silent misconfiguration: their edits are ignored and masters are provisioned with defaults. This adds a MasterMAPISync asset that: 1. Compares provisioning-relevant fields between MAPI and CAPI master machines 2. Warns on detected drift with per-field detail 3. Syncs MAPI values to CAPI objects before infrastructure provisioning Fields synced: instanceType, AMI, rootVolume (size/type/IOPS/throughput/ encryptionKey), IAM instance profile, IMDS httpTokens, confidentialCompute, publicIP, subnet (ID or filters). Platform scope: AWS only. Follow-up PRs will extend to GCP/Azure. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository: openshift/coderabbit/.coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
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 Regular contributors should join the org to skip this step. Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions 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. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
| capi.Spec.InstanceType = mapi.InstanceType | ||
| } | ||
|
|
||
| if mapi.AMI.ID != nil && *mapi.AMI.ID != "" { |
There was a problem hiding this comment.
checking individual. fields like this does not seem maintainable
|
Agreed, this won't age well as fields are added. For context — AWS is the one platform where MAPI and CAPI are generated independently from install-config with no shared builder between them. The platforms that already bridge MAPI→CAPI (IBM Cloud, vSphere, Nutanix) use the same imperative field mapping, which is where this approach came from. But AWS has ~12 fields vs their 4-5, so the verbosity is more apparent here. I considered regenerating CAPI from the MAPI spec directly, but that would require either making Instead I'm thinking of reworking this to use a field descriptor table: a var awsFieldSyncs = []fieldSync{
{name: "instanceType", ...},
{name: "ami.id", ...},
{name: "rootVolume.size", ...},
// one entry per synced field
}Should I push a v2 with this approach? |
|
I do like the idea, but wanted to say that we are gradually migrating machine provisioning to CAPI. Eventually, all machine manifests are CAPI-based; thus, this issue will naturally go away as long as we keep a single source of truth for these machine manifests. |
|
Thanks @patrickdillon @tthvo — both valid points. Proposing a redesign. Context — these two PRs are interlinked:
Together they form a cascading failure: the user's edit is first ignored (wrong instance provisioned), then actively undone (CPMS rolls back to defaults). Neither bug emits any warning today. The current-version gap: AWS is the only major platform where MAPI and CAPI are generated as independent siblings — IBM Cloud, vSphere, and Nutanix already have unified Proposed redesign (addressing both concerns):
Additionally, will draft a KCS knowledge article documenting the workaround for immediate customer relief. Question: @tthvo — is there a target release for the unified AWS builder ( |
Summary
MasterMAPISyncasset that detects drift between MAPI master machine manifests (openshift/) and CAPI AWSMachine manifests (cluster-api/machines/) duringcreate clusteropenshift/master manifests aftercreate manifestsbut edits are ignored because CAPI machines are provisioned fromcluster-api/machines/Bug
https://redhat.atlassian.net/browse/OCPBUGS-86417
Changes
pkg/asset/machines/mastermapisync.goMasterMAPISyncasset — compares MAPI and CAPI master specs, warns on drift, syncs fieldspkg/asset/machines/mastermapisync_test.gopkg/asset/cluster/cluster.go&machines.MasterMAPISync{}toCluster.Dependencies()How it works
The
MasterMAPISyncasset:InstallConfig,Master, andClusterAPIAWSMachineProviderConfigfrom each MAPI machineAWSMachinein CAPI by name/indexFields synced: instanceType, AMI, rootVolume (size/type/IOPS/throughput/encryptionKey), IAM instance profile, IMDS httpTokens, confidentialCompute, publicIP, subnet (ID or filters).
Platform scope: AWS only. Follow-up PRs extend to GCP/Azure.
Test plan
go test ./pkg/asset/machines/ -run "TestSyncAWSFields|TestIndexAWSMachines|TestFindAWSMachine"Workaround (for unpatched versions)
Set values in
install-config.yamlbeforecreate manifests, or aftercreate manifestsedit bothopenshift/andcluster-api/machines/manifests.Made with Cursor