Skip to content

Commit d2a13a0

Browse files
committed
KCP: Implement CanUpdateMachine
1 parent 4091401 commit d2a13a0

File tree

16 files changed

+692
-157
lines changed

16 files changed

+692
-157
lines changed

controlplane/kubeadm/controllers/alias.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,14 @@ import (
2727

2828
"sigs.k8s.io/cluster-api/controllers/clustercache"
2929
kubeadmcontrolplanecontrollers "sigs.k8s.io/cluster-api/controlplane/kubeadm/internal/controllers"
30+
runtimeclient "sigs.k8s.io/cluster-api/exp/runtime/client"
3031
)
3132

3233
// KubeadmControlPlaneReconciler reconciles a KubeadmControlPlane object.
3334
type KubeadmControlPlaneReconciler struct {
3435
Client client.Client
3536
SecretCachingClient client.Client
37+
RuntimeClient runtimeclient.Client
3638
ClusterCache clustercache.ClusterCache
3739

3840
EtcdDialTimeout time.Duration
@@ -50,6 +52,7 @@ func (r *KubeadmControlPlaneReconciler) SetupWithManager(ctx context.Context, mg
5052
return (&kubeadmcontrolplanecontrollers.KubeadmControlPlaneReconciler{
5153
Client: r.Client,
5254
SecretCachingClient: r.SecretCachingClient,
55+
RuntimeClient: r.RuntimeClient,
5356
ClusterCache: r.ClusterCache,
5457
EtcdDialTimeout: r.EtcdDialTimeout,
5558
EtcdCallTimeout: r.EtcdCallTimeout,

controlplane/kubeadm/internal/controllers/controller.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ import (
4646
clusterv1 "sigs.k8s.io/cluster-api/api/core/v1beta2"
4747
"sigs.k8s.io/cluster-api/controllers/clustercache"
4848
"sigs.k8s.io/cluster-api/controlplane/kubeadm/internal"
49+
runtimeclient "sigs.k8s.io/cluster-api/exp/runtime/client"
4950
"sigs.k8s.io/cluster-api/feature"
5051
"sigs.k8s.io/cluster-api/internal/contract"
5152
"sigs.k8s.io/cluster-api/internal/util/ssa"
@@ -80,6 +81,7 @@ const (
8081
type KubeadmControlPlaneReconciler struct {
8182
Client client.Client
8283
SecretCachingClient client.Client
84+
RuntimeClient runtimeclient.Client
8385
controller controller.Controller
8486
recorder record.EventRecorder
8587
ClusterCache clustercache.ClusterCache
@@ -115,6 +117,9 @@ func (r *KubeadmControlPlaneReconciler) SetupWithManager(ctx context.Context, mg
115117
"EtcdDialTimeout and EtcdCallTimeout must not be 0 and " +
116118
"RemoteConditionsGracePeriod must not be < 2m")
117119
}
120+
if feature.Gates.Enabled(feature.InPlaceUpdates) && r.RuntimeClient == nil {
121+
return errors.New("RuntimeClient must not be nil when InPlaceUpdates feature gate is enabled")
122+
}
118123

119124
predicateLog := ctrl.LoggerFrom(ctx).WithValues("controller", "kubeadmcontrolplane")
120125
c, err := ctrl.NewControllerManagedBy(mgr).

0 commit comments

Comments
 (0)