From 88e538cb1163fea72d12d90e37cc0be39af012f8 Mon Sep 17 00:00:00 2001 From: Aditya Venneti <5522539+adityavenneti@users.noreply.github.com> Date: Tue, 9 Sep 2025 04:42:03 +0000 Subject: [PATCH 1/2] Support for worker node AMI version fallback --- .../tasks/setup/eks/awscli-cfn-lt-al2023.yaml | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/tests/tekton-resources/tasks/setup/eks/awscli-cfn-lt-al2023.yaml b/tests/tekton-resources/tasks/setup/eks/awscli-cfn-lt-al2023.yaml index 2a579474..6b5f7e3e 100644 --- a/tests/tekton-resources/tasks/setup/eks/awscli-cfn-lt-al2023.yaml +++ b/tests/tekton-resources/tasks/setup/eks/awscli-cfn-lt-al2023.yaml @@ -92,9 +92,25 @@ spec: if [[ -n "$(params.ami)" ]]; then AMI_VALUE="$(params.ami)" else - AMI_VALUE="resolve:ssm:/aws/service/eks/optimized-ami/$KVERSION/amazon-linux-2023/x86_64/standard/recommended/image_id" - fi + SSM_PARAMETER_NAME="/aws/service/eks/optimized-ami/KUBERNETES_VERSION/amazon-linux-2023/x86_64/standard/recommended/image_id" + K8S_VERSIONED_PARAMETER_NAME=${SSM_PARAMETER_NAME/KUBERNETES_VERSION/$KVERSION} + set +e + aws ssm get-parameter --name 2> /dev/null + ssm_exit_code=$? + set -e + if [ $ssm_exit_code -ne 0 ]; then + echo "Optimized worker node AMI doesn't exist for K8S version $KVERSION" + MAJOR=$(echo "$KVERSION" | cut -d'.' -f1) + MINOR=$(echo "$KVERSION" | cut -d'.' -f2) + NEW_MINOR=$((MINOR - 1)) + FALLBACK_KVERSION="$MAJOR.$NEW_MINOR" + K8S_VERSIONED_PARAMETER_NAME=${SSM_PARAMETER_NAME/KUBERNETES_VERSION/$FALLBACK_KVERSION} + fi + + AMI_VALUE="resolve:ssm:$K8S_VERSIONED_PARAMETER_NAME" + fi + # assemble the stack parameters as a JSON file # the AWS CLI can't handle a JSON string as a ParameterValue in the flag representation # and we need that for kubelet-config From 16915ba433789bd50f760bbc5c81340d9117beb2 Mon Sep 17 00:00:00 2001 From: Aditya Venneti <5522539+adityavenneti@users.noreply.github.com> Date: Sun, 14 Sep 2025 10:50:09 +0000 Subject: [PATCH 2/2] error check for node group creation --- tests/tekton-resources/tasks/setup/eks/awscli-mng.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/tekton-resources/tasks/setup/eks/awscli-mng.yaml b/tests/tekton-resources/tasks/setup/eks/awscli-mng.yaml index be38065d..88a81229 100644 --- a/tests/tekton-resources/tasks/setup/eks/awscli-mng.yaml +++ b/tests/tekton-resources/tasks/setup/eks/awscli-mng.yaml @@ -93,6 +93,13 @@ spec: echo "$node_group_name is "CREATING" at $(date)" sleep 2 done + + node_group_status="$(aws eks $ENDPOINT_FLAG --region $(params.region) describe-nodegroup --cluster-name $(params.cluster-name) --nodegroup-name $node_group_name --query nodegroup.status --output text)" + if [[ $node_group_status != "ACTIVE" ]]; then + echo "$node_group_name creation failed. The status is $node_group_status" + exit 1 + fi + while true; do ready_node=$(kubectl get nodes -l eks.amazonaws.com/nodegroup=$node_group_name --no-headers 2>/dev/null | grep -w Ready | wc -l) echo "ready-nodes=$ready_node out of $2, for nodegroup: $node_group_name"