Skip to content

Commit 1cb0de4

Browse files
authored
Use proper api version (#466)
1 parent bc60f9e commit 1cb0de4

File tree

4 files changed

+18
-18
lines changed

4 files changed

+18
-18
lines changed

cloud/scope/cluster.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import (
3131
"sigs.k8s.io/cluster-api/util/patch"
3232
"sigs.k8s.io/controller-runtime/pkg/client"
3333

34-
infrav1 "sigs.k8s.io/cluster-api-provider-ibmcloud/api/v1alpha3"
34+
infrav1 "sigs.k8s.io/cluster-api-provider-ibmcloud/api/v1alpha4"
3535
)
3636

3737
// ClusterScopeParams defines the input parameters used to create a new ClusterScope.

cloud/scope/machine.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import (
3333
"sigs.k8s.io/cluster-api/util/patch"
3434
"sigs.k8s.io/controller-runtime/pkg/client"
3535

36-
infrav1 "sigs.k8s.io/cluster-api-provider-ibmcloud/api/v1alpha3"
36+
infrav1 "sigs.k8s.io/cluster-api-provider-ibmcloud/api/v1alpha4"
3737
)
3838

3939
// MachineScopeParams defines the input parameters used to create a new MachineScope.

controllers/ibmvpccluster_controller.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ import (
3535
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
3636
"sigs.k8s.io/controller-runtime/pkg/reconcile"
3737

38-
infrastructurev1alpha3 "sigs.k8s.io/cluster-api-provider-ibmcloud/api/v1alpha3"
38+
infrastructurev1alpha4 "sigs.k8s.io/cluster-api-provider-ibmcloud/api/v1alpha4"
3939
"sigs.k8s.io/cluster-api-provider-ibmcloud/cloud/scope"
4040
"sigs.k8s.io/cluster-api-provider-ibmcloud/pkg"
4141
)
@@ -57,7 +57,7 @@ func (r *IBMVPCClusterReconciler) Reconcile(ctx context.Context, req ctrl.Reques
5757

5858
// your logic here
5959
// Fetch the IBMVPCCluster instance
60-
ibmCluster := &infrastructurev1alpha3.IBMVPCCluster{}
60+
ibmCluster := &infrastructurev1alpha4.IBMVPCCluster{}
6161
err := r.Get(ctx, req.NamespacedName, ibmCluster)
6262
if err != nil {
6363
if apierrors.IsNotFound(err) {
@@ -111,8 +111,8 @@ func (r *IBMVPCClusterReconciler) Reconcile(ctx context.Context, req ctrl.Reques
111111
}
112112

113113
func (r *IBMVPCClusterReconciler) reconcile(ctx context.Context, clusterScope *scope.ClusterScope) (ctrl.Result, error) {
114-
if !controllerutil.ContainsFinalizer(clusterScope.IBMVPCCluster, infrastructurev1alpha3.ClusterFinalizer) {
115-
controllerutil.AddFinalizer(clusterScope.IBMVPCCluster, infrastructurev1alpha3.ClusterFinalizer)
114+
if !controllerutil.ContainsFinalizer(clusterScope.IBMVPCCluster, infrastructurev1alpha4.ClusterFinalizer) {
115+
controllerutil.AddFinalizer(clusterScope.IBMVPCCluster, infrastructurev1alpha4.ClusterFinalizer)
116116
//_ = r.Update(ctx, clusterScope.IBMVPCCluster)
117117
return ctrl.Result{}, nil
118118
}
@@ -122,7 +122,7 @@ func (r *IBMVPCClusterReconciler) reconcile(ctx context.Context, clusterScope *s
122122
return ctrl.Result{}, errors.Wrapf(err, "failed to reconcile VPC for IBMVPCCluster %s/%s", clusterScope.IBMVPCCluster.Namespace, clusterScope.IBMVPCCluster.Name)
123123
}
124124
if vpc != nil {
125-
clusterScope.IBMVPCCluster.Status.VPC = infrastructurev1alpha3.VPC{
125+
clusterScope.IBMVPCCluster.Status.VPC = infrastructurev1alpha4.VPC{
126126
ID: *vpc.ID,
127127
Name: *vpc.Name,
128128
}
@@ -140,7 +140,7 @@ func (r *IBMVPCClusterReconciler) reconcile(ctx context.Context, clusterScope *s
140140
Port: 6443,
141141
}
142142

143-
clusterScope.IBMVPCCluster.Status.APIEndpoint = infrastructurev1alpha3.APIEndpoint{
143+
clusterScope.IBMVPCCluster.Status.APIEndpoint = infrastructurev1alpha4.APIEndpoint{
144144
Address: fip.Address,
145145
FIPID: fip.ID,
146146
}
@@ -153,7 +153,7 @@ func (r *IBMVPCClusterReconciler) reconcile(ctx context.Context, clusterScope *s
153153
return ctrl.Result{}, errors.Wrapf(err, "failed to reconcile Subnet for IBMVPCCluster %s/%s", clusterScope.IBMVPCCluster.Namespace, clusterScope.IBMVPCCluster.Name)
154154
}
155155
if subnet != nil {
156-
clusterScope.IBMVPCCluster.Status.Subnet = infrastructurev1alpha3.Subnet{
156+
clusterScope.IBMVPCCluster.Status.Subnet = infrastructurev1alpha4.Subnet{
157157
Ipv4CidrBlock: subnet.Ipv4CIDRBlock,
158158
Name: subnet.Name,
159159
ID: subnet.ID,
@@ -191,14 +191,14 @@ func (r *IBMVPCClusterReconciler) reconcileDelete(clusterScope *scope.ClusterSco
191191
if err := clusterScope.DeleteVPC(); err != nil {
192192
return ctrl.Result{}, errors.Wrap(err, "failed to delete VPC")
193193
}
194-
controllerutil.RemoveFinalizer(clusterScope.IBMVPCCluster, infrastructurev1alpha3.ClusterFinalizer)
194+
controllerutil.RemoveFinalizer(clusterScope.IBMVPCCluster, infrastructurev1alpha4.ClusterFinalizer)
195195
return ctrl.Result{}, nil
196196
}
197197

198198
// SetupWithManager creates a new IBMVPCCluster controller for a manager.
199199
func (r *IBMVPCClusterReconciler) SetupWithManager(mgr ctrl.Manager) error {
200200
return ctrl.NewControllerManagedBy(mgr).
201-
For(&infrastructurev1alpha3.IBMVPCCluster{}).
201+
For(&infrastructurev1alpha4.IBMVPCCluster{}).
202202
WithEventFilter(predicates.ResourceIsNotExternallyManaged(ctrl.LoggerFrom(context.TODO()))).
203203
Complete(r)
204204
}

controllers/ibmvpcmachine_controller.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ import (
3636
"sigs.k8s.io/controller-runtime/pkg/client"
3737
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
3838

39-
infrastructurev1alpha3 "sigs.k8s.io/cluster-api-provider-ibmcloud/api/v1alpha3"
39+
infrastructurev1alpha4 "sigs.k8s.io/cluster-api-provider-ibmcloud/api/v1alpha4"
4040
"sigs.k8s.io/cluster-api-provider-ibmcloud/cloud/scope"
4141
"sigs.k8s.io/cluster-api-provider-ibmcloud/pkg"
4242
)
@@ -60,7 +60,7 @@ func (r *IBMVPCMachineReconciler) Reconcile(ctx context.Context, req ctrl.Reques
6060

6161
// Fetch the IBMVPCMachine instance.
6262

63-
ibmVpcMachine := &infrastructurev1alpha3.IBMVPCMachine{}
63+
ibmVpcMachine := &infrastructurev1alpha4.IBMVPCMachine{}
6464
err := r.Get(ctx, req.NamespacedName, ibmVpcMachine)
6565
if err != nil {
6666
if apierrors.IsNotFound(err) {
@@ -87,7 +87,7 @@ func (r *IBMVPCMachineReconciler) Reconcile(ctx context.Context, req ctrl.Reques
8787

8888
log = log.WithValues("cluster", cluster.Name)
8989

90-
ibmCluster := &infrastructurev1alpha3.IBMVPCCluster{}
90+
ibmCluster := &infrastructurev1alpha4.IBMVPCCluster{}
9191
ibmVpcClusterName := client.ObjectKey{
9292
Namespace: ibmVpcMachine.Namespace,
9393
Name: cluster.Spec.InfrastructureRef.Name,
@@ -137,12 +137,12 @@ func (r *IBMVPCMachineReconciler) Reconcile(ctx context.Context, req ctrl.Reques
137137
// SetupWithManager creates a new IBMVPCMachine controller for a manager.
138138
func (r *IBMVPCMachineReconciler) SetupWithManager(mgr ctrl.Manager) error {
139139
return ctrl.NewControllerManagedBy(mgr).
140-
For(&infrastructurev1alpha3.IBMVPCMachine{}).
140+
For(&infrastructurev1alpha4.IBMVPCMachine{}).
141141
Complete(r)
142142
}
143143

144144
func (r *IBMVPCMachineReconciler) reconcileNormal(ctx context.Context, machineScope *scope.MachineScope) (ctrl.Result, error) {
145-
controllerutil.AddFinalizer(machineScope.IBMVPCMachine, infrastructurev1alpha3.MachineFinalizer)
145+
controllerutil.AddFinalizer(machineScope.IBMVPCMachine, infrastructurev1alpha4.MachineFinalizer)
146146

147147
// Make sure bootstrap data is available and populated.
148148
if machineScope.Machine.Spec.Bootstrap.DataSecretName == nil {
@@ -151,7 +151,7 @@ func (r *IBMVPCMachineReconciler) reconcileNormal(ctx context.Context, machineSc
151151
}
152152

153153
if machineScope.IBMVPCCluster.Status.Subnet.ID != nil {
154-
machineScope.IBMVPCMachine.Spec.PrimaryNetworkInterface = infrastructurev1alpha3.NetworkInterface{
154+
machineScope.IBMVPCMachine.Spec.PrimaryNetworkInterface = infrastructurev1alpha4.NetworkInterface{
155155
Subnet: *machineScope.IBMVPCCluster.Status.Subnet.ID,
156156
}
157157
}
@@ -209,7 +209,7 @@ func (r *IBMVPCMachineReconciler) reconcileDelete(scope *scope.MachineScope) (_
209209
defer func() {
210210
if reterr == nil {
211211
// VSI is deleted so remove the finalizer.
212-
controllerutil.RemoveFinalizer(scope.IBMVPCMachine, infrastructurev1alpha3.MachineFinalizer)
212+
controllerutil.RemoveFinalizer(scope.IBMVPCMachine, infrastructurev1alpha4.MachineFinalizer)
213213
}
214214
}()
215215

0 commit comments

Comments
 (0)