Skip to content

Commit

Permalink
Make device name configurable for managed node groups
Browse files Browse the repository at this point in the history
Prior to this change, the device name was hard coded to `/dev/xvda`,
while Bottlerocket has two volumes: a core OS volume that should be left
as defined by the AMI; and a user-space volume `/dev/xvdb` that _should_
be configurable (but wasn't).

This change allows the specification of the device name for the sole
configurable EBS volume in the managed node group launch template.  This
therefore supports the Bottlerocket usecase (as demonstrated in the
`managed_bottlerocket_node_group` example), as well as any other AMI
with alternative volume naming.
  • Loading branch information
scalen committed Dec 2, 2021
1 parent b87b9cb commit 6da3756
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions examples/managed_bottlerocket_node_group/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ module "eks" {
[settings.kubernetes.node-labels]
ingress = "allowed"
EOT

device_name = "/dev/xvdb"
disk_type = "gp3"
}
}

Expand Down
2 changes: 1 addition & 1 deletion modules/node_groups/launch_template.tf
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ resource "aws_launch_template" "workers" {
update_default_version = lookup(each.value, "update_default_version", true)

block_device_mappings {
device_name = "/dev/xvda"
device_name = each.value["device_name"]

ebs {
volume_size = lookup(each.value, "disk_size", null)
Expand Down
1 change: 1 addition & 0 deletions modules/node_groups/locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ locals {
create_launch_template = false
bootstrap_env = {}
kubelet_extra_args = var.workers_group_defaults["kubelet_extra_args"]
device_name = coalesce(var.workers_group_defaults["root_block_device_name"], "/dev/xvda")
disk_size = var.workers_group_defaults["root_volume_size"]
disk_type = var.workers_group_defaults["root_volume_type"]
disk_iops = var.workers_group_defaults["root_iops"]
Expand Down

0 comments on commit 6da3756

Please sign in to comment.