Skip to content

Commit

Permalink
Add WINDOWS bool to hack/e2e/run.sh for creating eksctl windows node …
Browse files Browse the repository at this point in the history
…group
  • Loading branch information
wongma7 committed Jul 8, 2021
1 parent 19802bb commit d4478a6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
15 changes: 14 additions & 1 deletion hack/e2e/eksctl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ function eksctl_create_cluster() {
KUBECONFIG=${8}
EKSCTL_PATCH_FILE=${9}
EKSCTL_ADMIN_ROLE=${10}
WINDOWS=${11}

generate_ssh_key "${SSH_KEY_PATH}"

Expand Down Expand Up @@ -57,13 +58,25 @@ function eksctl_create_cluster() {
loudecho "Getting cluster ${CLUSTER_NAME}"
${BIN} get cluster "${CLUSTER_NAME}"

if [ -n "$EKSCTL_ADMIN_ROLE" ]; then
if [[ -n "$EKSCTL_ADMIN_ROLE" ]]; then
AWS_ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text)
ADMIN_ARN="arn:aws:iam::${AWS_ACCOUNT_ID}:role/${EKSCTL_ADMIN_ROLE}"
loudecho "Granting ${ADMIN_ARN} admin access to the cluster"
${BIN} create iamidentitymapping --cluster "${CLUSTER_NAME}" --arn "${ADMIN_ARN}" --group system:masters --username admin
fi

if [[ "$WINDOWS" == true ]]; then
${BIN} create nodegroup \
--cluster="${CLUSTER_NAME}" \
--node-ami-family=WindowsServer2019FullContainer \
-n ng-windows \
-m 1 \
-M 1 \
--ssh-access \
--ssh-public-key "${SSH_KEY_PATH}".pub
${BIN} utils install-vpc-controllers --cluster="${CLUSTER_NAME}" --approve
fi

return $?
}

Expand Down
6 changes: 5 additions & 1 deletion hack/e2e/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ KOPS_PATCH_NODE_FILE=${KOPS_PATCH_NODE_FILE:-./hack/kops-patch-node.yaml}

EKSCTL_PATCH_FILE=${EKSCTL_PATCH_FILE:-./hack/eksctl-patch.yaml}
EKSCTL_ADMIN_ROLE=${EKSCTL_ADMIN_ROLE:-}
# Creates a windows node group. The windows ami doesn't (yet) install csi-proxy
# so that has to be done separately.
WINDOWS=${WINDOWS:-"false"}

HELM_VALUES_FILE=${HELM_VALUES_FILE:-./hack/values.yaml}
HELM_EXTRA_FLAGS=${HELM_EXTRA_FLAGS:-}
Expand Down Expand Up @@ -137,7 +140,8 @@ elif [[ "${CLUSTER_TYPE}" == "eksctl" ]]; then
"$CLUSTER_FILE" \
"$KUBECONFIG" \
"$EKSCTL_PATCH_FILE" \
"$EKSCTL_ADMIN_ROLE"
"$EKSCTL_ADMIN_ROLE" \
"$WINDOWS"
if [[ $? -ne 0 ]]; then
exit 1
fi
Expand Down

0 comments on commit d4478a6

Please sign in to comment.