From 72b07c6f99e2bacb6df1ea572a12778e58b61b39 Mon Sep 17 00:00:00 2001 From: waruwat-dev <42961261+waruwat-dev@users.noreply.github.com> Date: Wed, 12 Apr 2023 13:05:18 +0700 Subject: [PATCH 1/5] (feat) update launch template userdata --- modules/nodegroup/templates/linux_user_data.tpl | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/modules/nodegroup/templates/linux_user_data.tpl b/modules/nodegroup/templates/linux_user_data.tpl index 4739662..e91b7a4 100644 --- a/modules/nodegroup/templates/linux_user_data.tpl +++ b/modules/nodegroup/templates/linux_user_data.tpl @@ -1,15 +1,11 @@ -%{ if enable_bootstrap_user_data ~} #!/bin/bash set -ex -%{ endif ~} ${pre_bootstrap_user_data ~} -%{ if length(cluster_service_ipv4_cidr) > 0 ~} -export SERVICE_IPV4_CIDR=${cluster_service_ipv4_cidr} -%{ endif ~} -%{ if enable_bootstrap_user_data ~} +%{ if enable_bootstrap_user_data ~} B64_CLUSTER_CA=${cluster_auth_base64} API_SERVER_URL=${cluster_endpoint} /etc/eks/bootstrap.sh ${cluster_name} ${bootstrap_extra_args} --b64-cluster-ca $B64_CLUSTER_CA --apiserver-endpoint $API_SERVER_URL -${post_bootstrap_user_data ~} %{ endif ~} + +${post_bootstrap_user_data ~} From 4d7e709fd7aade2d9e89e1d07a58975b959c7f87 Mon Sep 17 00:00:00 2001 From: waruwat-dev <42961261+waruwat-dev@users.noreply.github.com> Date: Wed, 12 Apr 2023 13:11:29 +0700 Subject: [PATCH 2/5] (feat) remove service cidr --- modules/nodegroup/locals.tf | 1 - modules/nodegroup/variables.tf | 6 ------ 2 files changed, 7 deletions(-) diff --git a/modules/nodegroup/locals.tf b/modules/nodegroup/locals.tf index bb865ac..4b6f078 100644 --- a/modules/nodegroup/locals.tf +++ b/modules/nodegroup/locals.tf @@ -11,7 +11,6 @@ locals { cluster_endpoint = var.cluster_endpoint cluster_auth_base64 = var.cluster_auth_base64 # Optional - cluster_service_ipv4_cidr = var.cluster_service_ipv4_cidr != null ? var.cluster_service_ipv4_cidr : "" bootstrap_extra_args = var.bootstrap_extra_args pre_bootstrap_user_data = var.pre_bootstrap_user_data post_bootstrap_user_data = var.post_bootstrap_user_data diff --git a/modules/nodegroup/variables.tf b/modules/nodegroup/variables.tf index c9f4253..6eb09cf 100644 --- a/modules/nodegroup/variables.tf +++ b/modules/nodegroup/variables.tf @@ -125,12 +125,6 @@ variable "cluster_auth_base64" { default = "" } -variable "cluster_service_ipv4_cidr" { - description = "The CIDR block to assign Kubernetes service IP addresses from. If you don't specify a block, Kubernetes assigns addresses from either the 10.100.0.0/16 or 172.20.0.0/16 CIDR blocks" - type = string - default = null -} - variable "pre_bootstrap_user_data" { description = "User data that is injected into the user data script ahead of the EKS bootstrap script. Not used when `platform` = `bottlerocket`" type = string From 01694a711e2b4f513109208bdeabbb34016fb85f Mon Sep 17 00:00:00 2001 From: waruwat-dev <42961261+waruwat-dev@users.noreply.github.com> Date: Wed, 12 Apr 2023 13:13:47 +0700 Subject: [PATCH 3/5] Revert "(feat) remove service cidr" This reverts commit 4d7e709fd7aade2d9e89e1d07a58975b959c7f87. --- modules/nodegroup/locals.tf | 1 + modules/nodegroup/variables.tf | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/modules/nodegroup/locals.tf b/modules/nodegroup/locals.tf index 4b6f078..bb865ac 100644 --- a/modules/nodegroup/locals.tf +++ b/modules/nodegroup/locals.tf @@ -11,6 +11,7 @@ locals { cluster_endpoint = var.cluster_endpoint cluster_auth_base64 = var.cluster_auth_base64 # Optional + cluster_service_ipv4_cidr = var.cluster_service_ipv4_cidr != null ? var.cluster_service_ipv4_cidr : "" bootstrap_extra_args = var.bootstrap_extra_args pre_bootstrap_user_data = var.pre_bootstrap_user_data post_bootstrap_user_data = var.post_bootstrap_user_data diff --git a/modules/nodegroup/variables.tf b/modules/nodegroup/variables.tf index 6eb09cf..c9f4253 100644 --- a/modules/nodegroup/variables.tf +++ b/modules/nodegroup/variables.tf @@ -125,6 +125,12 @@ variable "cluster_auth_base64" { default = "" } +variable "cluster_service_ipv4_cidr" { + description = "The CIDR block to assign Kubernetes service IP addresses from. If you don't specify a block, Kubernetes assigns addresses from either the 10.100.0.0/16 or 172.20.0.0/16 CIDR blocks" + type = string + default = null +} + variable "pre_bootstrap_user_data" { description = "User data that is injected into the user data script ahead of the EKS bootstrap script. Not used when `platform` = `bottlerocket`" type = string From b1931a4be7ef4b91ea1f5b2c007bf6e0c7790bdd Mon Sep 17 00:00:00 2001 From: waruwat-dev <42961261+waruwat-dev@users.noreply.github.com> Date: Wed, 12 Apr 2023 13:14:55 +0700 Subject: [PATCH 4/5] Update linux_user_data.tpl --- modules/nodegroup/templates/linux_user_data.tpl | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/modules/nodegroup/templates/linux_user_data.tpl b/modules/nodegroup/templates/linux_user_data.tpl index e91b7a4..fd0de9d 100644 --- a/modules/nodegroup/templates/linux_user_data.tpl +++ b/modules/nodegroup/templates/linux_user_data.tpl @@ -3,9 +3,16 @@ set -ex ${pre_bootstrap_user_data ~} %{ if enable_bootstrap_user_data ~} + +%{ if length(cluster_service_ipv4_cidr) > 0 ~} +export SERVICE_IPV4_CIDR=${cluster_service_ipv4_cidr} +%{ endif ~} + B64_CLUSTER_CA=${cluster_auth_base64} API_SERVER_URL=${cluster_endpoint} /etc/eks/bootstrap.sh ${cluster_name} ${bootstrap_extra_args} --b64-cluster-ca $B64_CLUSTER_CA --apiserver-endpoint $API_SERVER_URL -%{ endif ~} ${post_bootstrap_user_data ~} +%{ endif ~} + + From 041ef7ed7ea7cf2e1f8b701b99970233ed0f2e75 Mon Sep 17 00:00:00 2001 From: waruwat-dev <42961261+waruwat-dev@users.noreply.github.com> Date: Wed, 12 Apr 2023 13:16:33 +0700 Subject: [PATCH 5/5] Update linux_user_data.tpl --- modules/nodegroup/templates/linux_user_data.tpl | 2 -- 1 file changed, 2 deletions(-) diff --git a/modules/nodegroup/templates/linux_user_data.tpl b/modules/nodegroup/templates/linux_user_data.tpl index fd0de9d..b2dbaf4 100644 --- a/modules/nodegroup/templates/linux_user_data.tpl +++ b/modules/nodegroup/templates/linux_user_data.tpl @@ -14,5 +14,3 @@ API_SERVER_URL=${cluster_endpoint} ${post_bootstrap_user_data ~} %{ endif ~} - -