Skip to content

Commit

Permalink
Ensure nil-pointer check in KCP syncMachines
Browse files Browse the repository at this point in the history
Signed-off-by: killianmuldoon <kmuldoon@vmware.com>
  • Loading branch information
killianmuldoon authored and k8s-infra-cherrypick-robot committed Apr 6, 2023
1 parent bc2766b commit f1cca4b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion controlplane/kubeadm/internal/controllers/controller.go
Original file line number Diff line number Diff line change
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 f1cca4b

Please sign in to comment.