-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathnodepool.tf
103 lines (99 loc) · 3.2 KB
/
nodepool.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
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
locals {
control_plane_nodepools = [
for np in var.control_plane_nodepools : {
name = np.name,
location = np.location,
server_type = np.type,
backups = np.backups,
keep_disk = np.keep_disk,
rdns_ipv4 = var.talos_public_ipv4_enabled ? (
np.rdns_ipv4 != null ? np.rdns_ipv4 :
np.rdns != null ? np.rdns :
local.cluster_rdns_ipv4
) : null,
rdns_ipv6 = var.talos_public_ipv6_enabled ? (
np.rdns_ipv6 != null ? np.rdns_ipv6 :
np.rdns != null ? np.rdns :
local.cluster_rdns_ipv6
) : null,
labels = merge(
np.labels,
{ nodepool = np.name }
),
annotations = np.annotations,
taints = concat(
[for taint in np.taints : regex(
"^(?P<key>[^=:]+)=?(?P<value>[^=:]*?):(?P<effect>.+)$",
taint
)],
local.allow_scheduling_on_control_plane ? [] : [
{ key = "node-role.kubernetes.io/control-plane", value = "", effect = "NoSchedule" }
]
),
count = np.count,
}
]
worker_nodepools = [
for np in var.worker_nodepools : {
name = np.name,
location = np.location,
server_type = np.type,
backups = np.backups,
keep_disk = np.keep_disk,
rdns_ipv4 = var.talos_public_ipv4_enabled ? (
np.rdns_ipv4 != null ? np.rdns_ipv4 :
np.rdns != null ? np.rdns :
local.cluster_rdns_ipv4
) : null,
rdns_ipv6 = var.talos_public_ipv6_enabled ? (
np.rdns_ipv6 != null ? np.rdns_ipv6 :
np.rdns != null ? np.rdns :
local.cluster_rdns_ipv6
) : null,
labels = merge(
np.labels,
{ nodepool = np.name }
),
annotations = np.annotations,
taints = [for taint in np.taints : regex(
"^(?P<key>[^=:]+)=?(?P<value>[^=:]*?):(?P<effect>.+)$",
taint
)],
count = np.count,
placement_group = np.placement_group
}
]
cluster_autoscaler_nodepools = [
for np in var.cluster_autoscaler_nodepools : {
name = np.name,
location = np.location,
server_type = np.type,
labels = merge(
np.labels,
{ nodepool = np.name }
),
annotations = np.annotations,
taints = [for taint in np.taints : regex(
"^(?P<key>[^=:]+)=?(?P<value>[^=:]*?):(?P<effect>.+)$",
taint
)],
min = np.min,
max = np.max
}
]
control_plane_nodepools_map = { for np in local.control_plane_nodepools : np.name => np }
worker_nodepools_map = { for np in local.worker_nodepools : np.name => np }
cluster_autoscaler_nodepools_map = { for np in local.cluster_autoscaler_nodepools : np.name => np }
control_plane_sum = sum(concat(
[for np in local.control_plane_nodepools : np.count], [0]
))
worker_sum = sum(concat(
[for np in local.worker_nodepools : np.count if length(np.taints) == 0], [0]
))
cluster_autoscaler_min_sum = sum(concat(
[for np in local.cluster_autoscaler_nodepools : np.min if length(np.taints) == 0], [0]
))
cluster_autoscaler_max_sum = sum(concat(
[for np in local.cluster_autoscaler_nodepools : np.max if length(np.taints) == 0], [0]
))
}