From b1303e26fe626c3980b719e7170e79fcf08d81b5 Mon Sep 17 00:00:00 2001 From: Francisco Augusto Date: Thu, 6 Jul 2023 15:53:35 +0200 Subject: [PATCH] Fix wait conditions (#198) * Fix unmanaged control planes wait * Increase calico wait * Fix wait conditions * Update changelog --- CHANGELOG.md | 2 ++ .../create/actions/createworker/createworker.go | 17 +++-------------- .../create/actions/createworker/provider.go | 2 +- 3 files changed, 6 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4e5efb2a3f..84a2347405 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## 0.17.0-0.3.0 (Upcoming) +* Fix wait conditions for unmanaged clusters + ## 0.17.0-0.2.0 (2023-07-03) * Add clusterAPI capabilities for AKS diff --git a/pkg/cluster/internal/create/actions/createworker/createworker.go b/pkg/cluster/internal/create/actions/createworker/createworker.go index 7d7cab6d9f..ef35d29982 100644 --- a/pkg/cluster/internal/create/actions/createworker/createworker.go +++ b/pkg/cluster/internal/create/actions/createworker/createworker.go @@ -387,8 +387,8 @@ func (a *action) Execute(ctx *actions.ActionContext) error { } if provider.capxProvider != "azure" || !keosCluster.Spec.ControlPlane.Managed { - // Wait for the worker cluster creation - c = "kubectl -n " + capiClustersNamespace + " wait --for=condition=ready --timeout=15m --all md" + // Wait for all the machine deployments to be ready + c = "kubectl -n " + capiClustersNamespace + " wait --for=condition=Ready --timeout=15m --all md" _, err = commons.ExecuteCommand(n, c) if err != nil { return errors.Wrap(err, "failed to create the worker Cluster") @@ -396,13 +396,8 @@ func (a *action) Execute(ctx *actions.ActionContext) error { } if !keosCluster.Spec.ControlPlane.Managed && keosCluster.Spec.ControlPlane.HighlyAvailable { - // Wait for all control planes creation - c = "kubectl -n " + capiClustersNamespace + " wait --for=condition=ControlPlaneReady --timeout 10m cluster " + keosCluster.Metadata.Name - if err != nil { - return errors.Wrap(err, "failed to create the worker Cluster") - } // Wait for all control planes to be ready - c = "kubectl -n " + capiClustersNamespace + " wait --for=jsonpath=\"{.status.unavailableReplicas}\"=0 --timeout 10m --all kubeadmcontrolplanes" + c = "kubectl -n " + capiClustersNamespace + " wait --for=jsonpath=\"{.status.readyReplicas}\"=3 --timeout 10m kubeadmcontrolplanes " + keosCluster.Metadata.Name + "-control-plane" _, err = commons.ExecuteCommand(n, c) if err != nil { return errors.Wrap(err, "failed to create the worker Cluster") @@ -545,12 +540,6 @@ func (a *action) Execute(ctx *actions.ActionContext) error { ctx.Status.Start("Creating cloud-provisioner Objects backup 🗄️") defer ctx.Status.End(false) - c = "kubectl wait --for=condition=Ready -n " + capiClustersNamespace + " cluster " + keosCluster.Metadata.Name + " --timeout 15m" - _, err = commons.ExecuteCommand(n, c) - if err != nil { - return errors.Wrap(err, "timeout to cluster condition ready") - } - if _, err := os.Stat(localBackupPath); os.IsNotExist(err) { if err := os.MkdirAll(localBackupPath, 0755); err != nil { return errors.Wrap(err, "failed to create local backup directory") diff --git a/pkg/cluster/internal/create/actions/createworker/provider.go b/pkg/cluster/internal/create/actions/createworker/provider.go index e1c5510d4f..4659cd3157 100644 --- a/pkg/cluster/internal/create/actions/createworker/provider.go +++ b/pkg/cluster/internal/create/actions/createworker/provider.go @@ -191,7 +191,7 @@ func installCalico(n nodes.Node, k string, keosCluster commons.KeosCluster, allo } // Wait for calico-system namespace to be created - c = "timeout 30s bash -c 'until kubectl --kubeconfig " + kubeconfigPath + " get ns calico-system; do sleep 2s ; done'" + c = "timeout 60s bash -c 'until kubectl --kubeconfig " + kubeconfigPath + " get ns calico-system; do sleep 2s ; done'" _, err = commons.ExecuteCommand(n, c) if err != nil { return errors.Wrap(err, "failed to wait for calico-system namespace")