Skip to content

Comments

✨ Only set ownerReference on InfraCluster/ControlPlane when Topology is defined#13332

Open
sivchari wants to merge 2 commits intokubernetes-sigs:mainfrom
sivchari:fix-metacontroller-compatibility
Open

✨ Only set ownerReference on InfraCluster/ControlPlane when Topology is defined#13332
sivchari wants to merge 2 commits intokubernetes-sigs:mainfrom
sivchari:fix-metacontroller-compatibility

Conversation

@sivchari
Copy link
Member

What this PR does / why we need it:

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

… defined

Signed-off-by: sivchari <shibuuuu5@gmail.com>
@k8s-ci-robot
Copy link
Contributor

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

@k8s-ci-robot k8s-ci-robot added the do-not-merge/needs-area PR is missing an area label label Feb 12, 2026
@k8s-ci-robot
Copy link
Contributor

This PR is currently missing an area label, which is used to identify the modified component when generating release notes.

Area labels can be added by org members by writing /area ${COMPONENT} in a comment

Please see the labels list for possible areas.

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.

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Feb 12, 2026
// the user or external tools (e.g., metacontroller), so CAPI should not
// set ownerReference to avoid interfering with their lifecycle management.
if cluster.Spec.Topology.IsDefined() {
if err := controllerutil.SetControllerReference(cluster, obj, c.Scheme()); err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

We should always set an ownerRef. It's just that with topology it's a controller ownerRef (an ownerRef with controller true)

…s not defined

Address review feedback: ownerReference should always be set for cascade
deletion. When Topology is defined, use SetControllerReference (controller:
true) so CAPI fully manages the lifecycle. When Topology is not defined,
use SetOwnerReference (controller: false) to enable cascade deletion while
allowing external tools to set their own controller ownerReference.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-area PR is missing an area label 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.

Compatibility with metacontroller

3 participants