Rails: Update the reconciliation logic to send inventory config maps for workspaces with desired state as Terminated

MR:Rails: Update the reconciliation logic to send ... (#519257 - closed)

Description

Currently, when we want to terminate a workspace, we send the following information from Rails to Agent among other things - desired_state and the config_to_apply. The agent check if the desired_state is Terminated and if yes, it deletes the namespace of the workspace. This leads to a cascading delete of all the resources in the namespace. The agent completely ignores the config_to_apply value when the desired_state of the workspace is Terminated. Currently, we send the entire information about the workspace in config_to_apply - Inventory config map, Deployment, Service, etc.

To support scenarios where workspaces can be created in a single shared namespace, we need to modify the termination logic in the agent to not delete the namespace entirely(as there would only be a single namespace to create the workspace and the agent will not have permissions to do create/update/delete namespaces).

We are already relying on the inventory config maps to create/update resources. We should rely on the inventory config maps for deletion of resources as well.

Making this change will not affect the existing termination behaviour because the existing behaviour of the agent ignores this field in case of a workspace with desired_state as Terminated. This change is mainly laying the ground work.

Acceptance criteria

  • When the desired_state of the workspace is Terminated, the config_to_apply will be all the inventory config maps of the workspace.

Implementation plan

Here is a reference spike implementation - Draft: Spike: Workspaces in a single namespace (!181086 - closed)

Edited by Vishal Tak