Skip to content

🐛 short-circuit reconcile when objects are deleted #2022

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

Conversation

joelanford
Copy link
Member

Description

This is necessary to ensure that we do not keep reconciling the objects as if they were not deleted.

The need for this became apparent while trying to use --cascade=orphan with a ClusterExtension. In theory, that should work out of the box because, we set owner references on all managed objects.

However, that was not working because our controller was fully reconciling objects with metadata.finalizers: ["orphan"], which was writing owner references back into the objects that the orphan deletion process had just removed.

Ultimately this meant that the managed objects would be background deleted because they once again had an owner reference to the now-deleted ClusterExtension, which then caused the kubernetes garbage collector to clean them up.

In general, it stands to reason that once we have successfully processed all of our finalizers after a deletion of an object, we should stop reconciling that object.

Reviewer Checklist

  • API Go Documentation
  • Tests: Unit Tests (and E2E Tests, if appropriate)
  • Comprehensive Commit Messages
  • Links to related GitHub Issue(s)

This is necessary to ensure that we do not keep reconciling the objects
as if they were not deleted.

The need for this became apparent while trying to use --cascade=orphan
with a ClusterExtension. In theory, that should work out of the box
because, we set owner references on all managed objects.

However, that was not working because our controller was fully
reconciling objects with metadata.finalizers: ["orphan"], which was
writing owner references back into the objects that the orphan deletion
process had just removed.

Ultimately this meant that the managed objects would be background
deleted because they once again had an owner reference to the
now-deleted ClusterExtension, which then caused the kubernetes garbage
collector to clean them up.

In general, it stands to reason that once we have successfully processed
all of our finalizers after a deletion of an object, we should stop
reconciling that object.

Signed-off-by: Joe Lanford <[email protected]>
@joelanford joelanford requested a review from a team as a code owner June 10, 2025 21:11
Copy link

netlify bot commented Jun 10, 2025

Deploy Preview for olmv1 ready!

Name Link
🔨 Latest commit 6ca4419
🔍 Latest deploy log https://app.netlify.com/projects/olmv1/deploys/68489f66e2105b0009697a85
😎 Deploy Preview https://deploy-preview-2022--olmv1.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@tmshort
Copy link
Contributor

tmshort commented Jun 10, 2025

/approve

@tmshort
Copy link
Contributor

tmshort commented Jun 10, 2025

/lgtm

Copy link

openshift-ci bot commented Jun 10, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: tmshort

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

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 10, 2025
@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jun 10, 2025
Copy link

codecov bot commented Jun 10, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 69.26%. Comparing base (752d7d5) to head (6ca4419).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2022      +/-   ##
==========================================
+ Coverage   69.17%   69.26%   +0.08%     
==========================================
  Files          79       79              
  Lines        7037     7051      +14     
==========================================
+ Hits         4868     4884      +16     
+ Misses       1887     1885       -2     
  Partials      282      282              
Flag Coverage Δ
e2e 42.94% <0.00%> (-0.06%) ⬇️
unit 60.17% <100.00%> (+0.12%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@openshift-merge-bot openshift-merge-bot bot merged commit b152c7b into operator-framework:main Jun 10, 2025
24 of 25 checks passed
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. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants