Skip to content

Commit d93eadc

Browse files
Ensure Kubeadmconfig is reconciled after datasecretname is set
Signed-off-by: killianmuldoon <[email protected]>
1 parent 2122310 commit d93eadc

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

internal/controllers/machine/machine_controller_phases.go

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -175,13 +175,6 @@ func (r *Reconciler) reconcileExternal(ctx context.Context, cluster *clusterv1.C
175175
func (r *Reconciler) reconcileBootstrap(ctx context.Context, cluster *clusterv1.Cluster, m *clusterv1.Machine) (ctrl.Result, error) {
176176
log := ctrl.LoggerFrom(ctx)
177177

178-
// If the bootstrap data is populated, set ready and return.
179-
if m.Spec.Bootstrap.DataSecretName != nil {
180-
m.Status.BootstrapReady = true
181-
conditions.MarkTrue(m, clusterv1.BootstrapReadyCondition)
182-
return ctrl.Result{}, nil
183-
}
184-
185178
// If the Bootstrap ref is nil (and so the machine should use user generated data secret), return.
186179
if m.Spec.Bootstrap.ConfigRef == nil {
187180
return ctrl.Result{}, nil
@@ -192,10 +185,20 @@ func (r *Reconciler) reconcileBootstrap(ctx context.Context, cluster *clusterv1.
192185
if err != nil {
193186
return ctrl.Result{}, err
194187
}
188+
189+
// If the external object is paused return.
190+
if externalResult.Paused {
191+
return ctrl.Result{}, nil
192+
}
193+
195194
if externalResult.RequeueAfter > 0 {
196195
return ctrl.Result{RequeueAfter: externalResult.RequeueAfter}, nil
197196
}
198-
if externalResult.Paused {
197+
198+
// If the bootstrap data is populated, set ready and return.
199+
if m.Spec.Bootstrap.DataSecretName != nil {
200+
m.Status.BootstrapReady = true
201+
conditions.MarkTrue(m, clusterv1.BootstrapReadyCondition)
199202
return ctrl.Result{}, nil
200203
}
201204
bootstrapConfig := externalResult.Result

0 commit comments

Comments
 (0)