Skip to content

Rails and DB: Add and persist field to support shared namespace in agent configuration

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.

Agent: Add protobuf field to support shared nam... (#519254 - closed) will introduce these changes on the agent side. This issue concerns with making changes on the Rails and DB side to support this.

Acceptance criteria

  • A new field named shared_namespace of type string is added in the workpsaces_agent_configs table with a default value of empty string which is not null
  • If the value is set in the agent configuration, it cannot be an empty string.
  • The value passed by the agent to Rails when it is getting started is persisted in the database.

Implementation plan

  • Add a regular schema DB migration to add a new field. Follow the docs here. For existing records, this field will not be set i.e. it is allowed to be nullable. Given the low volume of the table, a regular migration is fine and we need not use a Post-deployment migration.
  • Add logic in RemoteDevelopment::AgentConfigOperations::Updater to persist the value in the database if it is passed in the agent configuration. Else, it will not be set.
Edited by Vishal Tak