Skip to content

fix(PLT-6661): manage finalizers by using update instead of apply - #36

Merged
davidmdm merged 1 commit into
masterfrom
feat/PL-6661/add-release-pruning
Aug 10, 2026
Merged

fix(PLT-6661): manage finalizers by using update instead of apply#36
davidmdm merged 1 commit into
masterfrom
feat/PL-6661/add-release-pruning

Conversation

@davidmdm

@davidmdm davidmdm commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

This PR changes the finalizer update operations to use update instead of apply.

This is a simple way of not fighting for fieldManagement ownership and keeping the joy-operators field management restrained to the finalizer.

Perhaps a JSON patch approach would work equally well but this is simpler to implement.

Summary by CodeRabbit

  • Bug Fixes
    • Improved release cleanup and finalizer updates for more reliable persistence.
    • Updated end-to-end resource handling to prevent conflicts when pruning releases.

@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The release reconciler now persists prune-release finalizer changes with standard updates. End-to-end tests use e2e-tests as the field manager, with forced application enabled for release-pruning resources.

Changes

Release persistence and test applications

Layer / File(s) Summary
Persist release finalizers with updates
cmd/operator/reconciler_release.go
Finalizer additions and removals use standard release updates with the operator field manager.
Align E2E application ownership
cmd/operator/main_test.go
Resource applications use the e2e-tests field manager. Release-pruning applications also set Force: true.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the main change: managing release finalizers with Update instead of Apply.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/PL-6661/add-release-pruning

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@cmd/operator/reconciler_release.go`:
- Around line 89-90: Update the error message in the releaseIntf.Update error
path to say “failed to update” instead of “failed to apply,” while preserving
the existing wrapped error and reconciliation behavior.
- Around line 89-95: Update the deletion cleanup branch that removes
finalizerPruneRelease to call releaseIntf.Update with
metav1.UpdateOptions{FieldManager: joyOperator} instead of releaseIntf.Apply
with Force: true. Keep the existing finalizer removal and error handling
unchanged, and ensure both cleanup paths use Update.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 4417f291-0668-4bfe-9cea-9ca0b25325cb

📥 Commits

Reviewing files that changed from the base of the PR and between b316c4c and a8cedef.

📒 Files selected for processing (2)
  • cmd/operator/main_test.go
  • cmd/operator/reconciler_release.go

Comment thread cmd/operator/reconciler_release.go Outdated
Comment on lines 89 to 90
if _, err := releaseIntf.Update(ctx, release, metav1.UpdateOptions{FieldManager: joyOperator}); err != nil {
return ctrl.Result{}, fmt.Errorf("failed to apply prune-release finalizer: %w", err)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Correct the error message.

Line 89 now performs an update, but Line 90 still reports “failed to apply”. Change the message to “failed to update” so reconciliation errors identify the actual operation.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@cmd/operator/reconciler_release.go` around lines 89 - 90, Update the error
message in the releaseIntf.Update error path to say “failed to update” instead
of “failed to apply,” while preserving the existing wrapped error and
reconciliation behavior.

Comment thread cmd/operator/reconciler_release.go
@davidmdm
davidmdm force-pushed the feat/PL-6661/add-release-pruning branch from a8cedef to 80af8e1 Compare August 10, 2026 22:13
@davidmdm
davidmdm requested a review from nwaller-nesto August 10, 2026 22:19
@davidmdm
davidmdm merged commit 5cc90b0 into master Aug 10, 2026
7 checks passed
@davidmdm
davidmdm deleted the feat/PL-6661/add-release-pruning branch August 10, 2026 22:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants