fix: Propagate idle_percentage/scale_factor to internal/ec2

What

Ensure that var.idle_percentage is passed from runner/prod to runner/internal/ec2 module and ensures that the value is templated into the config.toml as the scale_factor setting.

Duo says:

This merge request introduces changes to improve the autoscaling functionality of EC2 instances for runners. The main addition is a new "idle_percentage" variable, which allows maintaining a certain percentage of idle instances relative to the number of busy ones. This feature is implemented in the configuration file, the EC2 module, and the runner module. Additionally, the changes include updating the autoscaler policy to use this new idle percentage parameter. These modifications provide more flexibility in managing the number of available runners, potentially improving resource utilization and response times.

Why

Relates to idle_percentage isn't used in aws/runner/intern... (#130 - closed). While I've been performance testing Hosted Runners for GitLab Dedicated, I noticed that changing var.idle_percentage really didn't do anything to affect the behaviour of the runner manager as we have it setup in Dedicated (see this Epic, https://gitlab.com/groups/gitlab-com/gl-infra/gitlab-dedicated/-/epics/581+). I notice that idle_percentage and scale_factor have the same description, it seemed like propagating the value all the way down was overlooked. More details in the linked ticket.

Note for reviewers

From reading this documentation, I understand that the act of defining the scale_factor setting in config.toml will change the behaviour of the runner manager. In the case of Hosted Runners for GitLab Dedicated, we want this change in behaviour, because right now idle_percentage is a no-op. But, since this is changing default behaviour, I am definitely open to feedback suggesting that I gate the setting behind an if statement in the template so that if some users of GRIT don't want this specific behaviour, it isn't enabled.

Changelog

Added:

  • Pass idle_percentage from prod module to internal/ec2 module
  • scale_factor variable to the config.toml template
  • Pass var.idle_percentage as scale_factor to the template
Edited by Nick Skoretz

Merge request reports

Loading