OCPBUGS-84957: Skip controller ownerReference on CRDs - #3082
Conversation
|
Pipeline controller notification For optional jobs, comment This repository is configured in: LGTM mode |
|
@dlom: This pull request references Jira Issue OCPBUGS-84957, which is invalid:
Comment The bug has been updated to refer to the pull request using the external bug tracker. DetailsIn response to this:
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. |
WalkthroughThe operconfig controller now excludes CustomResourceDefinition objects from controller ownerReference assignment, adds GroupVersionKind-based CRD detection, updates related reconciliation comments, and introduces tests for detection and ownership behavior. ChangesCRD ownership handling
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested labels: Suggested reviewers: Caution Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional.
❌ Failed checks (2 errors)
✅ Passed checks (22 passed)
✨ 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 |
|
/jira refresh |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: dlom 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 |
|
@dlom: This pull request references Jira Issue OCPBUGS-84957, which is valid. The bug has been moved to the POST state. 3 validation(s) were run on this bug
DetailsIn response to this:
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. |
|
@dlom: No Jira issue is referenced in the title of this pull request. DetailsIn response to this:
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. |
GC-deleting a CRD destroys all its associated CRs (instant data loss), and other operators (e.g. MetalLB via ClusterExtension/boxcutter) may legitimately claim controller ownership of the same CRDs, which conflicts because Kubernetes only allows a single controller ownerReference per object. Skip CRDs when setting controller ownerReferences in the operconfig reconcile loop. Non-CRD resources continue to be owned as before. xref: OCPBUGS-84957
|
/retitle OCPBUGS-84957: Skip controller ownerReference on CRDs |
|
@dlom: This pull request references Jira Issue OCPBUGS-84957, which is valid. 3 validation(s) were run on this bug
DetailsIn response to this:
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. |
|
/retest |
3 similar comments
|
/retest |
|
/retest |
|
/retest |
|
@dlom: The following test failed, say
Full PR test history. Your PR dashboard. 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. I understand the commands that are listed here. |
Why
When CNO sets a controller ownerReference on CRDs (e.g. FRRConfiguration, BGPPeer),
two problems arise:
collection cascades to the CRD, which in turn destroys all CRs of that type
cluster-wide.
ownerReference per object. Other operators (e.g. MetalLB installed via
ClusterExtension/boxcutter) may legitimately need controller ownership of
the same CRDs, causing
AlreadyOwnedErrorfailures.xref: OCPBUGS-84957
What
isCRD()helper that checks forapiextensions.k8s.iogroup +CustomResourceDefinitionkind.SetControllerReferencefor CRD objects in the operconfig reconcileloop. Non-CRD resources continue to receive controller ownerReferences as
before.
Testing
Unit tests (added in this PR):
TestIsCRD: verifies the helper correctly identifies CRDs by group+kind andrejects non-CRD resources including those with the same Kind in a different
API group.
TestSetControllerReferenceSkipsCRDs: integration-style test that confirmsDeployments receive a controller ownerReference while CRDs do not.
E2E: This repo does not maintain in-tree e2e tests. E2e coverage is provided
by the OpenShift CI
e2e-aws-ovn,e2e-gcp-ovn, ande2e-metal-ipilanesthat run the full
openshift-testssuite against a cluster with CNO deployed.The change is a conditional skip of one
SetControllerReferencecall — theexisting CI lanes validate that CNO continues to reconcile and that no operand
regressions occur. Targeted e2e verification of CRD ownership semantics would
require a multi-operator fixture (CNO + an external CRD claimant) that is not
available in the standard CI environment.