-
Notifications
You must be signed in to change notification settings - Fork 248
OCPBUGS-39539: clear rogue controller ownerReferences during merge #1445
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
savio87
wants to merge
1
commit into
openshift:main
Choose a base branch
from
savio87:OCPBUGS-39539
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+65
−0
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expanding on my 2024 context, this function is old, dating all the way back to 2018, #7, d9f6718. That commit message doesn't go into detail about why the CVO chose to merge itself into
ownerReferencesinstead of compeltely owningownerReferencesin any resource it managed. But it means that now we're in the sticky position of wondering if we can own more ofownerReferencesor not. Why does the oldcontroller: trueentry exist? Is it safe to clearcontrolleron those entries? Maybe... something.. should be removing those entries? It's hard to know.For the bug's original
clusterserviceversions.operators.coreos.comwithFound "true" in references for ClusterServiceVersion/rhsso-operator.7.6.9-opr-002 and ClusterVersion/version, the issue seems to be the RHSSO operator, right? Should it own that CRD? I'd expect the answer is "no, it does not belong in that CRD'sownerReferencesat all, and there should be a bug against the RHSSO operator to get it to remove that entry from the CRD'sownerReferences".Or maybe we want to tighten the CVO's original weak stance up, and say "look, we're a powerful operator, and if we think that resource is ours, we're erasing your attempt at being in
ownerReferencesentirely". In that case, #7's original weaker stance was an error.But keeping
ownerRerferencesentries we don't understand and just clearingcontrolleron them seems like it's sitting in the middle, and that feels messy to me, and I don't see an upside to sitting on the fence. Both "we ownownerReferenceson our resources entirely" and "we complain when there's a conflict, so the cluster-admin can dig in and report a bug against whoever falsely thought they were the controller" make sense to me.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the ControllerRef proposal:
If I understand correctly, in the mentioned bug, the CVO de facto respects the API: once another operator is set as controller, the CVO stops managing the resource. It's de facto because the CVO doesn't check the controllerRef and backs off deliberately - it re-adds its own Controller: true ownerReference on reconcile, the API rejects the update ("only one reference can have Controller set to true"), and the CVO simply can't proceed. It never stomps the rogue ownerReference to force its way through; it just stops and surfaces the failure.
The CVO was initially set as the controller owner of the object and was removed by the rogue operator. Clearing out any such rogue operators as controllers may not stop them from clearing the CVO out again and continuing to fight in an endless loop, which can "destabilize the apiserver, thrash objects back-and-forth, or cause controller operations to hang".
This is an RHSSO operator issue.
However, the bug itself is about what we should do in such cases. Is bricking the CVO the desired outcome? Probably not. However, not respecting the API also does not sound like the ideal approach. Currently, everything works "as expected":
The user-facing ClusterVersion conditions:
The CVO logs include more information such as:
We may stomp the rogue operator's changes to proceed, but most likely it won't stop them. A rogue operator may overwrite the CRD on startup or continuously. If continuously, it will only make it harder to detect the introduced situation while introducing a hidden regression in performance and potentially in functionality due to the operators continuously overwriting their changes.
From the proposal:
The ControllerRef API has its purpose.
The CVO gets attributed the bug because it is simply vocal about the existing issue caused by a local cluster configuration and respects the API to not cause issues.
Removing the controllerRef from a rogue operator, who wants to forcibly manage the object, may introduce issues for that operator of an unknown impact. The CVO fighting with a rogue controller may introduce other issues. Leaving things as-is introduces a blocked CVO as the issue. A serious issue; however, it is communicated to the cluster administrator.
I am inclined towards the "we complain when there's a conflict, so the cluster-admin can dig in and report a bug against whoever falsely thought they were the controller" approach, provided we give actionable enough advice to the cluster administrators where to look next. Maybe
Could not update customresourcedefinition "clusterserviceversions.operators.coreos.com" (649 of 901): the object is invalid, possibly due to local cluster configurationis not strong enough?Alternatively, we may yield being the controller when someone forces us out in a live-cluster and adopt the object when it becomes an orphan; however, that smells like a Pandora's box.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @wking and @DavidHurta for the thorough review and the historical context, really appreciate it.
I agree that the current approach (keeping the rogue ref but clearing its controller flag) sits in an awkward middle ground. After reading your feedback, I see three possible directions:
Improve the error message - Keep the current CVO behavior (fail when there's a conflict), but make the error message more actionable so cluster-admins know exactly which operator is the rogue controller and can file a bug against it. This aligns with the "don't interfere" principle from the ControllerRef proposal.
CVO fully owns ownerReferences - When CVO manages a resource, it takes complete ownership of ownerReferences and removes rogue entries entirely rather than trying to merge them.
Close this PR - The root cause belongs in the rogue operator (RHSSO in this case) and this isn't something CVO should work around.
Which direction would you prefer? Happy to update the PR accordingly.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am personally open to improving the error message or closing this PR. Both options work for me.
With respect to closing the PR.
My view may be very biased as someone who is working with the CVO; thus, an outside perspective is especially very desired in such areas.
I agree that the
possibly due to local cluster configurationleaves a lot of things implied for the cluster administrator, and I am sure there may be more such messages in the CVO code-base.Checking the CVO logs is the next best step when troubleshooting any such issues, but that may not be apparent, and I do not blame anyone for that.
One option would be to introduce the improved error propagation. I am happy to review such PRs, but their priority and severity would be somewhat lower at this time, IMO.