Skip to content

Commit 385a17c

Browse files
authored
Merge pull request #9 from So1S/SO1S-393-infra-gpu-노드-terraform-프로비저닝
SO1S-393 GPU 노드 Terraform 프로비저닝
2 parents ba00abe + da21182 commit 385a17c

File tree

6 files changed

+25
-16
lines changed

6 files changed

+25
-16
lines changed

live/bootstrap.sh

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,20 @@ elif [ $SO1S_ENV_NUMBER -eq 1 ]; then
3131
SO1S_ENV_PATH="./prod"
3232
fi
3333

34+
SO1S_REGEX="^[1-2]$"
35+
while [[ ! $SO1S_USE_GPU =~ $SO1S_REGEX ]]
36+
do
37+
echo -e "GPU를 사용할 것인지 번호를 입력해주세요. \n-> (1) 미사용 (2) 사용 "
38+
read SO1S_USE_GPU
39+
done
40+
41+
# 환경에 따른 글로벌 이름 설정 -> Prod은 고정 값
42+
if [ $SO1S_USE_GPU -eq 2 ]; then
43+
INFERENCE_INSTANCE='["g4dn.xlarge"]'
44+
elif [ $SO1S_USE_GPU -eq 1 ]; then
45+
INFERENCE_INSTANCE='["t3a.large"]'
46+
fi
47+
3448
cd $SO1S_ENV_PATH
3549

3650
# Check Terraform Version
@@ -51,7 +65,7 @@ fi
5165
echo -e "\n"
5266
echo "Start Resource Provisioning"
5367
echo "-> terraform apply -var=global_name=$SO1S_GLOBAL_NAME"
54-
terraform apply -var="global_name=$SO1S_GLOBAL_NAME"
68+
terraform apply -var="global_name=$SO1S_GLOBAL_NAME" -var="inference_node_instance_types=$INFERENCE_INSTANCE"
5569

5670
# Using for ALB, External DNS Chart
5771
RESULT=`terraform output`

live/dev/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ module "eks" {
4444

4545
disk_size = 30
4646
}
47-
inference_node_instance_types = ["t3a.medium"]
47+
inference_node_instance_types = var.inference_node_instance_types
4848

4949
api_node_spot = true
5050
api_node_size_spec = {

live/dev/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
variable "global_name" {
22
description = "This name will use as prefix for AWS resource so, Please write unique and distinct word e.g. sungbin, backend-test..."
33
type = string
4+
}
5+
6+
variable "inference_node_instance_types" {
7+
description = "This type will use inference node that use eks"
8+
type = list(string)
9+
default = ["t3a.large"]
410
}

live/prod/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ module "eks" {
4444

4545
disk_size = 30
4646
}
47-
inference_node_instance_types = ["t3a.large"]
47+
inference_node_instance_types = var.inference_node_instance_types
4848

4949
api_node_spot = false
5050
api_node_size_spec = {

live/prod/variables.tf

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,9 @@ variable "global_name" {
33
type = string
44
default = "prod"
55
}
6-
variable "public_instance_types" {
7-
description = "This type will use public node that use eks"
8-
type = list(string)
9-
default = ["t3a.medium"]
10-
}
116

12-
variable "inference_instance_types" {
7+
variable "inference_node_instance_types" {
138
description = "This type will use inference node that use eks"
149
type = list(string)
1510
default = ["t3a.large"]
1611
}
17-
18-
variable "api_instance_types" {
19-
description = "This type will use api node that use eks"
20-
type = list(string)
21-
default = ["t3a.large"]
22-
}

modules/cluster/variables.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ variable "inference_node_spot" {
5555
variable "inference_node_instance_types" {
5656
description = "This type will use inference node that use eks"
5757
type = list(string)
58-
default = ["t3a.medium"]
58+
default = ["t3a.large"]
5959
}
6060

6161
variable "api_node_size_spec" {

0 commit comments

Comments
 (0)