File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed
tests/tekton-resources/tasks/setup/eks Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change 9292 if [[ -n "$(params.ami)" ]]; then
9393 AMI_VALUE="$(params.ami)"
9494 else
95- AMI_VALUE="resolve:ssm: /aws/service/eks/optimized-ami/$KVERSION /amazon-linux-2023/x86_64/standard/recommended/image_id"
96- fi
95+ SSM_PARAMETER_NAME=" /aws/service/eks/optimized-ami/KUBERNETES_VERSION /amazon-linux-2023/x86_64/standard/recommended/image_id"
96+ K8S_VERSIONED_PARAMETER_NAME=${SSM_PARAMETER_NAME/KUBERNETES_VERSION/$KVERSION}
9797
98+ set +e
99+ aws ssm get-parameter --name 2> /dev/null
100+ ssm_exit_code=$?
101+ set -e
102+ if [ $ssm_exit_code -ne 0 ]; then
103+ echo "Optimized worker node AMI doesn't exist for K8S version $KVERSION"
104+ MAJOR=$(echo "$KVERSION" | cut -d'.' -f1)
105+ MINOR=$(echo "$KVERSION" | cut -d'.' -f2)
106+ NEW_MINOR=$((MINOR - 1))
107+ FALLBACK_KVERSION="$MAJOR.$NEW_MINOR"
108+ K8S_VERSIONED_PARAMETER_NAME=${SSM_PARAMETER_NAME/KUBERNETES_VERSION/$FALLBACK_KVERSION}
109+ fi
110+
111+ AMI_VALUE="resolve:ssm:$K8S_VERSIONED_PARAMETER_NAME"
112+ fi
113+
98114 # assemble the stack parameters as a JSON file
99115 # the AWS CLI can't handle a JSON string as a ParameterValue in the flag representation
100116 # and we need that for kubelet-config
You can’t perform that action at this time.
0 commit comments