Skip to content

Commit

Permalink
Merge pull request #8488 from k8s-infra-cherrypick-robot/cherry-pick-…
Browse files Browse the repository at this point in the history
…8481-to-release-1.4

[release-1.4] 🐛 Ensure nil-pointer check in KCP syncMachines
  • Loading branch information
k8s-ci-robot committed Apr 6, 2023
2 parents bc2766b + f1cca4b commit 6f96668
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion controlplane/kubeadm/internal/controllers/controller.go
Expand Up @@ -598,7 +598,10 @@ func (r *KubeadmControlPlaneReconciler) syncMachines(ctx context.Context, contro
return errors.Wrapf(err, "failed to update InfrastructureMachine %s", klog.KObj(infraMachine))
}

kubeadmConfig := controlPlane.KubeadmConfigs[machineName]
kubeadmConfig, ok := controlPlane.GetKubeadmConfig(machineName)
if !ok || kubeadmConfig == nil {
return errors.Wrapf(err, "failed to retrieve KubeadmConfig for machine %s", machineName)
}
// Note: Set the GroupVersionKind because updateExternalObject depends on it.
kubeadmConfig.SetGroupVersionKind(m.Spec.Bootstrap.ConfigRef.GroupVersionKind())
// Cleanup managed fields of all KubeadmConfigs to drop ownership of labels and annotations
Expand Down

0 comments on commit 6f96668

Please sign in to comment.