Skip to content

Commit

Permalink
Merge pull request #9099 from Anddd7/remove-disable-in-place-propagation
Browse files Browse the repository at this point in the history
🌱 Remove disableInPlacePropagation field in KCP controller
  • Loading branch information
k8s-ci-robot committed Aug 16, 2023
2 parents 4a3e325 + e1360e7 commit 8d0c60f
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 14 deletions.
12 changes: 2 additions & 10 deletions controlplane/kubeadm/internal/controllers/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,6 @@ type KubeadmControlPlaneReconciler struct {

managementCluster internal.ManagementCluster
managementClusterUncached internal.ManagementCluster

// disableInPlacePropagation should only be used for tests. This is used to skip
// some parts of the controller that need SSA as the current test setup does not
// support SSA. This flag should be dropped after all affected tests are migrated
// to envtest.
disableInPlacePropagation bool
ssaCache ssa.Cache
}

Expand Down Expand Up @@ -375,10 +369,8 @@ func (r *KubeadmControlPlaneReconciler) reconcile(ctx context.Context, controlPl
return result, err
}

if !r.disableInPlacePropagation {
if err := r.syncMachines(ctx, controlPlane); err != nil {
return ctrl.Result{}, errors.Wrap(err, "failed to sync Machines")
}
if err := r.syncMachines(ctx, controlPlane); err != nil {
return ctrl.Result{}, errors.Wrap(err, "failed to sync Machines")
}

// Aggregate the operational state of all the machines; while aggregating we are adding the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1332,7 +1332,7 @@ kubernetesVersion: metav1.16.1`,
Status: internal.ClusterStatus{},
},
},
disableInPlacePropagation: true,
ssaCache: ssa.NewCache(),
}

result, err := r.Reconcile(ctx, ctrl.Request{NamespacedName: util.ObjectKey(kcp)})
Expand Down
3 changes: 1 addition & 2 deletions controlplane/kubeadm/internal/controllers/scale_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,14 +213,13 @@ func TestKubeadmControlPlaneReconciler_scaleUpControlPlane(t *testing.T) {
managementCluster: fmc,
managementClusterUncached: fmc,
recorder: record.NewFakeRecorder(32),
disableInPlacePropagation: true,
}

controlPlane, adoptableMachineFound, err := r.initControlPlaneScope(ctx, cluster, kcp)
g.Expect(err).ToNot(HaveOccurred())
g.Expect(adoptableMachineFound).To(BeFalse())

result, err := r.reconcile(context.Background(), controlPlane)
result, err := r.scaleUpControlPlane(context.Background(), controlPlane)
g.Expect(err).ToNot(HaveOccurred())
g.Expect(result).To(Equal(ctrl.Result{RequeueAfter: preflightFailedRequeueAfter}))

Expand Down
3 changes: 2 additions & 1 deletion controlplane/kubeadm/internal/controllers/upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import (
bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1beta1"
"sigs.k8s.io/cluster-api/controlplane/kubeadm/internal"
"sigs.k8s.io/cluster-api/internal/test/builder"
"sigs.k8s.io/cluster-api/internal/util/ssa"
"sigs.k8s.io/cluster-api/util"
"sigs.k8s.io/cluster-api/util/collections"
)
Expand Down Expand Up @@ -93,7 +94,7 @@ func TestKubeadmControlPlaneReconciler_RolloutStrategy_ScaleUp(t *testing.T) {
Status: internal.ClusterStatus{Nodes: 1},
},
},
disableInPlacePropagation: true,
ssaCache: ssa.NewCache(),
}
controlPlane := &internal.ControlPlane{
KCP: kcp,
Expand Down

0 comments on commit 8d0c60f

Please sign in to comment.