-
Notifications
You must be signed in to change notification settings - Fork 42
Expand file tree
/
Copy pathcastai.tf
More file actions
129 lines (105 loc) · 3.37 KB
/
castai.tf
File metadata and controls
129 lines (105 loc) · 3.37 KB
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
resource "castai_gke_cluster" "this" {
project_id = var.project_id
location = var.cluster_region
name = var.cluster_name
delete_nodes_on_disconnect = var.delete_nodes_on_disconnect
credentials_json = module.castai-gke-iam.private_key
}
module "castai-gke-iam" {
source = "castai/gke-iam/castai"
project_id = var.project_id
gke_cluster_name = var.cluster_name
}
resource "castai_node_configuration" "default" {
cluster_id = castai_gke_cluster.this.id
name = "default"
disk_cpu_ratio = 0
min_disk_size = 100
subnets = var.subnets
}
resource "castai_node_configuration_default" "this" {
cluster_id = castai_gke_cluster.this.id
configuration_id = castai_node_configuration.default.id
}
resource "castai_node_template" "default_by_castai" {
cluster_id = castai_gke_cluster.this.id
name = "default-by-castai"
is_default = true
is_enabled = true
configuration_id = castai_node_configuration.default.id
should_taint = false
constraints {
on_demand = true
}
custom_instances_enabled = false
}
resource "castai_node_template" "example_spot_template" {
cluster_id = castai_gke_cluster.this.id
name = "example_spot_template"
is_default = false
is_enabled = true
configuration_id = castai_node_configuration.default.id
should_taint = true
custom_labels = {
type = "spot"
}
custom_taints {
key = "dedicated"
value = "spot"
effect = "NoSchedule"
}
constraints {
spot = true
use_spot_fallbacks = true
fallback_restore_rate_seconds = 1800
enable_spot_diversity = true
spot_diversity_price_increase_limit_percent = 20
min_cpu = 2
max_cpu = 8
min_memory = 4096
max_memory = 16384
architectures = ["amd64"]
burstable_instances = "disabled"
customer_specific = "enabled"
instance_families {
exclude = ["e2"]
}
custom_priority {
instance_families = ["c4"]
spot = true
}
}
}
resource "castai_autoscaler" "castai_autoscaler_policy" {
cluster_id = castai_gke_cluster.this.id
autoscaler_settings {
enabled = true
is_scoped_mode = false
node_templates_partial_matching_enabled = false
unschedulable_pods {
enabled = true
custom_instances_enabled = false # custom_instances_enabled should be set to same value(true or false) at Node templates & unschedulable_pods policy for backward compatability
}
cluster_limits {
enabled = false
cpu {
min_cores = 1
max_cores = 200
}
}
node_downscaler {
enabled = true
empty_nodes {
enabled = true
}
evictor {
aggressive_mode = false
cycle_interval = "60s"
dry_run = false
enabled = false
node_grace_period_minutes = 10
scoped_mode = false
}
}
}
}