Skip to content

Commit

Permalink
Merge pull request #7508 from sbueringer/pr-fix-kubeadmconfig
Browse files Browse the repository at this point in the history
[release-1.2] 🐛 Ensure Kubeadmconfig is reconciled after datasecretname is set
  • Loading branch information
k8s-ci-robot authored Nov 7, 2022
2 parents 236bd05 + 6441167 commit d49ddb7
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions internal/controllers/machine/machine_controller_phases.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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
Expand Down

0 comments on commit d49ddb7

Please sign in to comment.