Skip to content

Commit 1d99742

Browse files
authored
Merge pull request #8912 from sbueringer/pr-kcp-drop-redundant-get-machines
🌱 KCP: drop redundant get machines
2 parents 083fc31 + b1f79c0 commit 1d99742

File tree

1 file changed

+0
-14
lines changed
  • controlplane/kubeadm/internal/controllers

1 file changed

+0
-14
lines changed

controlplane/kubeadm/internal/controllers/scale.go

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -38,20 +38,6 @@ import (
3838
func (r *KubeadmControlPlaneReconciler) initializeControlPlane(ctx context.Context, controlPlane *internal.ControlPlane) (ctrl.Result, error) {
3939
logger := ctrl.LoggerFrom(ctx)
4040

41-
// Perform an uncached read of all the owned machines. This check is in place to make sure
42-
// that the controller cache is not misbehaving and we end up initializing the cluster more than once.
43-
ownedMachines, err := r.managementClusterUncached.GetMachinesForCluster(ctx, controlPlane.Cluster, collections.OwnedMachines(controlPlane.KCP))
44-
if err != nil {
45-
logger.Error(err, "failed to perform an uncached read of control plane machines for cluster")
46-
return ctrl.Result{}, err
47-
}
48-
if len(ownedMachines) > 0 {
49-
return ctrl.Result{}, errors.Errorf(
50-
"control plane has already been initialized, found %d owned machine for cluster %s: controller cache or management cluster is misbehaving",
51-
len(ownedMachines), klog.KObj(controlPlane.Cluster),
52-
)
53-
}
54-
5541
bootstrapSpec := controlPlane.InitialControlPlaneConfig()
5642
fd := controlPlane.NextFailureDomainForScaleUp()
5743
if err := r.cloneConfigsAndGenerateMachine(ctx, controlPlane.Cluster, controlPlane.KCP, bootstrapSpec, fd); err != nil {

0 commit comments

Comments
 (0)