forked from hcloud-talos/terraform-hcloud-talos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
talos_patch_control_plane.tf
163 lines (163 loc) · 4.52 KB
/
talos_patch_control_plane.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
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
locals {
controlplane_yaml = {
for control_plane in local.control_planes : control_plane.name => {
machine = {
install = {
image = "ghcr.io/siderolabs/installer:${var.talos_version}"
extraKernelArgs = [
"ipv6.disable=${var.enable_ipv6 ? 0 : 1}",
]
}
certSANs = local.cert_SANs
kubelet = {
extraArgs = merge(
{
"cloud-provider" = "external"
"rotate-server-certificates" = true
},
var.kubelet_extra_args
)
nodeIP = {
validSubnets = [
local.node_ipv4_cidr
]
}
}
network = {
interfaces = [
{
interface = "eth0"
dhcp = true
vip = var.enable_floating_ip ? {
ip = data.hcloud_floating_ip.control_plane_ipv4[0].ip_address
hcloud = {
apiToken = var.hcloud_token
}
} : null
},
{
interface = "eth1"
dhcp = true
vip = var.enable_alias_ip ? {
ip = local.control_plane_private_vip_ipv4
hcloud = {
apiToken = var.hcloud_token
}
} : null
}
]
extraHostEntries = local.extra_host_entries
kubespan = {
enabled = var.enable_kube_span
advertiseKubernetesNetworks : false # Disabled because of cilium
mtu : 1370 # Hcloud has a MTU of 1450 (KubeSpanMTU = UnderlyingMTU - 80)
}
}
kernel = {
modules = var.kernel_modules_to_load
}
sysctls = merge(
{
"net.core.somaxconn" = "65535"
"net.core.netdev_max_backlog" = "4096"
},
var.sysctls_extra_args
)
features = {
kubernetesTalosAPIAccess = {
enabled = true
allowedRoles = [
"os:reader"
]
allowedKubernetesNamespaces = [
"kube-system"
]
}
hostDNS = {
enabled = true
forwardKubeDNSToHost = true
resolveMemberNames = true
}
}
time = {
servers = [
"ntp1.hetzner.de",
"ntp2.hetzner.com",
"ntp3.hetzner.net",
"time.cloudflare.com"
]
}
registries = var.registries
}
cluster = {
allowSchedulingOnControlPlanes = var.worker_count <= 0
network = {
dnsDomain = var.cluster_domain
podSubnets = [
local.pod_ipv4_cidr
]
serviceSubnets = [
local.service_ipv4_cidr
]
cni = {
name = "none"
}
}
coreDNS = {
disabled = var.disable_talos_coredns
}
proxy = {
disabled = true
}
apiServer = {
certSANs = local.cert_SANs
extraArgs = var.kube_api_extra_args
}
controllerManager = {
extraArgs = {
"cloud-provider" = "external"
"node-cidr-mask-size-ipv4" = local.node_ipv4_cidr_mask_size
"bind-address" : "0.0.0.0"
}
}
etcd = {
advertisedSubnets = [
local.node_ipv4_cidr
]
extraArgs = {
"listen-metrics-urls" = "http://0.0.0.0:2381"
}
}
scheduler = {
extraArgs = {
"bind-address" = "0.0.0.0"
}
}
inlineManifests = [
{
name = "hcloud-secret"
contents = replace(yamlencode({
apiVersion = "v1"
kind = "Secret"
type = "Opaque"
metadata = {
name = "hcloud"
namespace = "kube-system"
}
data = {
network = base64encode(hcloud_network.this.id)
token = base64encode(var.hcloud_token)
}
}), "\"", "")
}
]
externalCloudProvider = {
enabled = true
manifests = [
"https://raw.githubusercontent.com/siderolabs/talos-cloud-controller-manager/v1.6.0/docs/deploy/cloud-controller-manager-daemonset.yml"
]
}
}
}
}
}