spotlight_runner_pool

The spotlight_runner_pool resource, and the runner pool resource of the API: a pool that accepts runners into a workspace. Hosts claim a pull pool's work with its token, and Spotlight calls a push pool to start a runner for each run. Writing one needs the runners permission; see Roles and permissions.

KindEndpointTerraformAddress
runner-pool/api/v1/resources/workspaces/{workspaceId}/runner-poolsspotlight_runner_pool<key>

See Resource API for the operations, headers and errors every kind shares.

Example

resource "random_password" "ephemeral" {
  length  = 48
  special = false
}

resource "random_password" "provision" {
  length  = 32
  special = false
}

resource "spotlight_runner_pool" "ephemeral" {
  workspace_id  = spotlight_workspace.acme.id
  key           = "ephemeral"
  labels        = ["linux"]
  max_runs      = 8
  token         = random_password.ephemeral.result
  token_version = 1
}

resource "spotlight_runner_pool" "k8s_jobs" {
  workspace_id = spotlight_workspace.acme.id
  key          = "k8s-jobs"
  labels       = ["gpu"]
  provision = {
    url            = "https://provision.example.com/runs"
    secret         = "whsec_${base64encode(random_password.provision.result)}"
    secret_version = 1
    egress         = "spotlight"
  }
}

Fields

A pool without provision is pulled from: hosts claim work from it with the pool token. A pool with provision is pushed to: Spotlight calls provision.url for each run, as described in Provision call, and the pool has no token. Which of the two a pool is cannot change; in Terraform, adding or removing provision replaces the pool.

FieldTypeDefaultDescription
keystringrequiredLowercase words joined by dashes, at most 64 characters. Placement ignores it; lines and stations place work on the pool by its labels. Immutable: an update that changes it is rejected; Terraform replaces the resource.
labelsarray of strings[]Names a line or station may use in runners to place work on the pool. Lowercase words joined by dashes, at most 64 characters, each once.
maxRunsinteger or nullnullThe most runs the pool serves at once, 1 to 10,000. Null is no limit.
tokenstringnonePull pools only. Write-only. 32 to 255 of A-Z a-z 0-9 . _ ~ -. Without it, Spotlight issues one; see Pool token.
tokenVersionintegernonePull pools only. At least 0. A change must come with a new token.
provision.urlstringnoneAn absolute http or https URL with no credentials and no fragment, at most 2,048 characters. Required with provision.
provision.secretstringnoneWrite-only. whsec_ followed by 24 to 64 base64-encoded bytes. Required with provision: on create and whenever secretVersion changes.
provision.secretVersionintegernoneAt least 0. A change, with a new secret, rotates the secret.
provision.egressstring or nullnullThe egress the pool's runners send their traffic through: spotlight for the platform egress, or the id of a spotlight_egress in the workspace. A change updates the pool in place. See Egress.
provision.egressTrafficall or boundallWhich traffic of a run goes through the egress. all: every connection, so egress records every host and its allow-list applies to all of them. bound: only the traffic to hosts that a secret of the run is bound to; other traffic goes directly. Only with provision.egress. In Terraform, provision.egress_traffic.
modestringread-onlypull or push.

In Terraform, token and provision.secret are write-only and need Terraform 1.11 or later. A token Spotlight issues is not kept in the Terraform state.

spotlight_workspace_runners names a workspace's pools by key.

Egress

A push pool that names an egress gets runs whose secrets egress injects, or that use Spotlight's API, and setup chats can run on it. A push pool without provision.egress gets neither: those runs wait for a host, or for another pool that names an egress. For each runner, Spotlight puts the egress's URL and a run proxy credential in the provision call.

spotlight names the platform egress: the egress that the Spotlight deployment names in SPOTLIGHT_PLATFORM_EGRESS_URL and SPOTLIGHT_PLATFORM_EGRESS_TOKEN. A pool that names spotlight counts as having an egress only while the deployment sets both. See Self-hosted Spotlight settings.

A run whose secrets egress injects, or that uses Spotlight's API, fails with unusable if, when Spotlight provisions its runner, the pool no longer names an egress: The pool names no egress now. A run whose secrets egress injects, or that uses the Spotlight API, needs one.

MessageCause
names spotlight. This deployment has no platform egress. Please name an egress of this workspace, or leave provision.egress outspotlight on a deployment without a platform egress.
names <id>. Egress <id> doesn't exist in this workspaceAn id that is not an egress of the pool's workspace, or names a deleted egress.

Pool token

  • A pool created without token gets one from Spotlight, returned once in the Spotlight-Pool-Token response header, never again.
  • Spotlight keeps only its hash.
  • Each token is single-use. A token that another pool has is rejected with is in use by another pool. Please use a different token for each pool. A token rotated away, or used by a pool since deleted or replaced, is rejected for every pool, the pool that used it included, with was used before. Each pool token is single-use. Please use a new token.
  • After a rotation with a new tokenVersion, the old token stops working at once. Runs already claimed keep their own one-run credentials.
  • token and tokenVersion on a push pool are rejected.

Warnings

PathWarning
provision.urlis not https. Its calls carry a one-run token. A production deployment does not make them

Delete

Runs that the pool's runners already lease carry on to their end after the pool is deleted.

On this page