Skip to content

Commit

Permalink
Dynamically selected AMI based on GPU selection
Browse files Browse the repository at this point in the history
  • Loading branch information
kwasd committed May 22, 2024
1 parent bd17b83 commit c01e2bb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
20 changes: 14 additions & 6 deletions scripts/deploy/aws.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,18 @@ cluster_version = "$X1_CLUSTER_VERSION"
EOF
}

function eks_terraform_args()
{
terraform_extra_args=(
-var gpu_type="${GPU_TYPE}"
-var instance_type="${ICL_AWS_INSTANCE_TYPE}"
)
if [[ -v X1_TERRAFORM_DISABLE_LOCKING ]]; then
terraform_extra_args+=( -lock=false )
fi
echo "${terraform_extra_args[*]}"
}

function x1_terraform_args() {
terraform_extra_args=(
-var prometheus_enabled=false
Expand All @@ -89,11 +101,7 @@ function x1_terraform_args() {


function deploy_eks() {
terraform_extra_args=(
-var gpu_type="${GPU_TYPE}"
-var instance_type="${ICL_AWS_INSTANCE_TYPE}"
)
control_node "terraform -chdir=$WORKSPACE/terraform/aws/ apply -input=false -auto-approve ${terraform_extra_args[*]}"
control_node "terraform -chdir=$WORKSPACE/terraform/aws/ apply -input=false -auto-approve $(eks_terraform_args)"
}

function update_config() {
Expand All @@ -102,7 +110,7 @@ function update_config() {

# Delete cluster
function delete_eks() {
control_node "terraform -chdir=$WORKSPACE/terraform/aws/ destroy -input=false -auto-approve"
control_node "terraform -chdir=$WORKSPACE/terraform/aws/ destroy -input=false -auto-approve $(eks_terraform_args)"
}

# Delete workloads, cluster and workspace
Expand Down
2 changes: 1 addition & 1 deletion terraform/aws/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ data "aws_ami" "current_aws_ami" {
name = "name"
values = [ "${var.gpu_type == "nvidia" ?
"*ubuntu-eks/k8s_${var.cluster_version}/images/hvm-ssd/ubuntu-focal-20.04-amd64-*" :
"*amazon/amazon-eks-node-${var.cluster_version}-*"}"]
"amazon-eks-node-${var.cluster_version}-*"}"]
}
}

Expand Down

0 comments on commit c01e2bb

Please sign in to comment.