Skip to content

fix stuck finalizer on delete - #173

Open
evhen14 wants to merge 1 commit into
restatedev:mainfrom
evhen14:fix-reconciling-stuck-deployments
Open

fix stuck finalizer on delete#173
evhen14 wants to merge 1 commit into
restatedev:mainfrom
evhen14:fix-reconciling-stuck-deployments

Conversation

@evhen14

@evhen14 evhen14 commented Jul 30, 2026

Copy link
Copy Markdown

Bug Fix

What Changed

When deleting a RestateDeployment, the finalizer no longer gets permanently
stuck with CleanupFailed(DeploymentInUse). Previously, cleanup_old_replicasets
treated the latest ReplicaSet's Restate deployment as an unconditional blocker
because it is always active = true in sys_service. Since no new version
ever registers during deletion, the active_count > 0 check caused an infinite
retry loop with no way out.

When rsd.deletion_timestamp.is_some(), active deployments are now scheduled
for drain (respecting spec.restate.drainDelaySeconds) rather than treated as
a permanent blocker. After the drain period they proceed through the existing
force-delete path.

Why This Matters

This is the common case in ephemeral PR/preview environments: a service is
deployed, registered with Restate, but no workflows are ever invoked before the
environment is torn down. Without this fix, deleting the RestateDeployment
would stall forever and require manual intervention to remove the finalizer.

Impact on Users

  • Existing deployments being deleted: Stuck RestateDeployment objects will
    make progress on the next reconcile after upgrading.
  • New deletions: Behave as expected — drain delay is respected, then the
    Restate deployment is force-deleted and the finalizer released.
  • No migration required.

Related Issues

@github-actions

Copy link
Copy Markdown


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

@evhen14

evhen14 commented Jul 30, 2026

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

@evhen14

evhen14 commented Jul 30, 2026

Copy link
Copy Markdown
Author

recheck

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