Skip to content
This repository was archived by the owner on Jul 30, 2021. It is now read-only.

Commit 25767b3

Browse files
committed
fix: rebuild status when the config has been used
In order for us to get to this point the owner ref must be set by the machine controller, which implies that the machine has a pointer to this config object. So either it's an extremely unlikely user error, or we mistakenly dropped the "ready" flag for this config.
1 parent 2fae9f4 commit 25767b3

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

controllers/kubeadmconfig_controller.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,16 @@ func (r *KubeadmConfigReconciler) Reconcile(req ctrl.Request) (_ ctrl.Result, re
137137
case config.Status.Ready && machine.Status.InfrastructureReady:
138138
log.Info("ignoring config for an already ready machine")
139139
return ctrl.Result{}, nil
140-
// Ignore machines that already have bootstrap data we didn't generate
140+
// Reconcile status for machines that have already copied bootstrap data
141141
case machine.Spec.Bootstrap.Data != nil && !config.Status.Ready:
142-
// TODO: mark the config as ready?
143-
return ctrl.Result{}, nil
142+
config.Status.Ready = true
143+
// Initialize the patch helper
144+
patchHelper, err := patch.NewHelper(config, r)
145+
if err != nil {
146+
return ctrl.Result{}, err
147+
}
148+
err = patchHelper.Patch(ctx, config)
149+
return ctrl.Result{}, err
144150
// If we've already embedded a time-limited join token into a config, but are still waiting for the token to be used, refresh it
145151
case config.Status.Ready:
146152
token := config.Spec.JoinConfiguration.Discovery.BootstrapToken.Token

0 commit comments

Comments
 (0)