simplify contitions, little fix
This commit is contained in:
parent
4167f6124b
commit
6361990cdf
@ -14,7 +14,7 @@ module "control_planes" {
|
|||||||
ipv4_subnet_id = hcloud_network_subnet.subnet["control_plane"].id
|
ipv4_subnet_id = hcloud_network_subnet.subnet["control_plane"].id
|
||||||
|
|
||||||
# We leave some room so 100 eventual Hetzner LBs that can be created perfectly safely
|
# We leave some room so 100 eventual Hetzner LBs that can be created perfectly safely
|
||||||
# It leaves the subnet with 254 x 254 - 100 = 64416 IPs to use, so probably enough.
|
# It leaves the subnet with 254 x 254 - 100 = 64416 IPs to use, so probably enough.
|
||||||
private_ipv4 = cidrhost(var.network_ipv4_subnets["control_plane"], count.index + 101)
|
private_ipv4 = cidrhost(var.network_ipv4_subnets["control_plane"], count.index + 101)
|
||||||
|
|
||||||
labels = {
|
labels = {
|
||||||
@ -48,7 +48,7 @@ resource "null_resource" "control_planes" {
|
|||||||
server = "https://${element(module.control_planes.*.private_ipv4_address, count.index > 0 ? 0 : 1)}:6443"
|
server = "https://${element(module.control_planes.*.private_ipv4_address, count.index > 0 ? 0 : 1)}:6443"
|
||||||
token = random_password.k3s_token.result
|
token = random_password.k3s_token.result
|
||||||
disable-cloud-controller = true
|
disable-cloud-controller = true
|
||||||
disable = ["servicelb", "local-storage"]
|
disable = ["servicelb", "local-storage", "traefik", "metric-server"]
|
||||||
flannel-iface = "eth1"
|
flannel-iface = "eth1"
|
||||||
kubelet-arg = "cloud-provider=external"
|
kubelet-arg = "cloud-provider=external"
|
||||||
node-ip = module.control_planes[count.index].private_ipv4_address
|
node-ip = module.control_planes[count.index].private_ipv4_address
|
||||||
|
4
init.tf
4
init.tf
@ -91,7 +91,7 @@ resource "null_resource" "kustomization" {
|
|||||||
|
|
||||||
# Upload traefik config
|
# Upload traefik config
|
||||||
provisioner "file" {
|
provisioner "file" {
|
||||||
content = local.is_single_node_cluster ? "" : var.traefik_enabled == false ? "" : templatefile(
|
content = local.is_single_node_cluster || var.traefik_enabled == false ? "" : templatefile(
|
||||||
"${path.module}/templates/traefik_config.yaml.tpl",
|
"${path.module}/templates/traefik_config.yaml.tpl",
|
||||||
{
|
{
|
||||||
name = "${var.cluster_name}-traefik"
|
name = "${var.cluster_name}-traefik"
|
||||||
@ -142,7 +142,7 @@ resource "null_resource" "kustomization" {
|
|||||||
"kubectl -n system-upgrade wait --for=condition=available --timeout=120s deployment/system-upgrade-controller",
|
"kubectl -n system-upgrade wait --for=condition=available --timeout=120s deployment/system-upgrade-controller",
|
||||||
"kubectl -n system-upgrade apply -f /tmp/post_install/plans.yaml"
|
"kubectl -n system-upgrade apply -f /tmp/post_install/plans.yaml"
|
||||||
],
|
],
|
||||||
local.is_single_node_cluster ? [] : var.traefik_enabled == false ? [] : [<<-EOT
|
local.is_single_node_cluster || var.traefik_enabled == false ? [] : [<<-EOT
|
||||||
timeout 120 bash <<EOF
|
timeout 120 bash <<EOF
|
||||||
until [ -n "\$(kubectl get -n kube-system service/traefik --output=jsonpath='{.status.loadBalancer.ingress[0].ip}' 2> /dev/null)" ]; do
|
until [ -n "\$(kubectl get -n kube-system service/traefik --output=jsonpath='{.status.loadBalancer.ingress[0].ip}' 2> /dev/null)" ]; do
|
||||||
echo "Waiting for load-balancer to get an IP..."
|
echo "Waiting for load-balancer to get an IP..."
|
||||||
|
Loading…
Reference in New Issue
Block a user