-
Notifications
You must be signed in to change notification settings - Fork 4
/
gke.tf
70 lines (68 loc) · 1.89 KB
/
gke.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
resource "google_container_cluster" "primary" {
name = var.cluster_name
project = data.google_project.project.number
location = var.compute_zone
remove_default_node_pool = true
initial_node_count = 1
enable_shielded_nodes = true
resource_labels = var.labels
workload_identity_config {
workload_pool = "${data.google_project.project.project_id}.svc.id.goog"
}
network_policy {
enabled = true
}
}
resource "google_container_node_pool" "primary_core" {
name = "core"
location = var.compute_zone
cluster = google_container_cluster.primary.name
node_count = 1
autoscaling {
min_node_count = 0
max_node_count = 4
}
node_config {
image_type = "COS_CONTAINERD"
machine_type = "e2-standard-8"
disk_size_gb = 64
metadata = {
disable-legacy-endpoints = "true"
}
oauth_scopes = [
"https://www.googleapis.com/auth/logging.write",
"https://www.googleapis.com/auth/monitoring",
"https://www.googleapis.com/auth/devstorage.read_only"
]
workload_metadata_config {
mode = "MODE_UNSPECIFIED"
}
}
}
resource "google_container_node_pool" "primary_gpu" {
count = var.gpu.enabled ? 1 : 0
name = "gpu-enabled"
location = var.compute_zone
cluster = google_container_cluster.primary.name
node_count = 1
node_config {
image_type = "COS_CONTAINERD"
machine_type = "n1-standard-4"
disk_size_gb = 64
metadata = {
disable-legacy-endpoints = "true"
}
oauth_scopes = [
"https://www.googleapis.com/auth/logging.write",
"https://www.googleapis.com/auth/monitoring",
"https://www.googleapis.com/auth/devstorage.read_only"
]
workload_metadata_config {
mode = "MODE_UNSPECIFIED"
}
guest_accelerator {
type = var.gpu.type
count = var.gpu.count
}
}
}