doc/ci/runners/job_router/runner_controllers.md
{{< details >}}
{{< /details >}}
[!flag] The availability of this feature is controlled by a feature flag. For more information, see the history. This feature is available for testing, but not ready for production use.
{{< history >}}
job_router_admission_control. Disabled by default. This feature is an experiment and subject to the GitLab Testing Agreement.{{< /history >}}
Runner controllers enable admission control for CI/CD jobs routed through the job router. When a job is about to be executed, the job router sends an admission request to connected runner controllers, which can admit or reject the job based on custom policies.
Runner controllers are on the instance-level and are applicable to jobs depending on their scoping.
Use runner controllers to:
When you configure runner controllers with the job router, the admission control workflow operates as follows:
When a runner controller rejects a job, the job fails with the job_router_failure failure reason.
The job details page displays a message that includes:
When a runner controller is in dry_run state, rejection decisions are not enforced but are
logged as informational messages in the job router (KAS) backend logs. Use these logs to
validate your controller's behavior before you enable enforcement.
Runner controllers can be in one of three states:
| State | Description |
|---|---|
disabled | The runner controller does not receive admission requests. This is the default state. |
enabled | The runner controller receives admission requests and its decisions affect job execution. |
dry_run | The runner controller receives admission requests. Job router logs the decisions, but decisions are not enforced. Use this state for strategic rollouts to validate controller behavior and de-risk deployments before you enable enforcement. |
Runner controllers must be scoped to be active. A runner controller without any scope
does not receive admission requests, even when its state is enabled or dry_run.
Runner controllers support two mutually exclusive scoping types:
| Scope | Description |
|---|---|
| Instance | The runner controller evaluates jobs for all runners in the GitLab instance. This scope cannot be combined with runner scope. |
| Runner | The runner controller evaluates jobs only for specific runners. You can scope a controller to one or more runners. The runner must be an instance runner. |
Additional scope types (group, project) are proposed in issue 586419.
To manage runner controller scoping, see the runner controllers API.
Runner controllers are managed through the REST API. There is no UI for managing runner controllers yet.
Prerequisites:
For a step-by-step guide, see Tutorial: Build a runner admission controller.
To implement your own runner controller, you need to:
For technical specifications and protobuf definitions, see the runner controller documentation in the GitLab Agent for Kubernetes repository.