Skip to content

[Backport release-1.0] fix: consolidate garbage collection for namespaced and cluster-scoped workspaces#127

Merged
ulucinar merged 1 commit intorelease-1.0from
backport-124-to-release-1.0
Feb 24, 2026
Merged

[Backport release-1.0] fix: consolidate garbage collection for namespaced and cluster-scoped workspaces#127
ulucinar merged 1 commit intorelease-1.0from
backport-124-to-release-1.0

Conversation

@github-actions
Copy link
Copy Markdown

Description

Backport of #124 to release-1.0.

… workspaces

Fixes the bug in the garbage collector that caused unintended workspace
directory deletions.

Previously, both cluster-scoped and namespaced workspace
controllers started their own GC instances on the same root directory.
Each GC only checked their respective Workspace MR instances, causing race and deletions of workspace dirs of each other, e.g. cluster-scoped GC deleting workspace directories and vice versa.

The fix consolidates the GC logic to consider both Workspace MR types and runs a centralized GC controller, per root directory ( e.g. `/tofu` and `/tmp/tofu`)
It also considers edge cases due to potential usage of SafeStart, where namespaced or cluster-scoped Workspace CRDs might not be available immediately or not used at all.

- GC logic is now  controller-runtime `manager.Runnable` with proper shutdown context
- centralized gc.Setup() with ensuring "run once", whichever controller
- Added tests for CRD gating scenarios

Signed-off-by: Erhan Cagirici <erhan@upbound.io>
(cherry picked from commit c900862)
@ulucinar
Copy link
Copy Markdown
Contributor

/test-examples="examples/cluster/workspace-inline-aws.yaml"

@ulucinar ulucinar merged commit 487c7d7 into release-1.0 Feb 24, 2026
2 checks passed
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