Skip to content

Commit

Permalink
Merge pull request #9 from So1S/SO1S-393-infra-gpu-노드-terraform-프로비저닝
Browse files Browse the repository at this point in the history
SO1S-393 GPU 노드 Terraform 프로비저닝
  • Loading branch information
NEM-NE authored Oct 1, 2022
2 parents ba00abe + da21182 commit 385a17c
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 16 deletions.
16 changes: 15 additions & 1 deletion live/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,20 @@ elif [ $SO1S_ENV_NUMBER -eq 1 ]; then
SO1S_ENV_PATH="./prod"
fi

SO1S_REGEX="^[1-2]$"
while [[ ! $SO1S_USE_GPU =~ $SO1S_REGEX ]]
do
echo -e "GPU를 사용할 것인지 번호를 입력해주세요. \n-> (1) 미사용 (2) 사용 "
read SO1S_USE_GPU
done

# 환경에 따른 글로벌 이름 설정 -> Prod은 고정 값
if [ $SO1S_USE_GPU -eq 2 ]; then
INFERENCE_INSTANCE='["g4dn.xlarge"]'
elif [ $SO1S_USE_GPU -eq 1 ]; then
INFERENCE_INSTANCE='["t3a.large"]'
fi

cd $SO1S_ENV_PATH

# Check Terraform Version
Expand All @@ -51,7 +65,7 @@ fi
echo -e "\n"
echo "Start Resource Provisioning"
echo "-> terraform apply -var=global_name=$SO1S_GLOBAL_NAME"
terraform apply -var="global_name=$SO1S_GLOBAL_NAME"
terraform apply -var="global_name=$SO1S_GLOBAL_NAME" -var="inference_node_instance_types=$INFERENCE_INSTANCE"

# Using for ALB, External DNS Chart
RESULT=`terraform output`
Expand Down
2 changes: 1 addition & 1 deletion live/dev/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ module "eks" {

disk_size = 30
}
inference_node_instance_types = ["t3a.medium"]
inference_node_instance_types = var.inference_node_instance_types

api_node_spot = true
api_node_size_spec = {
Expand Down
6 changes: 6 additions & 0 deletions live/dev/variables.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
variable "global_name" {
description = "This name will use as prefix for AWS resource so, Please write unique and distinct word e.g. sungbin, backend-test..."
type = string
}

variable "inference_node_instance_types" {
description = "This type will use inference node that use eks"
type = list(string)
default = ["t3a.large"]
}
2 changes: 1 addition & 1 deletion live/prod/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ module "eks" {

disk_size = 30
}
inference_node_instance_types = ["t3a.large"]
inference_node_instance_types = var.inference_node_instance_types

api_node_spot = false
api_node_size_spec = {
Expand Down
13 changes: 1 addition & 12 deletions live/prod/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,9 @@ variable "global_name" {
type = string
default = "prod"
}
variable "public_instance_types" {
description = "This type will use public node that use eks"
type = list(string)
default = ["t3a.medium"]
}

variable "inference_instance_types" {
variable "inference_node_instance_types" {
description = "This type will use inference node that use eks"
type = list(string)
default = ["t3a.large"]
}

variable "api_instance_types" {
description = "This type will use api node that use eks"
type = list(string)
default = ["t3a.large"]
}
2 changes: 1 addition & 1 deletion modules/cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ variable "inference_node_spot" {
variable "inference_node_instance_types" {
description = "This type will use inference node that use eks"
type = list(string)
default = ["t3a.medium"]
default = ["t3a.large"]
}

variable "api_node_size_spec" {
Expand Down

0 comments on commit 385a17c

Please sign in to comment.