Skip to content

Conversation

@jakobmoellerdev
Copy link
Member

@jakobmoellerdev jakobmoellerdev commented Oct 23, 2025

Updated the ResourceGraphDefinition controller to set correct ownership references on CRDs and switched to metadata-only watches for improved performance and reduced memory consumption. Added integration tests to validate CRD ownership.

This would resolve both cleanup of the CRD with background deletion mode and resolution of owner refs in general but has the side effect that RGDs must stay non-namespaced (I think this is static by now and we can move to ownerrefs safely)

resolves #745

@k8s-ci-robot
Copy link
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 23, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: jakobmoellerdev
Once this PR has been reviewed and has the lgtm label, please assign barney-s for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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 cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Oct 23, 2025
@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Oct 23, 2025
Updated the ResourceGraphDefinition controller to set correct ownership references on CRDs and switched to metadata-only watches for improved performance and reduced memory consumption. Added integration tests to validate CRD ownership.

Signed-off-by: Jakob Möller <[email protected]>
@a-hilaly
Copy link
Member

i'm not very sure we need ownerReferences on CRDs. This is conflicting with the fact that we have a --allow-crd-deletion flag https://github.com/kubernetes-sigs/kro/blob/main/helm/values.yaml#L97-L98.

@jakobmoellerdev
Copy link
Member Author

I think we have very static / classic controller ownership relations between RGD<->CRD. Thus I think also deletion behavior can be controlled by an ownerref and allow crd deletion can be deprecated in favor of ownerreferences. just my opinion of course, happy to hear other thoughts.

@dudo
Copy link

dudo commented Oct 25, 2025

Thanks for picking up my issue, @jakobmoellerdev! I'm obviously biased, but the owner relationship feels logical to me. Why would we want to keep CRDs around after an RGD is deleted?

@jakobmoellerdev jakobmoellerdev marked this pull request as ready for review October 27, 2025 21:48
@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 Oct 27, 2025
return false
},
DeleteFunc: func(e event.DeleteEvent) bool {
return false
Copy link

Choose a reason for hiding this comment

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

I would say we do want to reconcile RGDs when the CRD they manage gets deleted so we re-create them

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. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ResourceGraphDefinition -> CRD ownership

5 participants