Skip to content

Commit 173dd7d

Browse files
committed
pkg/asset/machines: capi v1beta1 -> v1beta2
Update CAPI references in machine packages to move off the deprecated v1beta1 packages to v1beta2.
1 parent 5ac8468 commit 173dd7d

File tree

13 files changed

+72
-78
lines changed

13 files changed

+72
-78
lines changed

pkg/asset/machines/arbiter.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"k8s.io/apimachinery/pkg/runtime"
1010
"k8s.io/apimachinery/pkg/runtime/serializer"
1111
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
12-
ipamv1 "sigs.k8s.io/cluster-api/api/ipam/v1beta1"
12+
ipamv1 "sigs.k8s.io/cluster-api/api/ipam/v1beta2"
1313
"sigs.k8s.io/yaml"
1414

1515
configv1 "github.com/openshift/api/config/v1"

pkg/asset/machines/aws/awsmachines.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,11 @@ import (
99
"strings"
1010

1111
"github.com/vincent-petithory/dataurl"
12-
v1 "k8s.io/api/core/v1"
1312
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1413
"k8s.io/apimachinery/pkg/util/sets"
1514
"k8s.io/utils/ptr"
1615
capa "sigs.k8s.io/cluster-api-provider-aws/v2/api/v1beta2"
17-
capi "sigs.k8s.io/cluster-api/api/core/v1beta1"
16+
capi "sigs.k8s.io/cluster-api/api/core/v1beta2"
1817

1918
"github.com/openshift/installer/pkg/asset"
2019
"github.com/openshift/installer/pkg/asset/installconfig"
@@ -156,10 +155,10 @@ func GenerateMachines(clusterID string, in *MachineInput) ([]*asset.RuntimeFile,
156155
Bootstrap: capi.Bootstrap{
157156
DataSecretName: ptr.To(fmt.Sprintf("%s-%s", clusterID, in.Role)),
158157
},
159-
InfrastructureRef: v1.ObjectReference{
160-
APIVersion: capa.GroupVersion.String(),
161-
Kind: "AWSMachine",
162-
Name: awsMachine.Name,
158+
InfrastructureRef: capi.ContractVersionedObjectReference{
159+
APIGroup: "infrastructure.cluster.x-k8s.io",
160+
Kind: "AWSMachine",
161+
Name: awsMachine.Name,
163162
},
164163
},
165164
}

pkg/asset/machines/azure/azuremachines.go

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,11 @@ import (
55
"fmt"
66
"strings"
77

8-
v1 "k8s.io/api/core/v1"
98
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
109
"k8s.io/apimachinery/pkg/util/sets"
1110
"k8s.io/utils/ptr"
1211
capz "sigs.k8s.io/cluster-api-provider-azure/api/v1beta1"
13-
capi "sigs.k8s.io/cluster-api/api/core/v1beta1"
12+
capi "sigs.k8s.io/cluster-api/api/core/v1beta2"
1413

1514
"github.com/openshift/api/machine/v1beta1"
1615
"github.com/openshift/installer/pkg/asset"
@@ -261,10 +260,10 @@ func GenerateMachines(clusterID, resourceGroup, subscriptionID string, session *
261260
Bootstrap: capi.Bootstrap{
262261
DataSecretName: ptr.To(fmt.Sprintf("%s-%s", clusterID, in.Role)),
263262
},
264-
InfrastructureRef: v1.ObjectReference{
265-
APIVersion: capz.GroupVersion.String(),
266-
Kind: "AzureMachine",
267-
Name: azureMachine.Name,
263+
InfrastructureRef: capi.ContractVersionedObjectReference{
264+
APIGroup: "infrastructure.cluster.x-k8s.io",
265+
Kind: "AzureMachine",
266+
Name: azureMachine.Name,
268267
},
269268
},
270269
}
@@ -336,10 +335,10 @@ func GenerateMachines(clusterID, resourceGroup, subscriptionID string, session *
336335
Bootstrap: capi.Bootstrap{
337336
DataSecretName: ptr.To(fmt.Sprintf("%s-%s", clusterID, "bootstrap")),
338337
},
339-
InfrastructureRef: v1.ObjectReference{
340-
APIVersion: capz.GroupVersion.String(),
341-
Kind: "AzureMachine",
342-
Name: bootstrapAzureMachine.Name,
338+
InfrastructureRef: capi.ContractVersionedObjectReference{
339+
APIGroup: "infrastructure.cluster.x-k8s.io",
340+
Kind: "AzureMachine",
341+
Name: bootstrapAzureMachine.Name,
343342
},
344343
},
345344
}

pkg/asset/machines/gcp/gcpmachines.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@ import (
66

77
"github.com/sirupsen/logrus"
88
compute "google.golang.org/api/compute/v1"
9-
v1 "k8s.io/api/core/v1"
109
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1110
"k8s.io/utils/ptr"
1211
capg "sigs.k8s.io/cluster-api-provider-gcp/api/v1beta1"
13-
capi "sigs.k8s.io/cluster-api/api/core/v1beta1"
12+
capi "sigs.k8s.io/cluster-api/api/core/v1beta2"
1413

1514
"github.com/openshift/installer/pkg/asset"
1615
"github.com/openshift/installer/pkg/asset/installconfig"
@@ -67,7 +66,7 @@ func GenerateMachines(installConfig *installconfig.InstallConfig, infraID string
6766
// When there are fewer zones than the number of control plane instances,
6867
// cycle through the zones where the instances will reside.
6968
zone := mpool.Zones[int(idx)%len(mpool.Zones)]
70-
capiMachine.Spec.FailureDomain = ptr.To(zone)
69+
capiMachine.Spec.FailureDomain = zone
7170
}
7271

7372
result = append(result, &asset.RuntimeFile{
@@ -203,10 +202,10 @@ func createCAPIMachine(name string, dataSecret string, infraID string) *capi.Mac
203202
Bootstrap: capi.Bootstrap{
204203
DataSecretName: ptr.To(dataSecret),
205204
},
206-
InfrastructureRef: v1.ObjectReference{
207-
APIVersion: capg.GroupVersion.String(),
208-
Kind: "GCPMachine",
209-
Name: name,
205+
InfrastructureRef: capi.ContractVersionedObjectReference{
206+
APIGroup: "infrastructure.cluster.x-k8s.io",
207+
Kind: "GCPMachine",
208+
Name: name,
210209
},
211210
},
212211
}

pkg/asset/machines/ibmcloud/capimachines.go

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@ import (
55
"fmt"
66

77
"github.com/IBM/vpc-go-sdk/vpcv1"
8-
v1 "k8s.io/api/core/v1"
98
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
109
"k8s.io/utils/ptr"
1110
capibmcloud "sigs.k8s.io/cluster-api-provider-ibmcloud/api/v1beta2"
12-
capi "sigs.k8s.io/cluster-api/api/core/v1beta1"
11+
capi "sigs.k8s.io/cluster-api/api/core/v1beta2"
1312

1413
"github.com/openshift/installer/pkg/asset"
1514
ibmcloudic "github.com/openshift/installer/pkg/asset/installconfig/ibmcloud"
@@ -186,10 +185,10 @@ func GenerateMachines(ctx context.Context, infraID string, config *types.Install
186185
Bootstrap: capi.Bootstrap{
187186
DataSecretName: ptr.To(fmt.Sprintf("%s-%s", infraID, role)),
188187
},
189-
InfrastructureRef: v1.ObjectReference{
190-
APIVersion: "infrastructure.cluster.x-k8s.io/v1beta1",
191-
Kind: "IBMVPCMachine",
192-
Name: capibmcloudMachine.Name,
188+
InfrastructureRef: capi.ContractVersionedObjectReference{
189+
APIGroup: "infrastructure.cluster.x-k8s.io",
190+
Kind: "IBMVPCMachine",
191+
Name: capibmcloudMachine.Name,
193192
},
194193
},
195194
}
@@ -238,10 +237,10 @@ func GenerateMachines(ctx context.Context, infraID string, config *types.Install
238237
Bootstrap: capi.Bootstrap{
239238
DataSecretName: ptr.To(fmt.Sprintf("%s-bootstrap", infraID)),
240239
},
241-
InfrastructureRef: v1.ObjectReference{
242-
APIVersion: "infrastructure.cluster.x-k8s.io/v1beta1",
243-
Kind: "IBMVPCMachine",
244-
Name: bootstrapMachine.Name,
240+
InfrastructureRef: capi.ContractVersionedObjectReference{
241+
APIGroup: "infrastructure.cluster.x-k8s.io",
242+
Kind: "IBMVPCMachine",
243+
Name: bootstrapMachine.Name,
245244
},
246245
},
247246
}

pkg/asset/machines/master.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1717
"k8s.io/apimachinery/pkg/runtime"
1818
"k8s.io/apimachinery/pkg/runtime/serializer"
19-
ipamv1 "sigs.k8s.io/cluster-api/api/ipam/v1beta1"
19+
ipamv1 "sigs.k8s.io/cluster-api/api/ipam/v1beta2"
2020
"sigs.k8s.io/yaml"
2121

2222
configv1 "github.com/openshift/api/config/v1"

pkg/asset/machines/nutanix/capimachines.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
v1 "k8s.io/api/core/v1"
99
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1010
"k8s.io/utils/ptr"
11-
capv1 "sigs.k8s.io/cluster-api/api/core/v1beta1"
11+
capv1 "sigs.k8s.io/cluster-api/api/core/v1beta2"
1212

1313
machinev1 "github.com/openshift/api/machine/v1"
1414
"github.com/openshift/installer/pkg/asset"
@@ -63,10 +63,10 @@ func GenerateMachines(clusterID string, config *types.InstallConfig, pool *types
6363
Bootstrap: capv1.Bootstrap{
6464
DataSecretName: ptr.To(ntxMachine.Name),
6565
},
66-
InfrastructureRef: v1.ObjectReference{
67-
APIVersion: "infrastructure.cluster.x-k8s.io/v1beta1",
68-
Kind: "NutanixMachine",
69-
Name: ntxMachine.Name,
66+
InfrastructureRef: capv1.ContractVersionedObjectReference{
67+
APIGroup: "infrastructure.cluster.x-k8s.io",
68+
Kind: "NutanixMachine",
69+
Name: ntxMachine.Name,
7070
},
7171
},
7272
}
@@ -120,10 +120,10 @@ func GenerateMachines(clusterID string, config *types.InstallConfig, pool *types
120120
Bootstrap: capv1.Bootstrap{
121121
DataSecretName: ptr.To(fmt.Sprintf("%s-bootstrap", clusterID)),
122122
},
123-
InfrastructureRef: v1.ObjectReference{
124-
APIVersion: "infrastructure.cluster.x-k8s.io/v1beta1",
125-
Kind: "NutanixMachine",
126-
Name: bootstrapNtxMachine.Name,
123+
InfrastructureRef: capv1.ContractVersionedObjectReference{
124+
APIGroup: "infrastructure.cluster.x-k8s.io",
125+
Kind: "NutanixMachine",
126+
Name: bootstrapNtxMachine.Name,
127127
},
128128
},
129129
}

pkg/asset/machines/openstack/openstackmachines.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@ package openstack
44
import (
55
"fmt"
66

7-
v1 "k8s.io/api/core/v1"
87
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
98
"k8s.io/utils/ptr"
109
capo "sigs.k8s.io/cluster-api-provider-openstack/api/v1beta1"
11-
capi "sigs.k8s.io/cluster-api/api/core/v1beta1"
10+
capi "sigs.k8s.io/cluster-api/api/core/v1beta2"
1211

1312
configv1 "github.com/openshift/api/config/v1"
1413
machinev1 "github.com/openshift/api/machine/v1"
@@ -95,12 +94,12 @@ func GenerateMachines(clusterID string, config *types.InstallConfig, pool *types
9594
Bootstrap: capi.Bootstrap{
9695
DataSecretName: ptr.To(fmt.Sprintf("%s-%s", clusterID, role)),
9796
},
98-
InfrastructureRef: v1.ObjectReference{
99-
APIVersion: capo.SchemeGroupVersion.String(),
100-
Kind: "OpenStackMachine",
101-
Name: openStackMachine.Name,
97+
InfrastructureRef: capi.ContractVersionedObjectReference{
98+
APIGroup: capo.SchemeGroupVersion.Group,
99+
Kind: "OpenStackMachine",
100+
Name: openStackMachine.Name,
102101
},
103-
FailureDomain: &failureDomain.AvailabilityZone,
102+
FailureDomain: failureDomain.AvailabilityZone,
104103
},
105104
}
106105
machine.SetGroupVersionKind(capi.GroupVersion.WithKind("Machine"))

pkg/asset/machines/powervs/powervsmachines.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ package powervs
44
import (
55
"fmt"
66

7-
v1 "k8s.io/api/core/v1"
7+
corev1 "k8s.io/api/core/v1"
88
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
99
"k8s.io/utils/ptr"
1010
capibm "sigs.k8s.io/cluster-api-provider-ibmcloud/api/v1beta2"
11-
capi "sigs.k8s.io/cluster-api/api/core/v1beta1"
11+
capi "sigs.k8s.io/cluster-api/api/core/v1beta2"
1212

1313
"github.com/openshift/installer/pkg/asset"
1414
"github.com/openshift/installer/pkg/asset/manifests/capiutils"
@@ -111,7 +111,7 @@ func GenerateMachine(ic *types.InstallConfig, service capibm.IBMPowerVSResourceR
111111
ServiceInstanceID: ic.PowerVS.ServiceInstanceGUID,
112112
ServiceInstance: &service,
113113
SSHKey: "",
114-
ImageRef: &v1.LocalObjectReference{
114+
ImageRef: &corev1.LocalObjectReference{
115115
Name: image,
116116
},
117117
SystemType: mpool.SysType,
@@ -140,10 +140,10 @@ func GenerateCAPIMachine(clusterID string, name string, dataSecret string) *capi
140140
Bootstrap: capi.Bootstrap{
141141
DataSecretName: ptr.To(dataSecret),
142142
},
143-
InfrastructureRef: v1.ObjectReference{
144-
APIVersion: capibm.GroupVersion.String(),
145-
Kind: "IBMPowerVSMachine",
146-
Name: name,
143+
InfrastructureRef: capi.ContractVersionedObjectReference{
144+
APIGroup: "infrastructure.cluster.x-k8s.io",
145+
Kind: "IBMPowerVSMachine",
146+
Name: name,
147147
},
148148
},
149149
}

pkg/asset/machines/vsphere/capimachines.go

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,11 @@ import (
88
"strings"
99

1010
"github.com/sirupsen/logrus"
11-
v1 "k8s.io/api/core/v1"
1211
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1312
"k8s.io/apimachinery/pkg/runtime"
1413
"k8s.io/utils/ptr"
1514
capv "sigs.k8s.io/cluster-api-provider-vsphere/apis/v1beta1"
16-
capi "sigs.k8s.io/cluster-api/api/core/v1beta1"
15+
capi "sigs.k8s.io/cluster-api/api/core/v1beta2"
1716

1817
machinev1 "github.com/openshift/api/machine/v1beta1"
1918
"github.com/openshift/installer/pkg/asset"
@@ -206,10 +205,10 @@ func GenerateMachines(ctx context.Context, clusterID string, config *types.Insta
206205
Bootstrap: capi.Bootstrap{
207206
DataSecretName: ptr.To(fmt.Sprintf("%s-%s", clusterID, role)),
208207
},
209-
InfrastructureRef: v1.ObjectReference{
210-
APIVersion: capv.GroupVersion.String(),
211-
Kind: "VSphereMachine",
212-
Name: vsphereMachine.Name,
208+
InfrastructureRef: capi.ContractVersionedObjectReference{
209+
APIGroup: "infrastructure.cluster.x-k8s.io",
210+
Kind: "VSphereMachine",
211+
Name: vsphereMachine.Name,
213212
},
214213
},
215214
}
@@ -273,10 +272,10 @@ func GenerateMachines(ctx context.Context, clusterID string, config *types.Insta
273272
Bootstrap: capi.Bootstrap{
274273
DataSecretName: ptr.To(fmt.Sprintf("%s-bootstrap", clusterID)),
275274
},
276-
InfrastructureRef: v1.ObjectReference{
277-
APIVersion: capv.GroupVersion.String(),
278-
Kind: "VSphereMachine",
279-
Name: bootstrapVSphereMachine.Name,
275+
InfrastructureRef: capi.ContractVersionedObjectReference{
276+
APIGroup: "infrastructure.cluster.x-k8s.io",
277+
Kind: "VSphereMachine",
278+
Name: bootstrapVSphereMachine.Name,
280279
},
281280
},
282281
}

0 commit comments

Comments
 (0)