forked from cktf/terraform-hcloud-rke
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnode_pools.tf
48 lines (47 loc) · 1.46 KB
/
node_pools.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
resource "helm_release" "this" {
name = "cluster-autoscaler"
namespace = "kube-system"
repository = "https://kubernetes.github.io/autoscaler"
chart = "cluster-autoscaler"
version = "9.21.0"
values = [
yamlencode({
cloudProvider = "hetzner"
tolerations = [{
effect = "NoSchedule"
key = "node-role.kubernetes.io/master"
}]
affinity = {
nodeAffinity = {
requiredDuringSchedulingIgnoredDuringExecution = {
nodeSelectorTerms = [{
matchExpressions = [{
key = "node-role.kubernetes.io/master"
operator = "Exists"
}]
}]
}
}
}
extraEnv = {
HCLOUD_IMAGE = "ubuntu-20.04"
HCLOUD_TOKEN = var.hcloud_token
HCLOUD_NETWORK = var.network_id
HCLOUD_SSH_KEY = hcloud_ssh_key.this.id
HCLOUD_CLOUD_INIT = base64encode(templatefile("${path.module}/templates/node.sh", {
type = var.type
channel = var.channel
version = var.version_
registries = var.registries
join_host = hcloud_load_balancer_network.this.ip
join_token = random_string.agent_token.result
}))
}
autoscalingGroups = [for key, val in var.node_pools : {
minSize = val.min_size
maxSize = val.max_size
name = "${val.type}:${val.location}:${var.name}-${key}"
}]
})
]
}