Skip to content

Commit a1f8266

Browse files
charlesbjohnsonkayman-mk
andauthoredJul 22, 2024··
feat: add support for configuring runner worker root device name (#1140)
## Description These changes add support for configuring the root device name for the Docker Machine instances. This is necessary when using an Amazon Linux AMI where the default device name of `/dev/sda1` ends up creating a 2nd, unused, non-root volume. https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/device_naming.html#available-ec2-device-names Closes #1154 ## Verification Confirmed root device on Docker Machine instances is correctly configured in both fleet-mode and non-fleet mode when using an AL2 AMI. Checked this in AWS Console. Co-authored-by: Matthias Kay <[email protected]>
1 parent beea51d commit a1f8266

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed
 

Diff for: ‎main.tf

+2-1
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ locals {
118118
runners_idle_count = var.runner_worker_docker_machine_instance.idle_count
119119
runners_idle_time = var.runner_worker_docker_machine_instance.idle_time
120120
runners_max_builds = local.runners_max_builds_string
121+
runners_root_device_name = var.runner_worker_docker_machine_instance.root_device_name
121122
runners_root_size = var.runner_worker_docker_machine_instance.root_size
122123
runners_volume_type = var.runner_worker_docker_machine_instance.volume_type
123124
runners_iam_instance_profile_name = var.runner_worker_docker_machine_role.profile_name
@@ -331,7 +332,7 @@ resource "aws_launch_template" "fleet_gitlab_runner" {
331332
enabled = var.runner_worker_docker_machine_instance.monitoring
332333
}
333334
block_device_mappings {
334-
device_name = "/dev/sda1"
335+
device_name = var.runner_worker_docker_machine_instance.root_device_name
335336

336337
ebs {
337338
volume_size = var.runner_worker_docker_machine_instance.root_size

Diff for: ‎template/runner-config.tftpl

+1
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ listen_address = "${prometheus_listen_address}"
6464
"amazonec2-use-ebs-optimized-instance=${runners_ebs_optimized}",
6565
"amazonec2-monitoring=${runners_monitoring}",
6666
"amazonec2-iam-instance-profile=%{ if runners_iam_instance_profile_name != "" }${runners_iam_instance_profile_name}%{ else }${runners_instance_profile}%{ endif ~}",
67+
"amazonec2-device-name=${runners_root_device_name}",
6768
"amazonec2-root-size=${runners_root_size}",
6869
"amazonec2-volume-type=${runners_volume_type}",
6970
"amazonec2-userdata=%{~ if runners_userdata != "" ~}/etc/gitlab-runner/runners_userdata.sh%{~ endif ~}",

Diff for: ‎variables.tf

+2
Original file line numberDiff line numberDiff line change
@@ -675,6 +675,7 @@ variable "runner_worker_docker_machine_instance" {
675675
monitoring = Enable detailed monitoring for the Runner Worker.
676676
name_prefix = Set the name prefix and override the `Name` tag for the Runner Worker.
677677
private_address_only = Restrict Runner Worker to the use of a private IP address. If `runner_instance.use_private_address_only` is set to `true` (default), `runner_worker_docker_machine_instance.private_address_only` will also apply for the Runner.
678+
root_device_name = The name of the root volume for the Runner Worker.
678679
root_size = The size of the root volume for the Runner Worker.
679680
start_script = Cloud-init user data that will be passed to the Runner Worker. Should not be base64 encrypted.
680681
subnet_ids = The list of subnet IDs to use for the Runner Worker when the fleet mode is enabled.
@@ -693,6 +694,7 @@ variable "runner_worker_docker_machine_instance" {
693694
monitoring = optional(bool, false)
694695
name_prefix = optional(string, "")
695696
private_address_only = optional(bool, true)
697+
root_device_name = optional(string, "/dev/sda1")
696698
root_size = optional(number, 8)
697699
start_script = optional(string, "")
698700
subnet_ids = optional(list(string), [])

0 commit comments

Comments
 (0)
Please sign in to comment.