Skip to content

🌱 CER: centralize status updates into big-R Reconcile method - #2200

Merged
openshift-merge-bot[bot] merged 1 commit into
operator-framework:mainfrom
joelanford:centralized-status-handling
Sep 12, 2025
Merged

🌱 CER: centralize status updates into big-R Reconcile method#2200
openshift-merge-bot[bot] merged 1 commit into
operator-framework:mainfrom
joelanford:centralized-status-handling

Conversation

@joelanford

Copy link
Copy Markdown
Member

Re-opening here now that poc-boxcutter PR is merged

Original PR: thetechnick#5

Description

A few small fixups and comment additions to help remember follow-ups:

  1. Make Reconcile and reconcile more consistent between CE and CER reconcilers
    • update status in one place in Reconcile
    • only log reconciler start/stop if we actually call reconcile

NOTE: There is still one major difference: CER updates finalizers as separate patches and continues reconcile logic. CE updates finalizers and requires re-reconcile to continue beyond. The CER logic may cause issues where the next reconcile sees a stale resource version (from finalizer patch) because the status update event isn't seen by our informer in time. This ultimately leads to reconciling a stale CER that manifests as a conflict error in our logs that is often a red herring for users trying to troubleshoot issues in controllers.

Another noticeable difference is that CE uses controller-runtime Finalizers helpers, and CER handles things manually.

Changing this broke unit tests, so I decided not to leave that change out to keep the PR scope small. I'll make a separate PR that focuses just on finalizers.

Reviewer Checklist

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

Signed-off-by: Joe Lanford <joe.lanford@gmail.com>
@joelanford
joelanford requested a review from a team as a code ownerSeptember 9, 2025 01:16
@netlify

netlifyBot commented Sep 9, 2025

Copy link
Copy Markdown

Deploy Preview for olmv1 ready!

NameLink
🔨 Latest commiteaac82d
🔍 Latest deploy loghttps://app.netlify.com/projects/olmv1/deploys/68bf800d2fbe75000845209d
😎 Deploy Previewhttps://deploy-preview-2200--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.

@joelanfordjoelanford changed the title CER: centralize status updates into big-R Reconcile method 🌱 CER: centralize status updates into big-R Reconcile methodSep 9, 2025
@codecov

codecovBot commented Sep 9, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 81.25000% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.09%. Comparing base (68610d0) to head (eaac82d).
⚠️ Report is 10 commits behind head on main.

Files with missing linesPatch %Lines
...controllers/clusterextensionrevision_controller.go79.66%10 Missing and 2 partials ⚠️
Additional details and impacted files
@@ Coverage Diff @@## main #2200 +/- ##
==========================================
+ Coverage 72.05% 72.09% +0.03% 
==========================================
Files 85 85 Lines 8332 8372 +40 ==========================================
+ Hits 6004 6036 +32 - Misses 1926 1932 +6 - Partials 402 404 +2 
FlagCoverage Δ
e2e39.17% <7.81%> (-0.29%)⬇️
experimental-e2e46.37% <73.43%> (+0.13%)⬆️
unit56.61% <53.12%> (-0.05%)⬇️

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.

Comment on lines +155 to +165
if err := c.removeFinalizer(ctx, rev, clusterExtensionRevisionTeardownFinalizer); err != nil {
meta.SetStatusCondition(&rev.Status.Conditions, metav1.Condition{
Type: "Available",
Status: metav1.ConditionFalse,
Reason: "ReconcileFailure",
Message: err.Error(),
ObservedGeneration: rev.Generation,
})
return ctrl.Result{}, fmt.Errorf("error removing teardown finalizer: %v", err)
}
return ctrl.Result{}, nil

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It seems semantically wrong to mark a Revision as "Available" == False for any issue with finalizers.

In general I would not report any internal error as a Status Condition.
If we want to show individual errors to users we should publish events on the resource.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Totally agree that this is likely the wrong type for this. I would expect to come back and clean this up prior to GA once there is a formal design on status handling.

In the meantime, I do think it is an important UX concern to tell the user something in a place they are likely to see it.

If they've deleted a CER (or an agent has on their behalf), but the finalizer isn't being removed for some reason, it would be a bad to UX for the CER to just... have no update. It would look like we just aren't reconciling it.

@tmshort

Copy link
Copy Markdown
Contributor

/approve

@openshift-ci

Copy link
Copy Markdown

[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

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

@openshift-ciopenshift-ciBot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 11, 2025
@thetechnick

Copy link
Copy Markdown
Contributor

/lgtm

@openshift-ciopenshift-ciBot added the lgtm Indicates that a PR is ready to be merged. label Sep 12, 2025
@openshift-merge-bot
openshift-merge-botBot merged commit f512e1e into operator-framework:mainSep 12, 2025
28 of 30 checks passed
@joelanford
joelanford deleted the centralized-status-handling branch December 5, 2025 15:57
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approvedIndicates a PR has been approved by an approver from all required OWNERS files.lgtmIndicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@joelanford@tmshort@thetechnick