Skip to content

feat(dynamic-labels): add a capacity-type label to choose spot or on-demand per job #5484

Closed

Description

@atsikham

Summary

The capacity type (spot or on-demand) of a runner pool is fixed by instance_target_capacity_type. A workflow job cannot choose it. With dynamic labels enabled, a job can already pick the instance type, price, placement and more, but not spot versus on-demand.

Problem

Today the only option is a separate pool for each capacity type. This means duplicated Lambdas and configuration for the same instance types, only to change one setting. The topic came up before in #4138, where dynamic labels were mentioned as the direction.

Proposal

Add a dynamic label key:

ghr-ec2-capacity-type:spot
ghr-ec2-capacity-type:on-demand

The value overrides INSTANCE_TARGET_CAPACITY_TYPE for the runner created for that job.

Only spot and on-demand are accepted. Any other value raises InvalidRunnerLabelsError, the existing error for labels that are permanently invalid and must not be retried.

Behavior

  • Dedicated hosts: the RunInstances path does not support spot. On this path the label is ignored, and a spot value logs a warning. The instance stays on-demand.
  • On-demand failover: the failover already depends on the capacity type of the request, so no change is needed. A job with spot fails over to on-demand as configured. A job with on-demand never uses the failover.
  • Max price: ghr-ec2-max-price only applies to spot. For a job with on-demand the value is not passed to the fleet request.
  • Spot request tags: these tags come from the launch template, which defines them only when the pool default is spot without on-demand failover. Spot requests created for a job that overrides to spot in a pool with another default do not get these tags. The documentation will describe this.

Scope

  • Parse the new key in the dynamic labels code and pass it to the fleet request.
  • Unit tests for parsing, an invalid value, the dedicated-host case, the max price with on-demand, and the failover with both values.
  • Update the label list in docs/configuration.md and in the header comment of dynamic-labels.ts, including a policy example.

Activity

  1. added a commit that references this issue on Oct 2, 2026
    edecd36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions