From 661376b0ae836fd771898410c788cc74b9bfc4c4 Mon Sep 17 00:00:00 2001 From: Jiho Lee Date: Thu, 29 Sep 2022 16:28:50 +0900 Subject: [PATCH 1/7] refactor: remove hard-coded inference_node_instance_types --- live/dev/main.tf | 1 - live/prod/main.tf | 1 - 2 files changed, 2 deletions(-) diff --git a/live/dev/main.tf b/live/dev/main.tf index 8c5c578..615a956 100644 --- a/live/dev/main.tf +++ b/live/dev/main.tf @@ -44,7 +44,6 @@ module "eks" { disk_size = 30 } - inference_node_instance_types = ["t3a.medium"] api_node_spot = true api_node_size_spec = { diff --git a/live/prod/main.tf b/live/prod/main.tf index 6bed8e6..0797659 100644 --- a/live/prod/main.tf +++ b/live/prod/main.tf @@ -44,7 +44,6 @@ module "eks" { disk_size = 30 } - inference_node_instance_types = ["t3a.large"] api_node_spot = false api_node_size_spec = { From 5b1ef296af81c5f00fb46cdf5dd3c7212815e75a Mon Sep 17 00:00:00 2001 From: Jiho Lee Date: Thu, 29 Sep 2022 16:29:25 +0900 Subject: [PATCH 2/7] feat: inference instance t3a.large --- modules/cluster/variables.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/cluster/variables.tf b/modules/cluster/variables.tf index cb7ff12..556f535 100644 --- a/modules/cluster/variables.tf +++ b/modules/cluster/variables.tf @@ -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" { From 1916f427a0fc438c1b497f4a7c030bbde0d643f3 Mon Sep 17 00:00:00 2001 From: Jiho Lee Date: Thu, 29 Sep 2022 16:29:43 +0900 Subject: [PATCH 3/7] feat: GPU instance node bootstrapping --- live/bootstrap.sh | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/live/bootstrap.sh b/live/bootstrap.sh index 0cafe08..48f6611 100755 --- a/live/bootstrap.sh +++ b/live/bootstrap.sh @@ -31,6 +31,19 @@ elif [ $SO1S_ENV_NUMBER -eq 1 ]; then SO1S_ENV_PATH="./prod" fi +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_ENV_NUMBER -eq 1 ]; then + INFERENCE_INSTANCE='["t3a.large"]' +fi + cd $SO1S_ENV_PATH # Check Terraform Version @@ -51,7 +64,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` From 539c30f9059c7e8c5749b62f6d859bf2aeba6dfd Mon Sep 17 00:00:00 2001 From: Jiho Lee Date: Thu, 29 Sep 2022 16:32:03 +0900 Subject: [PATCH 4/7] fix: use double quote --- live/bootstrap.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/live/bootstrap.sh b/live/bootstrap.sh index 48f6611..7c39bb2 100755 --- a/live/bootstrap.sh +++ b/live/bootstrap.sh @@ -64,7 +64,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" -var=`inference_node_instance_types=$INFERENCE_INSTANCE` +terraform apply -var="global_name=$SO1S_GLOBAL_NAME" -var="inference_node_instance_types=$INFERENCE_INSTANCE" # Using for ALB, External DNS Chart RESULT=`terraform output` From 620958b38053b108120fdbd4b0650d3c5c11a366 Mon Sep 17 00:00:00 2001 From: Jiho Lee Date: Thu, 29 Sep 2022 16:53:00 +0900 Subject: [PATCH 5/7] fix: reassign so1s regex --- live/bootstrap.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/live/bootstrap.sh b/live/bootstrap.sh index 7c39bb2..e0daa12 100755 --- a/live/bootstrap.sh +++ b/live/bootstrap.sh @@ -31,6 +31,7 @@ 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) 사용 " From 524778fc222e19a853983b87a4fa26423b588e8d Mon Sep 17 00:00:00 2001 From: Jiho Lee Date: Thu, 29 Sep 2022 16:53:19 +0900 Subject: [PATCH 6/7] feat: set up dev / prod instance variable --- live/dev/main.tf | 1 + live/dev/variables.tf | 6 ++++++ live/prod/main.tf | 1 + live/prod/variables.tf | 13 +------------ 4 files changed, 9 insertions(+), 12 deletions(-) diff --git a/live/dev/main.tf b/live/dev/main.tf index 615a956..c956fb5 100644 --- a/live/dev/main.tf +++ b/live/dev/main.tf @@ -44,6 +44,7 @@ module "eks" { disk_size = 30 } + inference_node_instance_types = var.inference_node_instance_types api_node_spot = true api_node_size_spec = { diff --git a/live/dev/variables.tf b/live/dev/variables.tf index 2d066f3..2fd7e29 100644 --- a/live/dev/variables.tf +++ b/live/dev/variables.tf @@ -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"] } \ No newline at end of file diff --git a/live/prod/main.tf b/live/prod/main.tf index 0797659..9d0d540 100644 --- a/live/prod/main.tf +++ b/live/prod/main.tf @@ -44,6 +44,7 @@ module "eks" { disk_size = 30 } + inference_node_instance_types = var.inference_node_instance_types api_node_spot = false api_node_size_spec = { diff --git a/live/prod/variables.tf b/live/prod/variables.tf index 46783ee..b92f46d 100644 --- a/live/prod/variables.tf +++ b/live/prod/variables.tf @@ -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"] -} From da21182f59cfde6806af7cea02c1c6d7db1b624a Mon Sep 17 00:00:00 2001 From: Jiho Lee Date: Fri, 30 Sep 2022 19:35:09 +0900 Subject: [PATCH 7/7] fix: wrong variable --- live/bootstrap.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/live/bootstrap.sh b/live/bootstrap.sh index e0daa12..a36f298 100755 --- a/live/bootstrap.sh +++ b/live/bootstrap.sh @@ -41,7 +41,7 @@ done # 환경에 따른 글로벌 이름 설정 -> Prod은 고정 값 if [ $SO1S_USE_GPU -eq 2 ]; then INFERENCE_INSTANCE='["g4dn.xlarge"]' -elif [ $SO1S_ENV_NUMBER -eq 1 ]; then +elif [ $SO1S_USE_GPU -eq 1 ]; then INFERENCE_INSTANCE='["t3a.large"]' fi