From 2173bbcfa926e48785c6ed6cd8dc935269f6a7c9 Mon Sep 17 00:00:00 2001 From: Bill Wang Date: Mon, 9 Jul 2018 23:59:34 +0000 Subject: [PATCH 1/7] #57 - manage root volume size and type --- README.md | 7 ++++++- variables.tf | 15 +++++++++++++++ workers.tf | 3 +++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 38fac85..e731d50 100644 --- a/README.md +++ b/README.md @@ -90,6 +90,7 @@ Many thanks to [the contributors listed here](https://github.com/terraform-aws-m MIT Licensed. See [LICENSE](https://github.com/terraform-aws-modules/terraform-aws-eks/tree/master/LICENSE) for full details. + ## Inputs | Name | Description | Type | Default | Required | @@ -102,7 +103,10 @@ MIT Licensed. See [LICENSE](https://github.com/terraform-aws-modules/terraform-a | kubeconfig_aws_authenticator_additional_args | Any additional arguments to pass to the authenticator such as the role to assume ["-r", "MyEksRole"] | string | `` | no | | kubeconfig_aws_authenticator_command | Command to use to to fetch AWS EKS credentials | string | `heptio-authenticator-aws` | no | | kubeconfig_aws_authenticator_env_variables | Environment variables that should be used when executing the authenticator i.e. { AWS_PROFILE = "eks"} | string | `` | no | -| kubeconfig_name | Override the default name used for items kubeconfig. | string | `` | no | +| kubeconfig_name | Override the default name used for items kubeconfig | string | `` | no | +| root_iops | The amount of provisioned IOPS. This must be set with a volume_type of 'io1'. | string | `` | no | +| root_volume_size | The root size of the volume in gigabytes. | string | `20` | no | +| root_volume_type | The type of root volume. Can be 'standard', 'gp2', or 'io1' | string | `gp2` | no | | subnets | A list of subnets to place the EKS cluster and workers within. | list | - | yes | | tags | A map of tags to add to all resources. | string | `` | no | | vpc_id | VPC where the cluster and workers will be deployed. | string | - | yes | @@ -126,3 +130,4 @@ MIT Licensed. See [LICENSE](https://github.com/terraform-aws-modules/terraform-a | worker_iam_role_name | IAM role name attached to EKS workers | | worker_security_group_id | Security group ID attached to the EKS workers. | | workers_asg_arns | IDs of the autoscaling groups containing workers. | + diff --git a/variables.tf b/variables.tf index 1302a48..c73ae3c 100644 --- a/variables.tf +++ b/variables.tf @@ -41,6 +41,21 @@ variable "vpc_id" { description = "VPC where the cluster and workers will be deployed." } +variable "root_volume_size" { + description = "The root size of the volume in gigabytes." + default = "20" +} + +variable "root_volume_type" { + description = "The type of root volume. Can be 'standard', 'gp2', or 'io1'" + default = "gp2" +} + +variable "root_iops" { + description = "The amount of provisioned IOPS. This must be set with a volume_type of 'io1'." + default = "" +} + variable "worker_groups" { description = "A list of maps defining worker group configurations. See workers_group_defaults for valid keys." type = "list" diff --git a/workers.tf b/workers.tf index e83412f..2d55ae2 100644 --- a/workers.tf +++ b/workers.tf @@ -37,6 +37,9 @@ resource "aws_launch_configuration" "workers" { } root_block_device { + volume_size = "${var.root_volume_size}" + volume_type = "${var.root_volume_type}" + iops = "${var.root_iops}" delete_on_termination = true } } From 1d4742255c1365912251d84858f801de339053b7 Mon Sep 17 00:00:00 2001 From: Bill Wang Date: Fri, 13 Jul 2018 14:14:06 +1000 Subject: [PATCH 2/7] Update variables.tf --- variables.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/variables.tf b/variables.tf index c73ae3c..8ba62e7 100644 --- a/variables.tf +++ b/variables.tf @@ -53,7 +53,7 @@ variable "root_volume_type" { variable "root_iops" { description = "The amount of provisioned IOPS. This must be set with a volume_type of 'io1'." - default = "" + default = "0" } variable "worker_groups" { From fb69e4c0342cd42ba477c67c49fddc4442af3af8 Mon Sep 17 00:00:00 2001 From: Bill Wang Date: Fri, 13 Jul 2018 16:13:12 +1000 Subject: [PATCH 3/7] can't update launch configuration --- workers.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workers.tf b/workers.tf index dca2fc5..f84a5f2 100644 --- a/workers.tf +++ b/workers.tf @@ -21,7 +21,7 @@ resource "aws_autoscaling_group" "workers" { } resource "aws_launch_configuration" "workers" { - name_prefix = "${aws_eks_cluster.this.name}-${lookup(var.worker_groups[count.index], "name", count.index)}" + #name_prefix = "${aws_eks_cluster.this.name}-${lookup(var.worker_groups[count.index], "name", count.index)}" associate_public_ip_address = "${lookup(var.worker_groups[count.index], "public_ip", lookup(var.workers_group_defaults, "public_ip"))}" security_groups = ["${local.worker_security_group_id}"] iam_instance_profile = "${aws_iam_instance_profile.workers.id}" From 9a6c4be21bffa4a234a264b153e63f0781c343f9 Mon Sep 17 00:00:00 2001 From: Bill Wang Date: Fri, 13 Jul 2018 16:35:25 +1000 Subject: [PATCH 4/7] rollback the change - can't update launch configuration --- workers.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workers.tf b/workers.tf index f84a5f2..dca2fc5 100644 --- a/workers.tf +++ b/workers.tf @@ -21,7 +21,7 @@ resource "aws_autoscaling_group" "workers" { } resource "aws_launch_configuration" "workers" { - #name_prefix = "${aws_eks_cluster.this.name}-${lookup(var.worker_groups[count.index], "name", count.index)}" + name_prefix = "${aws_eks_cluster.this.name}-${lookup(var.worker_groups[count.index], "name", count.index)}" associate_public_ip_address = "${lookup(var.worker_groups[count.index], "public_ip", lookup(var.workers_group_defaults, "public_ip"))}" security_groups = ["${local.worker_security_group_id}"] iam_instance_profile = "${aws_iam_instance_profile.workers.id}" From 0bc357af260c8c6aa987a7ada816fe71634a2944 Mon Sep 17 00:00:00 2001 From: Bill Wang Date: Fri, 13 Jul 2018 12:30:53 +0000 Subject: [PATCH 5/7] #57 - manage root volume size and type --- variables.tf | 3 +++ workers.tf | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/variables.tf b/variables.tf index c73ae3c..91af839 100644 --- a/variables.tf +++ b/variables.tf @@ -76,6 +76,9 @@ variable "workers_group_defaults" { asg_max_size = "3" # Maximum worker capacity in the autoscaling group. asg_min_size = "1" # Minimum worker capacity in the autoscaling group. instance_type = "m4.large" # Size of the workers instances. + root_volume_size = "20" # root volume size of workers instances. + root_volume_type = "gp2" # root volume type of workers instances, can be 'standard', 'gp2', or 'io1' + root_iops = "0" # The amount of provisioned IOPS. This must be set with a volume_type of "io1". key_name = "" # The key name that should be used for the instances in the autoscaling group pre_userdata = "" # userdata to pre-append to the default userdata. additional_userdata = "" # userdata to append to the default userdata. diff --git a/workers.tf b/workers.tf index 2d55ae2..da221b3 100644 --- a/workers.tf +++ b/workers.tf @@ -37,9 +37,9 @@ resource "aws_launch_configuration" "workers" { } root_block_device { - volume_size = "${var.root_volume_size}" - volume_type = "${var.root_volume_type}" - iops = "${var.root_iops}" + volume_size = "${lookup(var.worker_groups[count.index], "root_volume_size", lookup(var.workers_group_defaults, "root_volume_size"))}" + volume_type = "${lookup(var.worker_groups[count.index], "root_volume_type", lookup(var.workers_group_defaults, "root_volume_type"))}" + iops = "${lookup(var.worker_groups[count.index], "root_iops", lookup(var.workers_group_defaults, "root_iops"))}" delete_on_termination = true } } From 4eef91e77590643d445f94d753baf990d230545b Mon Sep 17 00:00:00 2001 From: Bill Wang Date: Fri, 13 Jul 2018 12:35:21 +0000 Subject: [PATCH 6/7] #57 - manage root volume size and type --- README.md | 3 --- variables.tf | 15 --------------- 2 files changed, 18 deletions(-) diff --git a/README.md b/README.md index d7b049c..b5859a8 100644 --- a/README.md +++ b/README.md @@ -107,9 +107,6 @@ MIT Licensed. See [LICENSE](https://github.com/terraform-aws-modules/terraform-a | map_accounts | Additional AWS account numbers to add to the aws-auth configmap. See examples/eks_test_fixture/variables.tf for example format. | list | `` | no | | map_roles | Additional IAM roles to add to the aws-auth configmap. See examples/eks_test_fixture/variables.tf for example format. | list | `` | no | | map_users | Additional IAM users to add to the aws-auth configmap. See examples/eks_test_fixture/variables.tf for example format. | list | `` | no | -| root_iops | The amount of provisioned IOPS. This must be set with a volume_type of 'io1'. | string | `0` | no | -| root_volume_size | The root size of the volume in gigabytes. | string | `20` | no | -| root_volume_type | The type of root volume. Can be 'standard', 'gp2', or 'io1' | string | `gp2` | no | | subnets | A list of subnets to place the EKS cluster and workers within. | list | - | yes | | tags | A map of tags to add to all resources. | map | `` | no | | vpc_id | VPC where the cluster and workers will be deployed. | string | - | yes | diff --git a/variables.tf b/variables.tf index a08b21c..2de0ea9 100644 --- a/variables.tf +++ b/variables.tf @@ -65,21 +65,6 @@ variable "vpc_id" { description = "VPC where the cluster and workers will be deployed." } -variable "root_volume_size" { - description = "The root size of the volume in gigabytes." - default = "20" -} - -variable "root_volume_type" { - description = "The type of root volume. Can be 'standard', 'gp2', or 'io1'" - default = "gp2" -} - -variable "root_iops" { - description = "The amount of provisioned IOPS. This must be set with a volume_type of 'io1'." - default = "0" -} - variable "worker_groups" { description = "A list of maps defining worker group configurations. See workers_group_defaults for valid keys." type = "list" From 5628a244a88e03b854ee7b90c2504e7af5f67e27 Mon Sep 17 00:00:00 2001 From: Bill Wang Date: Fri, 13 Jul 2018 12:57:33 +0000 Subject: [PATCH 7/7] #57 - manage root volume size and type --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e21051..34dfc58 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ project adheres to [Semantic Versioning](http://semver.org/). ### Added -- A tiny but mighty feature. (you're on fire, @me 🔥) +- manage eks workers' root volume size and type ### Changed