@@ -33,12 +33,10 @@ import (
3333 "k8s.io/apimachinery/pkg/util/sets"
3434 "k8s.io/klog/v2"
3535 clusterv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1"
36- clusterv1 "sigs.k8s.io/cluster-api/api/v1beta2"
3736 inmemoryruntime "sigs.k8s.io/cluster-api/test/infrastructure/inmemory/pkg/runtime"
3837 inmemoryserver "sigs.k8s.io/cluster-api/test/infrastructure/inmemory/pkg/server"
3938 capiutil "sigs.k8s.io/cluster-api/util"
4039 "sigs.k8s.io/cluster-api/util/certs"
41- conditionsv1beta1 "sigs.k8s.io/cluster-api/util/conditions/deprecated/v1beta1"
4240 deprecatedconditions "sigs.k8s.io/cluster-api/util/deprecated/v1beta1/conditions"
4341 "sigs.k8s.io/cluster-api/util/secret"
4442 ctrl "sigs.k8s.io/controller-runtime"
@@ -147,7 +145,7 @@ type vmBootstrapReconciler struct {
147145 GetProviderID func () string
148146}
149147
150- func (r * vmBootstrapReconciler ) reconcileBoostrap (ctx context.Context , cluster * clusterv1 .Cluster , machine * clusterv1 .Machine , conditionsTracker ConditionsTracker ) (ctrl.Result , error ) {
148+ func (r * vmBootstrapReconciler ) reconcileBoostrap (ctx context.Context , cluster * clusterv1beta1 .Cluster , machine * clusterv1beta1 .Machine , conditionsTracker ConditionsTracker ) (ctrl.Result , error ) {
151149 log := ctrl .LoggerFrom (ctx )
152150
153151 if ! deprecatedconditions .Has (conditionsTracker , VMProvisionedCondition ) {
@@ -157,7 +155,7 @@ func (r *vmBootstrapReconciler) reconcileBoostrap(ctx context.Context, cluster *
157155 // Make sure bootstrap data is available and populated.
158156 // NOTE: we are not using bootstrap data, but we wait for it in order to simulate a real machine provisioning workflow.
159157 if machine .Spec .Bootstrap .DataSecretName == nil {
160- if ! util .IsControlPlaneMachine (machine ) && ! conditionsv1beta1 .IsTrue (cluster , clusterv1 . ControlPlaneInitializedV1Beta1Condition ) {
158+ if ! util .IsControlPlaneMachine (machine ) && ! deprecatedconditions .IsTrue (cluster , clusterv1beta1 . ControlPlaneInitializedCondition ) {
161159 deprecatedconditions .MarkFalse (conditionsTracker , VMProvisionedCondition , WaitingControlPlaneInitializedReason , clusterv1beta1 .ConditionSeverityInfo , "" )
162160 log .Info ("Waiting for the control plane to be initialized" )
163161 return reconcile.Result {RequeueAfter : 5 * time .Second }, nil // keep requeueing since we don't have a watch on machines // TODO: check if we can avoid this
@@ -178,7 +176,7 @@ func (r *vmBootstrapReconciler) reconcileBoostrap(ctx context.Context, cluster *
178176 }
179177
180178 // Call the inner reconciliation methods.
181- phases := []func (ctx context.Context , cluster * clusterv1 .Cluster , machine * clusterv1 .Machine , conditionsTracker ConditionsTracker ) (ctrl.Result , error ){
179+ phases := []func (ctx context.Context , cluster * clusterv1beta1 .Cluster , machine * clusterv1beta1 .Machine , conditionsTracker ConditionsTracker ) (ctrl.Result , error ){
182180 r .reconcileBoostrapNode ,
183181 r .reconcileBoostrapETCD ,
184182 r .reconcileBoostrapAPIServer ,
@@ -204,7 +202,7 @@ func (r *vmBootstrapReconciler) reconcileBoostrap(ctx context.Context, cluster *
204202 return res , kerrors .NewAggregate (errs )
205203}
206204
207- func (r * vmBootstrapReconciler ) reconcileBoostrapNode (ctx context.Context , cluster * clusterv1 .Cluster , machine * clusterv1 .Machine , conditionsTracker ConditionsTracker ) (ctrl.Result , error ) {
205+ func (r * vmBootstrapReconciler ) reconcileBoostrapNode (ctx context.Context , cluster * clusterv1beta1 .Cluster , machine * clusterv1beta1 .Machine , conditionsTracker ConditionsTracker ) (ctrl.Result , error ) {
208206 log := ctrl .LoggerFrom (ctx )
209207 nodeName := conditionsTracker .GetName ()
210208
@@ -289,7 +287,7 @@ func (r *vmBootstrapReconciler) reconcileBoostrapNode(ctx context.Context, clust
289287 return ctrl.Result {}, nil
290288}
291289
292- func (r * vmBootstrapReconciler ) reconcileBoostrapETCD (ctx context.Context , cluster * clusterv1 .Cluster , machine * clusterv1 .Machine , conditionsTracker ConditionsTracker ) (ctrl.Result , error ) {
290+ func (r * vmBootstrapReconciler ) reconcileBoostrapETCD (ctx context.Context , cluster * clusterv1beta1 .Cluster , machine * clusterv1beta1 .Machine , conditionsTracker ConditionsTracker ) (ctrl.Result , error ) {
293291 log := ctrl .LoggerFrom (ctx )
294292 etcdMember := fmt .Sprintf ("etcd-%s" , conditionsTracker .GetName ())
295293
@@ -433,7 +431,7 @@ func (r *vmBootstrapReconciler) reconcileBoostrapETCD(ctx context.Context, clust
433431 return ctrl.Result {}, nil
434432}
435433
436- func (r * vmBootstrapReconciler ) reconcileBoostrapAPIServer (ctx context.Context , cluster * clusterv1 .Cluster , machine * clusterv1 .Machine , conditionsTracker ConditionsTracker ) (ctrl.Result , error ) {
434+ func (r * vmBootstrapReconciler ) reconcileBoostrapAPIServer (ctx context.Context , cluster * clusterv1beta1 .Cluster , machine * clusterv1beta1 .Machine , conditionsTracker ConditionsTracker ) (ctrl.Result , error ) {
437435 log := ctrl .LoggerFrom (ctx )
438436 apiServer := fmt .Sprintf ("kube-apiserver-%s" , conditionsTracker .GetName ())
439437
@@ -542,7 +540,7 @@ func (r *vmBootstrapReconciler) reconcileBoostrapAPIServer(ctx context.Context,
542540 return ctrl.Result {}, nil
543541}
544542
545- func (r * vmBootstrapReconciler ) reconcileBoostrapScheduler (ctx context.Context , cluster * clusterv1 .Cluster , machine * clusterv1 .Machine , conditionsTracker ConditionsTracker ) (ctrl.Result , error ) {
543+ func (r * vmBootstrapReconciler ) reconcileBoostrapScheduler (ctx context.Context , cluster * clusterv1beta1 .Cluster , machine * clusterv1beta1 .Machine , conditionsTracker ConditionsTracker ) (ctrl.Result , error ) {
546544 // No-op if the machine is not a control plane machine.
547545 if ! util .IsControlPlaneMachine (machine ) {
548546 return ctrl.Result {}, nil
@@ -589,7 +587,7 @@ func (r *vmBootstrapReconciler) reconcileBoostrapScheduler(ctx context.Context,
589587 return ctrl.Result {}, nil
590588}
591589
592- func (r * vmBootstrapReconciler ) reconcileBoostrapControllerManager (ctx context.Context , cluster * clusterv1 .Cluster , machine * clusterv1 .Machine , conditionsTracker ConditionsTracker ) (ctrl.Result , error ) {
590+ func (r * vmBootstrapReconciler ) reconcileBoostrapControllerManager (ctx context.Context , cluster * clusterv1beta1 .Cluster , machine * clusterv1beta1 .Machine , conditionsTracker ConditionsTracker ) (ctrl.Result , error ) {
593591 // No-op if the machine is not a control plane machine.
594592 if ! util .IsControlPlaneMachine (machine ) {
595593 return ctrl.Result {}, nil
@@ -636,7 +634,7 @@ func (r *vmBootstrapReconciler) reconcileBoostrapControllerManager(ctx context.C
636634 return ctrl.Result {}, nil
637635}
638636
639- func (r * vmBootstrapReconciler ) reconcileBoostrapKubeadmObjects (ctx context.Context , cluster * clusterv1 .Cluster , machine * clusterv1 .Machine , _ ConditionsTracker ) (ctrl.Result , error ) {
637+ func (r * vmBootstrapReconciler ) reconcileBoostrapKubeadmObjects (ctx context.Context , cluster * clusterv1beta1 .Cluster , machine * clusterv1beta1 .Machine , _ ConditionsTracker ) (ctrl.Result , error ) {
640638 // No-op if the machine is not a control plane machine.
641639 if ! util .IsControlPlaneMachine (machine ) {
642640 return ctrl.Result {}, nil
@@ -703,7 +701,7 @@ func (r *vmBootstrapReconciler) reconcileBoostrapKubeadmObjects(ctx context.Cont
703701 return ctrl.Result {}, nil
704702}
705703
706- func (r * vmBootstrapReconciler ) reconcileBoostrapKubeProxy (ctx context.Context , cluster * clusterv1 .Cluster , machine * clusterv1 .Machine , _ ConditionsTracker ) (ctrl.Result , error ) {
704+ func (r * vmBootstrapReconciler ) reconcileBoostrapKubeProxy (ctx context.Context , cluster * clusterv1beta1 .Cluster , machine * clusterv1beta1 .Machine , _ ConditionsTracker ) (ctrl.Result , error ) {
707705 // No-op if the machine is not a control plane machine.
708706 if ! util .IsControlPlaneMachine (machine ) {
709707 return ctrl.Result {}, nil
@@ -749,7 +747,7 @@ func (r *vmBootstrapReconciler) reconcileBoostrapKubeProxy(ctx context.Context,
749747 return ctrl.Result {}, nil
750748}
751749
752- func (r * vmBootstrapReconciler ) reconcileBoostrapCoredns (ctx context.Context , cluster * clusterv1 .Cluster , machine * clusterv1 .Machine , _ ConditionsTracker ) (ctrl.Result , error ) {
750+ func (r * vmBootstrapReconciler ) reconcileBoostrapCoredns (ctx context.Context , cluster * clusterv1beta1 .Cluster , machine * clusterv1beta1 .Machine , _ ConditionsTracker ) (ctrl.Result , error ) {
753751 // No-op if the machine is not a control plane machine.
754752 if ! util .IsControlPlaneMachine (machine ) {
755753 return ctrl.Result {}, nil
@@ -812,9 +810,9 @@ func (r *vmBootstrapReconciler) reconcileBoostrapCoredns(ctx context.Context, cl
812810 return ctrl.Result {}, nil
813811}
814812
815- func (r * vmBootstrapReconciler ) reconcileDelete (ctx context.Context , cluster * clusterv1 .Cluster , machine * clusterv1 .Machine , conditionsTracker ConditionsTracker ) (ctrl.Result , error ) {
813+ func (r * vmBootstrapReconciler ) reconcileDelete (ctx context.Context , cluster * clusterv1beta1 .Cluster , machine * clusterv1beta1 .Machine , conditionsTracker ConditionsTracker ) (ctrl.Result , error ) {
816814 // Call the inner reconciliation methods.
817- phases := []func (ctx context.Context , cluster * clusterv1 .Cluster , machine * clusterv1 .Machine , conditionsTracker ConditionsTracker ) (ctrl.Result , error ){
815+ phases := []func (ctx context.Context , cluster * clusterv1beta1 .Cluster , machine * clusterv1beta1 .Machine , conditionsTracker ConditionsTracker ) (ctrl.Result , error ){
818816 r .reconcileDeleteNode ,
819817 r .reconcileDeleteETCD ,
820818 r .reconcileDeleteAPIServer ,
@@ -841,7 +839,7 @@ func (r *vmBootstrapReconciler) reconcileDelete(ctx context.Context, cluster *cl
841839 return res , kerrors .NewAggregate (errs )
842840}
843841
844- func (r * vmBootstrapReconciler ) reconcileDeleteNode (ctx context.Context , cluster * clusterv1 .Cluster , _ * clusterv1 .Machine , conditionsTracker ConditionsTracker ) (ctrl.Result , error ) {
842+ func (r * vmBootstrapReconciler ) reconcileDeleteNode (ctx context.Context , cluster * clusterv1beta1 .Cluster , _ * clusterv1beta1 .Machine , conditionsTracker ConditionsTracker ) (ctrl.Result , error ) {
845843 // Compute the resource group unique name.
846844 resourceGroup := klog .KObj (cluster ).String ()
847845 inmemoryClient := r .InMemoryManager .GetResourceGroup (resourceGroup ).GetClient ()
@@ -861,7 +859,7 @@ func (r *vmBootstrapReconciler) reconcileDeleteNode(ctx context.Context, cluster
861859 return ctrl.Result {}, nil
862860}
863861
864- func (r * vmBootstrapReconciler ) reconcileDeleteETCD (ctx context.Context , cluster * clusterv1 .Cluster , machine * clusterv1 .Machine , conditionsTracker ConditionsTracker ) (ctrl.Result , error ) {
862+ func (r * vmBootstrapReconciler ) reconcileDeleteETCD (ctx context.Context , cluster * clusterv1beta1 .Cluster , machine * clusterv1beta1 .Machine , conditionsTracker ConditionsTracker ) (ctrl.Result , error ) {
865863 // No-op if the machine is not a control plane machine.
866864 if ! util .IsControlPlaneMachine (machine ) {
867865 return ctrl.Result {}, nil
@@ -898,7 +896,7 @@ func (r *vmBootstrapReconciler) reconcileDeleteETCD(ctx context.Context, cluster
898896 return ctrl.Result {}, nil
899897}
900898
901- func (r * vmBootstrapReconciler ) reconcileDeleteAPIServer (ctx context.Context , cluster * clusterv1 .Cluster , machine * clusterv1 .Machine , conditionsTracker ConditionsTracker ) (ctrl.Result , error ) {
899+ func (r * vmBootstrapReconciler ) reconcileDeleteAPIServer (ctx context.Context , cluster * clusterv1beta1 .Cluster , machine * clusterv1beta1 .Machine , conditionsTracker ConditionsTracker ) (ctrl.Result , error ) {
902900 // No-op if the machine is not a control plane machine.
903901 if ! util .IsControlPlaneMachine (machine ) {
904902 return ctrl.Result {}, nil
@@ -930,7 +928,7 @@ func (r *vmBootstrapReconciler) reconcileDeleteAPIServer(ctx context.Context, cl
930928 return ctrl.Result {}, nil
931929}
932930
933- func (r * vmBootstrapReconciler ) reconcileDeleteScheduler (ctx context.Context , cluster * clusterv1 .Cluster , machine * clusterv1 .Machine , conditionsTracker ConditionsTracker ) (ctrl.Result , error ) {
931+ func (r * vmBootstrapReconciler ) reconcileDeleteScheduler (ctx context.Context , cluster * clusterv1beta1 .Cluster , machine * clusterv1beta1 .Machine , conditionsTracker ConditionsTracker ) (ctrl.Result , error ) {
934932 // No-op if the machine is not a control plane machine.
935933 if ! util .IsControlPlaneMachine (machine ) {
936934 return ctrl.Result {}, nil
@@ -953,7 +951,7 @@ func (r *vmBootstrapReconciler) reconcileDeleteScheduler(ctx context.Context, cl
953951 return ctrl.Result {}, nil
954952}
955953
956- func (r * vmBootstrapReconciler ) reconcileDeleteControllerManager (ctx context.Context , cluster * clusterv1 .Cluster , machine * clusterv1 .Machine , conditionsTracker ConditionsTracker ) (ctrl.Result , error ) {
954+ func (r * vmBootstrapReconciler ) reconcileDeleteControllerManager (ctx context.Context , cluster * clusterv1beta1 .Cluster , machine * clusterv1beta1 .Machine , conditionsTracker ConditionsTracker ) (ctrl.Result , error ) {
957955 // No-op if the machine is not a control plane machine.
958956 if ! util .IsControlPlaneMachine (machine ) {
959957 return ctrl.Result {}, nil
0 commit comments