Skip to content

Instantly share code, notes, and snippets.

@mumoshu
Last active April 1, 2022 04:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mumoshu/c82167a10c2a38b08f4e43aaad06aa21 to your computer and use it in GitHub Desktop.
Save mumoshu/c82167a10c2a38b08f4e43aaad06aa21 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
set -e
if eksctl get cluster -f $FILE >/dev/null 2>&1; then
# See https://github.com/weaveworks/eksctl/blob/33ec1ed967c1ad03c985bf18774ea970d85c86f1/site/content/usage/03-cluster-upgrade.md#L41
eksctl update cluster -f $FILE
eksctl utils update-kube-proxy
eksctl utils update-aws-node
eksctl utils update-coredns
# See https://github.com/weaveworks/eksctl/blob/33ec1ed967c1ad03c985bf18774ea970d85c86f1/site/content/usage/03-cluster-upgrade.md#updating-nodegroups
eksctl create nodegroup -f $FILE
for nodegroup in $(pending_nodegroups); do
eksctl utils wait-nodes --nodes-min $NUM_NODES
done
# TODO: Detect nodegroups to be deleted
for nodegroup in $(unneeded_nodegroups); do
# TODO: Drain unneeded nodegroups
eksctl drain nodegroup -f $FILE --name $nodegroup
# Delete unneeded nodegroups
eksctl delete nodegroup -f $FILE --name $nodegroup
done
else
eksctl create cluster -f $FILE
for nodegroup in $(pending_nodegroups); do
# TODO: Wait until the new nodegroup becomes ready
eksctl utils wait-nodes --nodes-min $NUM_NODES
done
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment