Repository navigation
Conversation
|
@Quindrix we finished a refactor in the main. Now we can add your code fix. Can you fix the conflicts. For more context: https://github.com/github-aws-runners/terraform-aws-github-runner/blob/main/docs/adr/002-runner-orchestration-provider-boundary.md |
2b8c476 to
31889c7
Compare
Group subnets into AZ-safe fleet requests and distribute capacity across them. Carry retryable failures forward to alternative subnets and add the required DescribeSubnets permissions.
31889c7 to
d9a2d68
Compare
|
@edersonbrilhante Apologies for the delay in getting this done. I've tested the rebased version in our environment and it's still working. I see one of the checks is failing for a HTTP 500. I'm not able to re-trigger it. |
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Default subnet-exhaustion handling and retry classification can prevent failover or cause excessive and duplicate fleet requests.
Review effort: Balanced
Findings: 3
Open (3)
What changed in this PR
Adds AZ-safe subnet grouping and capacity distribution for EC2 runners using same-AZ subnets.
Changes:
- Resolves subnet Availability Zones and creates safe fleet combinations.
- Distributes capacity and carries retryable failures between combinations.
- Adds IAM permissions, tests, and updated documentation.
| File | Description |
|---|---|
variables.tf |
Updates subnet requirements. |
README.md |
Regenerates root input documentation. |
modules/runners/variables.tf |
Updates runner subnet description. |
modules/runners/README.md |
Regenerates runner documentation. |
modules/runners/pool/policies/lambda-pool.json |
Grants subnet lookup permission. |
modules/runners/policies/lambda-scale-up.json |
Grants subnet lookup permission. |
modules/multi-runner/variables.tf |
Updates multi-runner subnet description. |
modules/multi-runner/README.md |
Regenerates multi-runner documentation. |
modules/compute-providers/aws/ec2/control-plane.tf |
Adds subnet permissions to v2 control planes. |
lambdas/libs/compute-providers/aws/ec2/src/runners.ts |
Implements subnet AZ lookup. |
lambdas/libs/compute-providers/aws/ec2/src/runners.test.ts |
Tests subnet lookup. |
lambdas/libs/compute-providers/aws/ec2/src/control-plane/scale-up.test.ts |
Tests grouping, allocation, and carry behavior. |
lambdas/libs/compute-providers/aws/ec2/src/control-plane/runner-creation.ts |
Implements AZ-safe allocation and failover. |
lambdas/libs/compute-providers/aws/ec2/src/control-plane/pool.ts |
Extends pool operation requirements. |
lambdas/libs/compute-providers/aws/ec2/src/control-plane/pool.test.ts |
Updates pool mocks for subnet lookup. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
|
||
| const allocations = buildSubnetAllocations(subnetSets, runnerParameters.numberOfRunners); | ||
| for (const allocation of allocations) { | ||
| const targetCapacity = allocation.targetCapacity + retryableCarry; |
| ); | ||
| result.instances.push(...allocationResult.instances); | ||
| result.nonRetryableErrorCount += allocationResult.nonRetryableErrorCount; | ||
| retryableCarry = allocationResult.retryableErrorCount; |
| const response = await ec2Client.send(new DescribeSubnetsCommand({ SubnetIds: subnetIds }), { | ||
| abortSignal: signal, | ||
| }); |
chore: merge upstream main into support-multiple-subnets-in-az

Description
This PR allows runner subnets to exist in the same AZ. It groups the configured subnets into safe combinations and distributes runner capacity across separate fleet requests. If a request encounters a retryable capacity failure, the remaining capacity is carried forward to the next available subnet combination.
It also adds the required
ec2:DescribeSubnetspermissions and updates the documentation to remove the previous requirement that every subnet must be in a different AZ. Dedicated-host and explicit subnet override behaviour remains unchanged.Test Plan
Related Issues
Fixes #5297, and follows on from #2904