From 07917e842812548bf1ad71170cedb4572932c81e Mon Sep 17 00:00:00 2001 From: Urian Chang Date: Thu, 14 Nov 2024 14:36:05 -0800 Subject: [PATCH] [DOM-59987] Update linux_user_data.tpl for singe-node based on AL2023 (#288) One of the changes from Amazon Linux 2 to Amazon Linux 2023 is switching to nodeadm for the initialization process. The single-node option sets some labels, so we're updating the linux_user_data.tpl to be in YAML format. --------- Co-authored-by: Paul Johnson --- examples/tfvars/single-node.tfvars | 7 +++---- modules/single-node/single-node.tf | 2 +- .../single-node/templates/linux_user_data.tpl | 21 ++++++++++--------- tests/deploy/single-node/single-node.tfvars | 9 +++++--- 4 files changed, 21 insertions(+), 18 deletions(-) diff --git a/examples/tfvars/single-node.tfvars b/examples/tfvars/single-node.tfvars index 29319668..ecc88ce0 100644 --- a/examples/tfvars/single-node.tfvars +++ b/examples/tfvars/single-node.tfvars @@ -23,9 +23,8 @@ single_node = { instance_type = "m6i.2xlarge" name = "dev-v2" ami = { - name_prefix = "dev-v2_" - owner = "977170443939" - + name_prefix = "amazon-eks-node-al2023-x86_64-standard-" + owner = "602401143452" } labels = { "dominodatalab.com/node-pool" = "default", @@ -41,5 +40,5 @@ storage = { } eks = { - k8s_version = "1.27" + k8s_version = "1.30" } diff --git a/modules/single-node/single-node.tf b/modules/single-node/single-node.tf index 4ac1cc9b..13bae7df 100644 --- a/modules/single-node/single-node.tf +++ b/modules/single-node/single-node.tf @@ -11,7 +11,7 @@ locals { "cluster" = var.eks_info.cluster.specs.name }, data.aws_default_tags.this.tags, local.node_labels) - kubelet_extra_args = "--kubelet-extra-args '--node-labels=${join(",", [for k, v in local.node_labels : format("%s=%s", k, v)])}'" + kubelet_extra_args = "--node-labels=${join(",", [for k, v in local.node_labels : format("%s=%s", k, v)])}" bootstrap_extra_args = join(" ", [local.kubelet_extra_args, var.single_node.bootstrap_extra_args]) } diff --git a/modules/single-node/templates/linux_user_data.tpl b/modules/single-node/templates/linux_user_data.tpl index 065a60d5..3b2a32ab 100644 --- a/modules/single-node/templates/linux_user_data.tpl +++ b/modules/single-node/templates/linux_user_data.tpl @@ -1,10 +1,11 @@ -#!/bin/bash -set -e -${pre_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 -${post_bootstrap_user_data ~} +--- +apiVersion: node.eks.aws/v1alpha1 +kind: NodeConfig +spec: + cluster: + name: ${cluster_name} + apiServerEndpoint: ${cluster_endpoint} + certificateAuthority: ${cluster_auth_base64} + cidr: ${cluster_service_ipv4_cidr} + kubelet: + flags: ["${bootstrap_extra_args}"] \ No newline at end of file diff --git a/tests/deploy/single-node/single-node.tfvars b/tests/deploy/single-node/single-node.tfvars index 395781ce..8a93d04c 100644 --- a/tests/deploy/single-node/single-node.tfvars +++ b/tests/deploy/single-node/single-node.tfvars @@ -2,12 +2,15 @@ single_node = { instance_type = "m6i.2xlarge" name = "dev-v2" ami = { - name_prefix = "dev-v2_" - owner = "977170443939" - + name_prefix = "amazon-eks-node-al2023-x86_64-standard-" + owner = "602401143452" } labels = { "dominodatalab.com/node-pool" = "default", "dominodatalab.com/domino-node" = "true" }, } + +eks = { + k8s_version = "1.30" +}