Merge pull request #52 from mnencia/staging

Agents IP should not depend on servers_num
This commit is contained in:
Karim Naufal 2022-02-09 13:58:32 +01:00 committed by GitHub
commit 036404c983
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 8 deletions

View File

@ -76,13 +76,13 @@ resource "hcloud_server" "agents" {
}
}
# Generating k3s agent config file
# Generating k3s agent config file
provisioner "file" {
content = yamlencode({
node-name = self.name
kubelet-arg = "cloud-provider=external"
flannel-iface = "eth1"
node-ip = cidrhost(hcloud_network.k3s.ip_range, 2 + var.servers_num + count.index)
node-ip = cidrhost(hcloud_network_subnet.k3s.ip_range, 257 + count.index)
})
destination = "/etc/rancher/k3s/config.yaml"
@ -114,7 +114,7 @@ resource "hcloud_server" "agents" {
network {
network_id = hcloud_network.k3s.id
ip = cidrhost(hcloud_network.k3s.ip_range, 2 + var.servers_num + count.index)
ip = cidrhost(hcloud_network_subnet.k3s.ip_range, 257 + count.index)
}
depends_on = [

View File

@ -1,5 +1,5 @@
locals {
first_control_plane_network_ip = cidrhost(hcloud_network.k3s.ip_range, 2)
first_control_plane_network_ip = cidrhost(hcloud_network_subnet.k3s.ip_range, 2)
hcloud_image_name = "ubuntu-20.04"
ssh_public_key = trimspace(file(var.public_key))
# ssh_private_key is either the contents of var.private_key or null to use a ssh agent.

View File

@ -68,9 +68,9 @@ resource "hcloud_server" "control_planes" {
disable = "servicelb, local-storage"
flannel-iface = "eth1"
kubelet-arg = "cloud-provider=external"
node-ip = cidrhost(hcloud_network.k3s.ip_range, 3 + count.index)
advertise-address = cidrhost(hcloud_network.k3s.ip_range, 3 + count.index)
tls-san = cidrhost(hcloud_network.k3s.ip_range, 3 + count.index)
node-ip = cidrhost(hcloud_network_subnet.k3s.ip_range, 3 + count.index)
advertise-address = cidrhost(hcloud_network_subnet.k3s.ip_range, 3 + count.index)
tls-san = cidrhost(hcloud_network_subnet.k3s.ip_range, 3 + count.index)
token = random_password.k3s_token.result
node-taint = var.allow_scheduling_on_control_plane ? [] : ["node-role.kubernetes.io/master:NoSchedule"]
})
@ -104,7 +104,7 @@ resource "hcloud_server" "control_planes" {
network {
network_id = hcloud_network.k3s.id
ip = cidrhost(hcloud_network.k3s.ip_range, 3 + count.index)
ip = cidrhost(hcloud_network_subnet.k3s.ip_range, 3 + count.index)
}
depends_on = [