no waits
This commit is contained in:
@@ -200,8 +200,73 @@ resource "proxmox_virtual_environment_vm" "flatcar_template" {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
resource "null_resource" "wait_for_cp1_api" {
|
||||||
|
depends_on = [proxmox_virtual_environment_vm.control_plane1]
|
||||||
|
|
||||||
|
provisioner "local-exec" {
|
||||||
|
interpreter = ["/bin/bash", "-lc"]
|
||||||
|
environment = {
|
||||||
|
CP1_IP = "control-plane1.undercloud.local" # <-- set this
|
||||||
|
}
|
||||||
|
|
||||||
|
command = <<EOF
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
deadline=$((SECONDS + 1800)) # 30 min
|
||||||
|
echo "Waiting for Kubernetes API on $CP1_IP:6443 ..."
|
||||||
|
|
||||||
|
until curl -kfsS "https://$CP1_IP:6443/healthz" | grep -qx "ok"; do
|
||||||
|
if [ $SECONDS -ge $deadline ]; then
|
||||||
|
echo "Timeout waiting for API server"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
sleep 5
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "API server is up."
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "null_resource" "wait_for_cp2_cp3_api" {
|
||||||
|
depends_on = [
|
||||||
|
proxmox_virtual_environment_vm.control_plane2,
|
||||||
|
proxmox_virtual_environment_vm.control_plane3,
|
||||||
|
]
|
||||||
|
|
||||||
|
provisioner "local-exec" {
|
||||||
|
interpreter = ["/bin/bash", "-lc"]
|
||||||
|
environment = {
|
||||||
|
CP2_IP = "control-plane2.undercloud.local" # set this
|
||||||
|
CP3_IP = "control-plane3.undercloud.local" # set this
|
||||||
|
}
|
||||||
|
|
||||||
|
command = <<EOF
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
deadline=$((SECONDS + 2400)) # 40 min
|
||||||
|
|
||||||
|
check() {
|
||||||
|
local ip="$1"
|
||||||
|
curl -kfsS "https://$ip:6443/healthz" | grep -qx "ok"
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "Waiting for cp2 API..."
|
||||||
|
until check "$CP2_IP"; do
|
||||||
|
if [ $SECONDS -ge $deadline ]; then echo "Timeout waiting for cp2 API"; exit 1; fi
|
||||||
|
sleep 5
|
||||||
|
done
|
||||||
|
echo "cp2 API is up."
|
||||||
|
|
||||||
|
echo "Waiting for cp3 API..."
|
||||||
|
until check "$CP3_IP"; do
|
||||||
|
if [ $SECONDS -ge $deadline ]; then echo "Timeout waiting for cp3 API"; exit 1; fi
|
||||||
|
sleep 5
|
||||||
|
done
|
||||||
|
echo "cp3 API is up."
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# =============== deploy Control Plane ====================
|
# =============== deploy Control Plane ====================
|
||||||
|
|
||||||
@@ -261,7 +326,7 @@ resource "proxmox_virtual_environment_vm" "control_plane2" {
|
|||||||
tags = ["control-plane","flatcar","kubernetes","terraform"]
|
tags = ["control-plane","flatcar","kubernetes","terraform"]
|
||||||
depends_on = [
|
depends_on = [
|
||||||
proxmox_virtual_environment_file.control_plane2_ignition,
|
proxmox_virtual_environment_file.control_plane2_ignition,
|
||||||
null_resource.wait_for_cp1
|
null_resource.wait_for_cp1_api
|
||||||
]
|
]
|
||||||
boot_order = ["virtio0"]
|
boot_order = ["virtio0"]
|
||||||
|
|
||||||
@@ -304,7 +369,7 @@ resource "proxmox_virtual_environment_vm" "control_plane3" {
|
|||||||
tags = ["control-plane","flatcar","kubernetes","terraform"]
|
tags = ["control-plane","flatcar","kubernetes","terraform"]
|
||||||
depends_on = [
|
depends_on = [
|
||||||
proxmox_virtual_environment_file.control_plane3_ignition,
|
proxmox_virtual_environment_file.control_plane3_ignition,
|
||||||
null_resource.wait_for_cp1
|
null_resource.wait_for_cp1_api
|
||||||
]
|
]
|
||||||
boot_order = ["virtio0"]
|
boot_order = ["virtio0"]
|
||||||
|
|
||||||
@@ -360,7 +425,7 @@ resource "proxmox_virtual_environment_vm" "worker1" {
|
|||||||
tags = ["worker","flatcar","kubernetes","terraform"]
|
tags = ["worker","flatcar","kubernetes","terraform"]
|
||||||
depends_on = [
|
depends_on = [
|
||||||
proxmox_virtual_environment_file.worker1_ignition,
|
proxmox_virtual_environment_file.worker1_ignition,
|
||||||
null_resource.wait_for_cp3
|
null_resource.wait_for_cp2_cp3_api
|
||||||
]
|
]
|
||||||
boot_order = ["virtio0"]
|
boot_order = ["virtio0"]
|
||||||
|
|
||||||
@@ -403,7 +468,7 @@ resource "proxmox_virtual_environment_vm" "worker2" {
|
|||||||
tags = ["worker","flatcar","kubernetes","terraform"]
|
tags = ["worker","flatcar","kubernetes","terraform"]
|
||||||
depends_on = [
|
depends_on = [
|
||||||
proxmox_virtual_environment_file.worker2_ignition,
|
proxmox_virtual_environment_file.worker2_ignition,
|
||||||
null_resource.wait_for_cp3
|
null_resource.wait_for_cp2_cp3_api
|
||||||
]
|
]
|
||||||
boot_order = ["virtio0"]
|
boot_order = ["virtio0"]
|
||||||
|
|
||||||
@@ -446,7 +511,7 @@ resource "proxmox_virtual_environment_vm" "worker3" {
|
|||||||
tags = ["worker","flatcar","kubernetes","terraform"]
|
tags = ["worker","flatcar","kubernetes","terraform"]
|
||||||
depends_on = [
|
depends_on = [
|
||||||
proxmox_virtual_environment_file.worker3_ignition,
|
proxmox_virtual_environment_file.worker3_ignition,
|
||||||
null_resource.wait_for_cp3
|
null_resource.wait_for_cp2_cp3_api
|
||||||
]
|
]
|
||||||
boot_order = ["virtio0"]
|
boot_order = ["virtio0"]
|
||||||
|
|
||||||
@@ -489,7 +554,7 @@ resource "proxmox_virtual_environment_vm" "worker4" {
|
|||||||
tags = ["worker","flatcar","kubernetes","terraform"]
|
tags = ["worker","flatcar","kubernetes","terraform"]
|
||||||
depends_on = [
|
depends_on = [
|
||||||
proxmox_virtual_environment_file.worker4_ignition,
|
proxmox_virtual_environment_file.worker4_ignition,
|
||||||
null_resource.wait_for_cp3
|
null_resource.wait_for_cp2_cp3_api
|
||||||
]
|
]
|
||||||
boot_order = ["virtio0"]
|
boot_order = ["virtio0"]
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user