-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Some ideas to give the API Server enough time to reigster the custom resources before start deploying CRDs
Option 1
In the metal-crd module, add this:
resource "null_resource" "wait_for_metallb_crds" {
provisioner "local-exec" {
command = <<EOT
for crd in ipaddresspools.metallb.io l2advertisements.metallb.io; do
echo "Waiting for CRD $crd to be registered..."
until kubectl get crd $crd >/dev/null 2>&1; do
sleep 5
done
done
EOT
}
}Then make the resources depend on it
resource "kubernetes_manifest" "ip_address_pool" {
manifest = { ... }
depends_on = [null_resource.wait_for_metallb_crds]
}Option 2
It looks like Terraform 1.13+ has a time_sleep resource
https://github.com/hashicorp/terraform-provider-time/blob/main/docs/resources/sleep.md
Maybe combine MetalLB chart and its CRDs in a single module and do something like this
resource "time_sleep" "wait_30s" {
depends_on = [helm_release.metallb] # or wherever CRDs are applied
create_duration = "30s"
}Then depend on it
resource "kubernetes_manifest" "ip_address_pool" {
depends_on = [time_sleep.wait_30s]
}Option 3
Handle this outsitde Terraform/grunt, in GHA for example.
Metadata
Metadata
Assignees
Labels
No labels