Project and Organization Deletion Process
When Project/Organization is deleted, we need to ensure that limit
values will return to the assigner. This is why AcceptedPlan instances
have assignee reference fields, with the ASYNC_CASCADE_DELETE
option.
When they are deleted, plans follow. This will delete PlanAssignments,
but as it was said, LimitPools are not given reserved values yet.
Instead, db-controllers should be deleting all child resources of the
assignee, like Project. This will decrease Limit usage values, till we
hit 0.
To prevent deletion of Limit/LimitPool instances before they reach zero
values, we utilize metadata.lifecycle.block_deletion
field, as below:
-
limits/server/v1/limit/limit_service.go
Take a look at the update function, UpdateMetadataDeletionBlockFlag.
-
limits/server/v1/limit/limit_pool_service.go
Take a look at the update function, UpdateMetadataDeletionBlockFlag.
This way LimitPool and Limit resources disappear only last. We achieve some order of deletions, so it is not chaotic. The controller for the assignee will confirm the reserved value of LimitPool is decreased only after whole resource collections are truly deleted.