Add DeleteOrganizationResources - #86
Open
vitramir wants to merge 1 commit into
Open
Conversation
Step 2 of the organization teardown: the organization's workload records, provisioned volume records, and org-scoped runners. Removing the records is what makes the running pods and disks orphans, which the Orchestrator's existing reconciliation then stops and deprovisions. No stop-everything path is added for a case reconciliation already covers. The rows go outright rather than being marked removed_at the way DeleteWorkload does. A soft delete keeps the row for metering to sample; the organization it is scoped by is going away, and a row holding an organization_id that resolves to nothing is the thing being fixed. Workload tuples come off before the rows, and are batched at OpenFGA's per-Write limit of 100. Workloads are deleted by organization rather than left to the runner cascade, because an organization's workloads also run on cluster-scoped runners that survive it. DeleteRunner keeps its permission check; both it and the teardown now call the same deleteRunnerRecord helper.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Step 2 of the organization teardown: the organization's workload records, provisioned volume records, and org-scoped runners.
Removing the records is what makes the running pods and disks orphans, which the Orchestrator's existing reconciliation then stops and deprovisions. No stop-everything path is added for a case reconciliation already covers.
Three decisions worth reviewing:
removed_at.DeleteWorkloadsoft-deletes so metering can still sample the row. The organization it is scoped by is going away, and a row holding anorganization_idthat resolves to nothing is exactly what this change set is fixing.workloads.runner_idcascades fromrunners, so deleting the org's runners would take their workloads — but an organization's workloads also run on cluster-scoped runners, which survive the teardown. Relying on the cascade alone would strand those.Writelimit of 100. A step interrupted after the rows are gone would have nothing left to enumerate the tuples from.DeleteRunnerkeeps its permission check; both it and the teardown now call the samedeleteRunnerRecordhelper, so a runner leaves through the same door — OpenZiti identity cleanup and membership-tuple removal included — however it is removed.New rule on the existing
AuthorizationPolicyadmitting only theorganizationsServiceAccount. Chart bumped to 0.2.0.Part of organization settings and deletion.