Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SO1S-393 GPU 노드 Terraform 프로비저닝 #9

Merged
merged 7 commits into from
Oct 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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