Skip to content

Add workspace id label to all workspace resources unconditionally

MR: Pending

Description

All workspace components must have labels that are static across all workspaces in a cluster. This will enable Kubernetes cluster admins to manage workspaces better and also help team to run diagnostics on components with specific pairs of labels.

We have conditionally added a label(workspaces.gitlab.com/id) as part of Update workspaces config to apply when shared_n... (!189441 - merged) since we needed it to wrap up Allow remote development to create workspaces f... (&12327 - closed) . The reason we added it conditionally is because not doing so would mean we have to manage two versions of devfile_parser and desired_config_generator and also manage a DB migration to migrate the old config to the new one. This would complicate things as we work on Simplify freezing of Kubernetes resources for w... (&17483) .

So this issue pertain to adding this label unconditionally once we wrap up Simplify freezing of Kubernetes resources for w... (&17483) .

Acceptance criteria

  • Unconditionally add the label workspaces.gitlab.com/id to the workspace resources
  • Make relevant changes in the spec and clean it up

Implementation plan

  • Update ee/lib/remote_development/workspace_operations/reconcile/output/config_values_extractor.rb to unconditionally add the label workspaces.gitlab.com/id in all workspace resources.
  • Update ee/lib/remote_development/workspace_operations/reconcile/output/desired_config_generator.rb to remove the condition checking the existence of the label workspaces.gitlab.com/id in the function generating the network policy.
  • Update ee/spec/lib/remote_development/workspace_operations/reconcile/output/config_values_extractor_spec.rb to remove the describe "devfile_parser_params[:labels]" block since we always add this label now.
  • Update ee/spec/lib/remote_development/workspace_operations/reconcile/output/desired_config_generator_spec.rb to remove the check for pod selector labels in the context 'when shared_namespace is not empty' block.
  • Update ee/spec/support/shared_contexts/remote_development/remote_development_shared_contexts.rb accordingly.
Edited by Vishal Tak