From 64411677552f54be579ceae87f6755b439e22b31 Mon Sep 17 00:00:00 2001 From: killianmuldoon Date: Tue, 11 Oct 2022 16:47:34 +0100 Subject: [PATCH] Ensure Kubeadmconfig is reconciled after datasecretname is set Signed-off-by: killianmuldoon --- .../machine/machine_controller_phases.go | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/internal/controllers/machine/machine_controller_phases.go b/internal/controllers/machine/machine_controller_phases.go index 8ffe77e9a2cc..8f29f4152769 100644 --- a/internal/controllers/machine/machine_controller_phases.go +++ b/internal/controllers/machine/machine_controller_phases.go @@ -174,14 +174,7 @@ func (r *Reconciler) reconcileExternal(ctx context.Context, cluster *clusterv1.C func (r *Reconciler) reconcileBootstrap(ctx context.Context, cluster *clusterv1.Cluster, m *clusterv1.Machine) (ctrl.Result, error) { log := ctrl.LoggerFrom(ctx, "cluster", cluster.Name) - // If the bootstrap data is populated, set ready and return. - if m.Spec.Bootstrap.DataSecretName != nil { - m.Status.BootstrapReady = true - conditions.MarkTrue(m, clusterv1.BootstrapReadyCondition) - return ctrl.Result{}, nil - } - - // If the Boostrap ref is nil (and so the machine should use user generated data secret), return. + // If the Bootstrap ref is nil (and so the machine should use user generated data secret), return. if m.Spec.Bootstrap.ConfigRef == nil { return ctrl.Result{}, nil } @@ -191,10 +184,20 @@ func (r *Reconciler) reconcileBootstrap(ctx context.Context, cluster *clusterv1. if err != nil { return ctrl.Result{}, err } + + // If the external object is paused return. + if externalResult.Paused { + return ctrl.Result{}, nil + } + if externalResult.RequeueAfter > 0 { return ctrl.Result{RequeueAfter: externalResult.RequeueAfter}, nil } - if externalResult.Paused { + + // If the bootstrap data is populated, set ready and return. + if m.Spec.Bootstrap.DataSecretName != nil { + m.Status.BootstrapReady = true + conditions.MarkTrue(m, clusterv1.BootstrapReadyCondition) return ctrl.Result{}, nil } bootstrapConfig := externalResult.Result