Fix workspaces reconciliation to send inventory config map correctly
Issue: Workspace hangs on restart after being stopped (#533807 - closed)
What does this MR do and why?
In cases where the workspace's desired state is not terminated(e.g. stopped) and where we perform a partial reconciliation, we are currently sending both the inventory config maps and no actual secrets(since it is partial reconciliation). This results in the deletion of the actual secrets which are to be mounted as files/environment-variables(this is expected behaviour). When you now try to start the stopped workspace, it fails because the expected secrets are not available. They will only become available when a full reconciliation happens.
This was introduced primarily in Update rails to send terminated workspace info ... (!185872 - merged) . The reason it was not caught in the unit tests is because the specs were incorrect changed here before Update rails to send terminated workspace info ... (!185872 - merged) was merged.
This MR fixes the specs first and then the domain logic where the final resultant is as follows
- When it is a partial/full reconciliation and desired state is terminated, the config to apply are the the core inventory configmap and the secrets inventory config map.
- When it is a partial reconciliation and the desired state is stopped/running, the config to apply are the core inventory configmap, deployment, service, service account, network policy.
- When it is a full reconciliation and the desired state is stopped/running, the config to apply are the core inventory configmap, deployment, service, service account, network policy, secrets inventory config map, resource quota, secrets(which are to be mounted as environment variables), secrets(which are to be mounted as files)
References
Screenshots or screen recordings
Screen_Recording_2025-04-08_at_11.15.03_AM
How to set up and validate locally
- Create a workspace.
- Stop the workspace.
- Start the workspace again and open it up when it is ready.
- Terminate the workspace.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.