Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🌱 Remove disableInPlacePropagation field in KCP controller #9099

Merged
merged 1 commit into from
Aug 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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