S Cells 1.0: `ci_runners` sharding key
For Cells 1.0 we need a way to make sure that every entity in Organization 1 doesn't have links to any other Organization.
To do that, we need to add sharding keys, see more in https://docs.gitlab.com/ee/architecture/blueprints/organization/isolation.html
ci_runners
table creates a challenge here:
- it doesn't have a sharding key yet
- it can belong to project/group
- the sharding key would be nullable because runner can be an instance runner and not belong to anything
- we allow users to link project runners to any other project with no restrictions
- There are tables which depend on the runner, e.g.
runner_machines
which will inherit all the same limitation, including sharding key being nullable
Proposed solution
-
Add a organization_id
column to runners with default valueOrganizations::Organization::DEFAULT_ORGANIZATION_ID
(!156380). -
Create post deployment migration to set organization ID to -1 for instance_type
runners. -
Add code in Rails to set correct organization ID when runner is created. -
Runners should not be allowed to be shared across organizations (#467237).
Edited by Pedro Pombeiro