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 enabled state
  • 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_scopings table
  • ci_runner_controller_runner_level_scopings table
  • 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 on runner_controller_id
  • ci_runner_controller_runner_level_scopings: index on runner_controller_id, index on runner_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
Edited by Taka Nishida