simplify contitions, little fix

This commit is contained in:
jonny 2022-03-11 14:24:24 +01:00
parent 4167f6124b
commit 6361990cdf
2 changed files with 4 additions and 4 deletions

View File

@ -14,7 +14,7 @@ module "control_planes" {
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
# 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)
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"
token = random_password.k3s_token.result
disable-cloud-controller = true
disable = ["servicelb", "local-storage"]
disable = ["servicelb", "local-storage", "traefik", "metric-server"]
flannel-iface = "eth1"
kubelet-arg = "cloud-provider=external"
node-ip = module.control_planes[count.index].private_ipv4_address

View File

@ -91,7 +91,7 @@ resource "null_resource" "kustomization" {
# Upload traefik config
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",
{
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 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
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..."