Skip to content

Commit

Permalink
Merge pull request #1873 from vincepri/pivot-kubeadm-secret
Browse files Browse the repository at this point in the history
🐛 Handle CABPK secret case where status has been lost
  • Loading branch information
k8s-ci-robot committed Dec 10, 2019
2 parents 0eae5c6 + d0840ed commit e9ec746
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions bootstrap/kubeadm/controllers/kubeadmconfig_controller.go
Expand Up @@ -173,9 +173,11 @@ func (r *KubeadmConfigReconciler) Reconcile(req ctrl.Request) (_ ctrl.Result, re
// Return early if the configuration and Machine's infrastructure are ready.
case config.Status.Ready && machine.Status.InfrastructureReady:
return ctrl.Result{}, nil
// Reconcile status for machines that have already copied bootstrap data
case machine.Spec.Bootstrap.DataSecretName != nil && !config.Status.Ready:
// Reconcile status for machines that already have a secret reference, but our status isn't up to date.
// This case solves the pivoting scenario (or a backup restore) which doesn't preserve the status subresource on objects.
case machine.Spec.Bootstrap.DataSecretName != nil && (!config.Status.Ready || config.Status.DataSecretName == nil):
config.Status.Ready = true
config.Status.DataSecretName = machine.Spec.Bootstrap.DataSecretName
return ctrl.Result{}, patchHelper.Patch(ctx, config)
// 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
case config.Status.Ready && (config.Spec.JoinConfiguration != nil && config.Spec.JoinConfiguration.Discovery.BootstrapToken != nil):
Expand Down

0 comments on commit e9ec746

Please sign in to comment.