cdk-github-runners icon indicating copy to clipboard operation
cdk-github-runners copied to clipboard

Allow for jobs that are ambivalent about particular labels

Open jonathanmorley opened this issue 1 year ago • 3 comments

Currently, the set of labels you pass in from a job in a workflow must match completely to the set of labels on a runner. It would be nice to be able to omit certain labels to be able to benefit from existing infrastructure/load balancing

Example

You may have multiple providers (Lambda, Codebuild, ECS), and a job that doesn't care which of those providers it gets placed on. The job could simply not specify the provider type, and let the orchestrator place it as it thinks best.

jonathanmorley avatar May 11 '23 19:05 jonathanmorley

What kind of criteria are you thinking for best placing?

FWIW you can define your own provider by implementing IRunnerProvider and theoretically it can be used to build a composite provider that has some logic to pick a provider.

kichik avatar May 11 '23 22:05 kichik

Lets say you have ECS runners of various sizes (small, medium, large), running on a shared ASG, with instances sized to hold 1 large, or 2 medium, or 4 small runners.

Then occasionally you may have extra capacity in the cluster for mediums or smalls.

If a request comes in for [self-hosted, small], then it may be faster to provision a runner on the ECS cluster, than on another runner (e.g. codebuild).

jonathanmorley avatar May 12 '23 13:05 jonathanmorley

So you want this for cases where you're over capacity on some resource like in #193? Or are there other use cases? Do you want to also be able to force it to a certain provider without fallback?

Maybe something like:

new FallbackRunnerProvider(this, 'fallback', {
  labels: ['small'],
  providersOrder: [
    new EcsRunnerProvider(...),
    new CodeBuildRunnerProvider(...),
  ],
});

kichik avatar May 12 '23 16:05 kichik