Runner Controller scoping - Database schema (instance & runner)
Overview
Implement the database schema for Runner Controller scoping, focusing on instance-level and runner-level scoping in this iteration.
Context: Runner Controllers
Runner Controllers function like a "service":
- Can have any and multiple types of scope (cell, group, project, runner)
- Created without scope has no effect
- Has an
enabledstate - Scopes always apply "downward"
- "Cell" scope should be explicit
- Scopes on a "disabled" controller do not have effect
Scope of This Issue
In Scope ✅
-
ci_runner_controller_instance_level_scopingstable -
ci_runner_controller_runner_level_scopingstable - ActiveRecord models and associations
- Database migrations with proper indexes
- Cells-compatible schema design (sharding keys)
Out of Scope ❌
- External REST API for managing scopings (see linked issue)
- Internal API changes for Job Router (see linked issue)
- Group and project scoping tables (Phase 2)
- Dry-run functionality (see linked issue)
Database Schema
ci_runner_controller_instance_level_scopings
| Column | Type | Notes |
|---|---|---|
id |
bigint | Primary key |
runner_controller_id |
bigint | FK → ci_runner_controllers
|
-
gitlab_schema=gitlab_ci_cell_local
ci_runner_controller_runner_level_scopings
| Column | Type | Notes |
|---|---|---|
id |
bigint | Primary key |
runner_controller_id |
bigint | FK → ci_runner_controllers
|
runner_id |
bigint | FK → ci_runners
|
-
gitlab_schema=gitlab_ci_cell_local(sharding key:runner_id)
Indexes
-
ci_runner_controller_instance_level_scopings: index onrunner_controller_id -
ci_runner_controller_runner_level_scopings: index onrunner_controller_id, index onrunner_id
Acceptance Criteria
- Instance scoping table created with migrations
- Runner scoping table created with migrations
-
Models with proper associations to
CiRunnerController - Indexes for query performance
- Cells-compatible sharding configuration
Related Work Items
- #578037 (closed) - Runner Controller implementation
- #578797 (closed) - Runner Controller integration
- #583132 (closed) - Enabled/disabled state for controllers
Edited by Taka Nishida