Skip to content

Conversation

@sbueringer
Copy link
Member

@sbueringer sbueringer commented Aug 26, 2025

Signed-off-by: Stefan Büringer [email protected]

What this PR does / why we need it:

Since CAPI v1.11.0 the patch engine always sets the holder field path in a GeneratePatchesRequest for the CP InfraMachineTemplate to spec.machineTemplate.spec.infrastructureRef.
This broke existing Runtime Extension implementations that were checking for spec.machineTemplate.infrastructureRef (the v1beta1 path).

With this PR we are now setting the holder field path depending on which contract the corresponding control plane object implements.

Examples:

  • KCP v1beta1 implements the v1beta1 contract so fieldPath will be set to spec.machineTemplate.infrastructureRef
  • KCP v1beta2 implements the v1beta2 contract so fieldPath will be set to spec.machineTemplate.spec.infrastructureRef

This way existing implementations for v1beta1 that matched on the old path still work and new implementations can either match for both paths or for the absolutely correct one based on contract. Both would be fine.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Aug 26, 2025
@sbueringer sbueringer changed the title [WIP] 🐛 Ensure holder field path in GeneratePatchRequest is set based on [WIP] 🐛 Ensure holder field path in GeneratePatchRequest is set based on contract Aug 26, 2025
@k8s-ci-robot k8s-ci-robot added do-not-merge/needs-area PR is missing an area label size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Aug 26, 2025
@sbueringer
Copy link
Member Author

/cherry-pick release-1.11

@k8s-infra-cherrypick-robot

@sbueringer: once the present PR merges, I will cherry-pick it on top of release-1.11 in a new PR and assign it to you.

In response to this:

/cherry-pick release-1.11

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.

@sbueringer sbueringer force-pushed the pr-fix-engine branch 2 times, most recently from 538d21a to faaa080 Compare August 26, 2025 09:55
@sbueringer
Copy link
Member Author

/test pull-cluster-api-e2e-main

@sbueringer sbueringer changed the title [WIP] 🐛 Ensure holder field path in GeneratePatchRequest is set based on contract 🐛 Ensure holder field path in GeneratePatchRequest is set based on contract Aug 26, 2025
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 26, 2025
@sbueringer
Copy link
Member Author

/assign @fabriziopandini

@sbueringer sbueringer added the area/clusterclass Issues or PRs related to clusterclass label Aug 26, 2025
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/needs-area PR is missing an area label label Aug 26, 2025
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Aug 26, 2025
@sbueringer
Copy link
Member Author

/test pull-cluster-api-e2e-main

@randomvariable
Copy link
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 26, 2025
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 1f1caba2bea57433bec6eaa61f0996393b6825e2

Copy link
Member

@fabriziopandini fabriziopandini left a comment

Choose a reason for hiding this comment

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

Nice patch.
I double checked all the usage of HolderReference.FieldPath, HolderReference and did not found other places where we need similar changes.
/lgtm
/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: fabriziopandini

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

The pull request process is described here

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 26, 2025
@k8s-ci-robot k8s-ci-robot merged commit 2c09ddc into kubernetes-sigs:main Aug 26, 2025
20 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v1.12 milestone Aug 26, 2025
@k8s-infra-cherrypick-robot

@sbueringer: #12684 failed to apply on top of branch "release-1.11":

Applying: Ensure holder field path in GeneratePatchRequest is set based on contract
Using index info to reconstruct a base tree...
M	exp/topology/desiredstate/desired_state.go
Falling back to patching base and 3-way merge...
Auto-merging exp/topology/desiredstate/desired_state.go
CONFLICT (content): Merge conflict in exp/topology/desiredstate/desired_state.go
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config advice.mergeConflict false"
Patch failed at 0001 Ensure holder field path in GeneratePatchRequest is set based on contract

In response to this:

/cherry-pick release-1.11

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.

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

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. area/clusterclass Issues or PRs related to clusterclass cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants