diff --git a/CHANGES.md b/CHANGES.md index 22433214..d89e141a 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -10,6 +10,13 @@ Notable changes between versions. * Update Cilium from v1.15.6 to [v1.15.7](https://github.com/cilium/cilium/releases/tag/v1.15.7) * Update flannel from v0.25.4 to [v0.25.5](https://github.com/flannel-io/flannel/releases/tag/v0.25.5) +### AWS + +* Add `controller_disk_type`, `controller_disk_size`, and `controller_disk_iops` variables +* Add `worker_disk_type`, `worker_disk_size`, and `worker_disk_iops` variables and fix propagation to worker nodes +* Remove `disk_type`, `disk_size`, and `disk_iops` variables +* Add `controller_cpu_credits` and `worker_cpu_credits` variables to set CPU pricing mode for burstable instance types + ### Azure * Configure the virtual network and subnets with IPv6 private address space diff --git a/aws/fedora-coreos/kubernetes/controllers.tf b/aws/fedora-coreos/kubernetes/controllers.tf index ad4d8c84..8269a661 100644 --- a/aws/fedora-coreos/kubernetes/controllers.tf +++ b/aws/fedora-coreos/kubernetes/controllers.tf @@ -27,9 +27,9 @@ resource "aws_instance" "controllers" { # storage root_block_device { - volume_type = var.disk_type - volume_size = var.disk_size - iops = var.disk_iops + volume_type = var.controller_disk_type + volume_size = var.controller_disk_size + iops = var.controller_disk_iops encrypted = true tags = {} } @@ -39,6 +39,10 @@ resource "aws_instance" "controllers" { subnet_id = element(aws_subnet.public.*.id, count.index) vpc_security_group_ids = [aws_security_group.controller.id] + credit_specification { + cpu_credits = var.controller_cpu_credits + } + lifecycle { ignore_changes = [ ami, diff --git a/aws/fedora-coreos/kubernetes/variables.tf b/aws/fedora-coreos/kubernetes/variables.tf index 09524e62..013fe916 100644 --- a/aws/fedora-coreos/kubernetes/variables.tf +++ b/aws/fedora-coreos/kubernetes/variables.tf @@ -17,30 +17,6 @@ variable "dns_zone_id" { # instances -variable "controller_count" { - type = number - description = "Number of controllers (i.e. masters)" - default = 1 -} - -variable "worker_count" { - type = number - description = "Number of workers" - default = 1 -} - -variable "controller_type" { - type = string - description = "EC2 instance type for controllers" - default = "t3.small" -} - -variable "worker_type" { - type = string - description = "EC2 instance type for workers" - default = "t3.small" -} - variable "os_stream" { type = string description = "Fedora CoreOS image stream for instances (e.g. stable, testing, next)" @@ -52,24 +28,78 @@ variable "os_stream" { } } -variable "disk_size" { +variable "controller_count" { + type = number + description = "Number of controllers (i.e. masters)" + default = 1 +} + +variable "controller_type" { + type = string + description = "EC2 instance type for controllers" + default = "t3.small" +} + +variable "controller_disk_size" { type = number description = "Size of the EBS volume in GB" default = 30 } -variable "disk_type" { +variable "controller_disk_type" { type = string description = "Type of the EBS volume (e.g. standard, gp2, gp3, io1)" default = "gp3" } -variable "disk_iops" { +variable "controller_disk_iops" { type = number description = "IOPS of the EBS volume (e.g. 3000)" default = 3000 } +variable "controller_cpu_credits" { + type = string + description = "CPU credits mode (if using a burstable instance type)" + default = null +} + +variable "worker_count" { + type = number + description = "Number of workers" + default = 1 +} + +variable "worker_type" { + type = string + description = "EC2 instance type for workers" + default = "t3.small" +} + +variable "worker_disk_size" { + type = number + description = "Size of the EBS volume in GB" + default = 30 +} + +variable "worker_disk_type" { + type = string + description = "Type of the EBS volume (e.g. standard, gp2, gp3, io1)" + default = "gp3" +} + +variable "worker_disk_iops" { + type = number + description = "IOPS of the EBS volume (e.g. 3000)" + default = 3000 +} + +variable "worker_cpu_credits" { + type = string + description = "CPU credits mode (if using a burstable instance type)" + default = null +} + variable "worker_price" { type = number description = "Spot price in USD for worker instances or 0 to use on-demand instances" diff --git a/aws/fedora-coreos/kubernetes/workers.tf b/aws/fedora-coreos/kubernetes/workers.tf index 0ec9cdb6..fb06c335 100644 --- a/aws/fedora-coreos/kubernetes/workers.tf +++ b/aws/fedora-coreos/kubernetes/workers.tf @@ -10,7 +10,10 @@ module "workers" { instance_type = var.worker_type os_stream = var.os_stream arch = var.arch - disk_size = var.disk_size + disk_type = var.worker_disk_type + disk_size = var.worker_disk_size + disk_iops = var.worker_disk_iops + cpu_credits = var.worker_cpu_credits spot_price = var.worker_price target_groups = var.worker_target_groups diff --git a/aws/fedora-coreos/kubernetes/workers/variables.tf b/aws/fedora-coreos/kubernetes/workers/variables.tf index 4bb8b714..3f859e70 100644 --- a/aws/fedora-coreos/kubernetes/workers/variables.tf +++ b/aws/fedora-coreos/kubernetes/workers/variables.tf @@ -69,6 +69,12 @@ variable "spot_price" { default = 0 } +variable "cpu_credits" { + type = string + description = "CPU burst credits mode (if applicable)" + default = null +} + variable "target_groups" { type = list(string) description = "Additional target group ARNs to which instances should be added" diff --git a/aws/fedora-coreos/kubernetes/workers/workers.tf b/aws/fedora-coreos/kubernetes/workers/workers.tf index 9f0b0be0..d3038305 100644 --- a/aws/fedora-coreos/kubernetes/workers/workers.tf +++ b/aws/fedora-coreos/kubernetes/workers/workers.tf @@ -94,6 +94,10 @@ resource "aws_launch_template" "worker" { } } + credit_specification { + cpu_credits = var.cpu_credits + } + lifecycle { // Override the default destroy and replace update behavior create_before_destroy = true diff --git a/aws/flatcar-linux/kubernetes/controllers.tf b/aws/flatcar-linux/kubernetes/controllers.tf index 82d92ce8..b48aa770 100644 --- a/aws/flatcar-linux/kubernetes/controllers.tf +++ b/aws/flatcar-linux/kubernetes/controllers.tf @@ -28,9 +28,9 @@ resource "aws_instance" "controllers" { # storage root_block_device { - volume_type = var.disk_type - volume_size = var.disk_size - iops = var.disk_iops + volume_type = var.controller_disk_type + volume_size = var.controller_disk_size + iops = var.controller_disk_iops encrypted = true tags = {} } @@ -40,6 +40,10 @@ resource "aws_instance" "controllers" { subnet_id = element(aws_subnet.public.*.id, count.index) vpc_security_group_ids = [aws_security_group.controller.id] + credit_specification { + cpu_credits = var.controller_cpu_credits + } + lifecycle { ignore_changes = [ ami, diff --git a/aws/flatcar-linux/kubernetes/variables.tf b/aws/flatcar-linux/kubernetes/variables.tf index cc86d5ec..2331db4d 100644 --- a/aws/flatcar-linux/kubernetes/variables.tf +++ b/aws/flatcar-linux/kubernetes/variables.tf @@ -17,30 +17,6 @@ variable "dns_zone_id" { # instances -variable "controller_count" { - type = number - description = "Number of controllers (i.e. masters)" - default = 1 -} - -variable "worker_count" { - type = number - description = "Number of workers" - default = 1 -} - -variable "controller_type" { - type = string - description = "EC2 instance type for controllers" - default = "t3.small" -} - -variable "worker_type" { - type = string - description = "EC2 instance type for workers" - default = "t3.small" -} - variable "os_image" { type = string description = "AMI channel for a Container Linux derivative (flatcar-stable, flatcar-beta, flatcar-alpha)" @@ -52,24 +28,78 @@ variable "os_image" { } } -variable "disk_size" { +variable "controller_count" { + type = number + description = "Number of controllers (i.e. masters)" + default = 1 +} + +variable "controller_type" { + type = string + description = "EC2 instance type for controllers" + default = "t3.small" +} + +variable "controller_disk_size" { type = number description = "Size of the EBS volume in GB" default = 30 } -variable "disk_type" { +variable "controller_disk_type" { type = string description = "Type of the EBS volume (e.g. standard, gp2, gp3, io1)" default = "gp3" } -variable "disk_iops" { +variable "controller_disk_iops" { type = number description = "IOPS of the EBS volume (e.g. 3000)" default = 3000 } +variable "controller_cpu_credits" { + type = string + description = "CPU credits mode (if using a burstable instance type)" + default = null +} + +variable "worker_count" { + type = number + description = "Number of workers" + default = 1 +} + +variable "worker_type" { + type = string + description = "EC2 instance type for workers" + default = "t3.small" +} + +variable "worker_disk_size" { + type = number + description = "Size of the EBS volume in GB" + default = 30 +} + +variable "worker_disk_type" { + type = string + description = "Type of the EBS volume (e.g. standard, gp2, gp3, io1)" + default = "gp3" +} + +variable "worker_disk_iops" { + type = number + description = "IOPS of the EBS volume (e.g. 3000)" + default = 3000 +} + +variable "worker_cpu_credits" { + type = string + description = "CPU credits mode (if using a burstable instance type)" + default = null +} + variable "worker_price" { type = number description = "Spot price in USD for worker instances or 0 to use on-demand instances" diff --git a/aws/flatcar-linux/kubernetes/workers.tf b/aws/flatcar-linux/kubernetes/workers.tf index 64a46cab..7397c99a 100644 --- a/aws/flatcar-linux/kubernetes/workers.tf +++ b/aws/flatcar-linux/kubernetes/workers.tf @@ -10,7 +10,9 @@ module "workers" { instance_type = var.worker_type os_image = var.os_image arch = var.arch - disk_size = var.disk_size + disk_type = var.worker_disk_type + disk_size = var.worker_disk_size + disk_iops = var.worker_disk_iops spot_price = var.worker_price target_groups = var.worker_target_groups diff --git a/aws/flatcar-linux/kubernetes/workers/variables.tf b/aws/flatcar-linux/kubernetes/workers/variables.tf index 26bd2c1d..60f3b689 100644 --- a/aws/flatcar-linux/kubernetes/workers/variables.tf +++ b/aws/flatcar-linux/kubernetes/workers/variables.tf @@ -69,6 +69,12 @@ variable "spot_price" { default = 0 } +variable "cpu_credits" { + type = string + description = "CPU burst credits mode (if applicable)" + default = null +} + variable "target_groups" { type = list(string) description = "Additional target group ARNs to which instances should be added" diff --git a/aws/flatcar-linux/kubernetes/workers/workers.tf b/aws/flatcar-linux/kubernetes/workers/workers.tf index cf7ab00f..3aef08ed 100644 --- a/aws/flatcar-linux/kubernetes/workers/workers.tf +++ b/aws/flatcar-linux/kubernetes/workers/workers.tf @@ -94,6 +94,10 @@ resource "aws_launch_template" "worker" { } } + credit_specification { + cpu_credits = var.cpu_credits + } + lifecycle { // Override the default destroy and replace update behavior create_before_destroy = true