Skip to content

Commit 6d04322

Browse files
authored
feat: add update_interval and update_interval_when_expecting (#1173)
## Description It seems that the default values set by GitLab are not perfect. I often saw rate limiting on the AWS API for autoscaling. Making these variables configurable ensures to stay below the limits. These variable have the same defaults as documented by GitLab: https://docs.gitlab.com/runner/configuration/advanced-configuration.html#the-runnersautoscaler-section The best values depend on how many Runners you have deployed. ## Verification None
1 parent 8141bbc commit 6d04322

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

main.tf

+4
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,10 @@ locals {
127127
runners_capacity_per_instance = 1
128128
runners_max_use_count = var.runner_worker_docker_autoscaler.max_use_count
129129
runners_max_instances = var.runner_worker.max_jobs
130+
131+
runners_update_interval = var.runner_worker_docker_autoscaler.update_interval
132+
runners_update_interval_when_expecting = var.runner_worker_docker_autoscaler.update_interval_when_expecting
133+
130134
runners_autoscaling = [for config in var.runner_worker_docker_autoscaler_autoscaling_options : {
131135
for key, value in config :
132136
# Convert key from snake_case to PascalCase which is the casing for this section.

template/runner-docker-autoscaler-config.tftpl

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
plugin = "fleeting-plugin-aws"
44

55
capacity_per_instance = ${runners_capacity_per_instance}
6+
update_interval = ${runners_update_interval}
7+
update_interval_when_expecting = ${runners_update_interval_when_expecting}
8+
69
max_use_count = ${runners_max_use_count}
710
max_instances = ${runners_max_instances}
811

variables.tf

+8-4
Original file line numberDiff line numberDiff line change
@@ -607,12 +607,16 @@ variable "runner_worker_docker_autoscaler" {
607607
connector_config_user = User to connect to worker machine
608608
key_pair_name = The name of the key pair used by the Runner to connect to the docker-machine Runner Workers. This variable is only supported when `enables` is set to `true`.
609609
max_use_count = Max job number that can run on a worker
610+
update_interval = The interval to check with the fleeting plugin for instance updates.
611+
update_interval_when_expecting = The interval to check with the fleeting plugin for instance updates when expecting a state change.
610612
EOT
611613
type = object({
612-
fleeting_plugin_version = optional(string, "1.0.0")
613-
connector_config_user = optional(string, "ec2-user")
614-
key_pair_name = optional(string, "runner-worker-key")
615-
max_use_count = optional(number, 100)
614+
fleeting_plugin_version = optional(string, "1.0.0")
615+
connector_config_user = optional(string, "ec2-user")
616+
key_pair_name = optional(string, "runner-worker-key")
617+
max_use_count = optional(number, 100)
618+
update_interval = optional(string, "1m")
619+
update_interval_when_expecting = optional(string, "2s")
616620
})
617621
default = {}
618622
}

0 commit comments

Comments
 (0)