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_secretsin theworkspace_agent_configstable, thenamespaceattribute should be the same asshared_namespacecolumn on theworkspace_agent_configstable ifshared_namespaceis not nil.
Implementation plan
- Add model validation in
RemoteDevelopment::WorkspacesAgentConfigto ensure every item inimage_pull_secretsin theworkspace_agent_configstable, thenamespaceattribute should be the same asshared_namespacecolumn on theworkspace_agent_configstable ifshared_namespaceis not empty. - Update the unit tests at
ee/spec/models/remote_development/workspaces_agent_config_spec.rband the integration tests atee/spec/models/remote_development/workspace_spec.rb.
Edited by Vishal Tak