You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(pool): Allow to optionally include busy runners into the pool (github-aws-runners#5078)
## Description
'pool_config' is useful when one wants to ensure that a certain number
of runners is running within given time periods.
However, when 'pool_config' is used in a combination with persistent
runners,
the pool lambda tends to spin up new runner instance when it sees that
some
existing runners are online, but busy.
As a result, with frequent pool lambda checks, the total size of the
runners
pool tends to grow more than desired (without respecting
'runners_maximum_count', which is only considered by the 'scale_up'
lambda).
These changes introduce a new 'pool_include_busy_runners' module
variable
to make it possbile to include all online runners (both idle and busy)
into the pool, so that the pool's lambda only tops up the pool if not
enough runners are online.
<!-- Briefly describe the changes in this PR. -->
## Test Plan
Tested on a module instance with persistent runners, also added a few
unit tests to the pool lambda itself.
<!--
Please describe how you tested these changes. This helps reviewers
understand
the scope and confidence level of the change. Examples:
- Ran `terraform plan` against an existing deployment
- Added/updated unit tests (link to test file or describe coverage)
- Deployed to a test environment and triggered a workflow run
- Validated with `terraform validate` and `tflint`
-->
## Related Issues
<!-- Link any related issues, e.g. Fixesgithub-aws-runners#123, Closesgithub-aws-runners#456 -->
Copy file name to clipboardExpand all lines: README.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -170,6 +170,7 @@ Join our discord community via [this invite link](https://discord.gg/bxgXW8jJGh)
170
170
| <aname="input_minimum_running_time_in_minutes"></a> [minimum\_running\_time\_in\_minutes](#input\_minimum\_running\_time\_in\_minutes)| The time an ec2 action runner should be running at minimum before terminated, if not busy. |`number`|`null`| no |
171
171
| <aname="input_parameter_store_tags"></a> [parameter\_store\_tags](#input\_parameter\_store\_tags)| Map of tags that will be added to all the SSM Parameter Store parameters created by the Lambda function. |`map(string)`|`{}`| no |
172
172
| <aname="input_pool_config"></a> [pool\_config](#input\_pool\_config)| The configuration for updating the pool. The `pool_size` to adjust to by the events triggered by the `schedule_expression`. For example you can configure a cron expression for weekdays to adjust the pool to 10 and another expression for the weekend to adjust the pool to 1. Use `schedule_expression_timezone` to override the schedule time zone (defaults to UTC). | <pre>list(object({<br/> schedule_expression = string<br/> schedule_expression_timezone = optional(string)<br/> size = number<br/> }))</pre> |`[]`| no |
173
+
| <aname="input_pool_include_busy_runners"></a> [pool\_include\_busy\_runners](#input\_pool\_include\_busy\_runners)| Include busy runners in the pool calculation. By default busy runners are not included in the pool. |`bool`|`false`| no |
173
174
| <aname="input_pool_lambda_memory_size"></a> [pool\_lambda\_memory\_size](#input\_pool\_lambda\_memory\_size)| Memory size limit for scale-up lambda. |`number`|`512`| no |
174
175
| <aname="input_pool_lambda_reserved_concurrent_executions"></a> [pool\_lambda\_reserved\_concurrent\_executions](#input\_pool\_lambda\_reserved\_concurrent\_executions)| Amount of reserved concurrent executions for the scale-up lambda function. A value of 0 disables lambda from being triggered and -1 removes any concurrency limitations. |`number`|`1`| no |
175
176
| <aname="input_pool_lambda_timeout"></a> [pool\_lambda\_timeout](#input\_pool\_lambda\_timeout)| Time out for the pool lambda in seconds. |`number`|`60`| no |
Copy file name to clipboardExpand all lines: modules/runners/README.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -198,6 +198,7 @@ yarn run dist
198
198
| <aname="input_parameter_store_tags"></a> [parameter\_store\_tags](#input\_parameter\_store\_tags)| Map of tags that will be added to all the SSM Parameter Store parameters created by the Lambda function. |`map(string)`|`{}`| no |
199
199
| <aname="input_placement"></a> [placement](#input\_placement)| The placement options for the instance. See https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/launch_template#placement for details. | <pre>object({<br/> affinity = optional(string)<br/> availability_zone = optional(string)<br/> group_id = optional(string)<br/> group_name = optional(string)<br/> host_id = optional(string)<br/> host_resource_group_arn = optional(string)<br/> spread_domain = optional(string)<br/> tenancy = optional(string)<br/> partition_number = optional(number)<br/> })</pre> |`null`| no |
200
200
| <aname="input_pool_config"></a> [pool\_config](#input\_pool\_config)| The configuration for updating the pool. The `pool_size` to adjust to by the events triggered by the `schedule_expression`. For example you can configure a cron expression for week days to adjust the pool to 10 and another expression for the weekend to adjust the pool to 1. Use `schedule_expression_timezone ` to override the schedule time zone (defaults to UTC). | <pre>list(object({<br/> schedule_expression = string<br/> schedule_expression_timezone = optional(string)<br/> size = number<br/> }))</pre> |`[]`| no |
201
+
| <aname="input_pool_include_busy_runners"></a> [pool\_include\_busy\_runners](#input\_pool\_include\_busy\_runners)| Include busy runners in the pool calculation. By default busy runners are not included in the pool. |`bool`|`false`| no |
201
202
| <aname="input_pool_lambda_memory_size"></a> [pool\_lambda\_memory\_size](#input\_pool\_lambda\_memory\_size)| Lambda Memory size limit in MB for pool lambda |`number`|`512`| no |
202
203
| <aname="input_pool_lambda_reserved_concurrent_executions"></a> [pool\_lambda\_reserved\_concurrent\_executions](#input\_pool\_lambda\_reserved\_concurrent\_executions)| Amount of reserved concurrent executions for the scale-up lambda function. A value of 0 disables lambda from being triggered and -1 removes any concurrency limitations. |`number`|`1`| no |
203
204
| <aname="input_pool_lambda_timeout"></a> [pool\_lambda\_timeout](#input\_pool\_lambda\_timeout)| Time out for the pool lambda in seconds. |`number`|`60`| no |
Copy file name to clipboardExpand all lines: modules/runners/variables.tf
+6Lines changed: 6 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -606,6 +606,12 @@ variable "pool_config" {
606
606
default=[]
607
607
}
608
608
609
+
variable"pool_include_busy_runners" {
610
+
description="Include busy runners in the pool calculation. By default busy runners are not included in the pool."
611
+
type=bool
612
+
default=false
613
+
}
614
+
609
615
variable"disable_runner_autoupdate" {
610
616
description="Disable the auto update of the github runner agent. Be aware there is a grace period of 30 days, see also the [GitHub article](https://github.blog/changelog/2022-02-01-github-actions-self-hosted-runners-can-now-disable-automatic-updates/)"
0 commit comments