Limit the CI Runners registered to a group or project (public issue)
Overview
This is the public issue describing the Limit the CI Runners registered to a group or project feature.
As a first step towards simplifying the management of a large runner fleet and reducing runner sprawl, this feature introduces a default limit to the number of runners registered to a group or project.
This feature was first enabled on GitLab SaaS in 13.12, and with the 14.4 release the feature is now fully enabled and limits to 1,000 the number of registered runners.
For Self-Managed GitLab this feature will be enabled starting in 14.4 (ci_runners_limit feature flag will be removed since we have the override ci_runners_limit_override feature flag which can be leveraged to disable limits. ci_runners_limit_override will be removed in 14.6).
CI Runners Limits
| GitLab SaaS plan | CI Runners Limit |
|---|---|
| Free | 50 |
| Premium, Ultimate | 1,000 |
Proposal
-
Create new
:ci_registered_(group|project)_runnersplan limits, by writing migrations to introduce and configure the plan limits.rails generate migration AddRunnerRegistrationToPlanLimits ci_registered_instance_runners:integer rails generate migration InsertRunnerRegistrationPlanLimits -
Add
Limitableconcern to::Ci::RunnerProjectmodel. This will serve to check the:ci_registered_project_runnerslimit. The limit should only include runners that have contacted in the last 3 months.- With this approach, in a situation where the number of runners assigned to a project was already above the limit, the administrator can still perform modifications to the runner, such as renaming it but cannot, for instance, reassign another runner into that project until he/she gets the number of runners in that project below the threshold;
-
Add
Limitableconcern to::Ci::RunnerNamespacemodel. This will serve to check the:ci_registered_group_runnerslimit. The limit should only include runners that have contacted in the last 3 months.