Rails: Add validation for image_pull_secrets when using shared namespace mode

MR: Add validations for image pull secrets and shar... (!190059 - merged)

Description

As a user, I want specify the name of the namespace in which all the new Workspaces will be created in Kubernetes so that I can run GitLab Agent with non-clusterwide permissions. A side-effect of this would be that we do not allow image_pull_secrets to be in a different namespace than the one mentioned. This issue is about adding model validations for this.

Acceptance criteria

  • For every item in image_pull_secrets in the workspace_agent_configs table, the namespace attribute should be the same as shared_namespace column on the workspace_agent_configs table if shared_namespace is not nil.

Implementation plan

  • Add model validation in RemoteDevelopment::WorkspacesAgentConfig to ensure every item in image_pull_secrets in the workspace_agent_configs table, the namespace attribute should be the same as shared_namespace column on the workspace_agent_configs table if shared_namespace is not empty.
  • Update the unit tests at ee/spec/models/remote_development/workspaces_agent_config_spec.rb and the integration tests at ee/spec/models/remote_development/workspace_spec.rb.
Edited by Vishal Tak