Skip to content

Commit f856b58

Browse files
committed
depreciation warning added and changed imports from infrav1alpha to infrav1
1 parent 1cbf62f commit f856b58

13 files changed

+80
-68
lines changed

api/v1beta1/azureasomanagedcluster_types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ type StatusResource struct {
6969
// +kubebuilder:object:root=true
7070
// +kubebuilder:subresource:status
7171
// +kubebuilder:storageversion
72+
// +kubebuilder:deprecatedversion:warning="infrastructure.cluster.x-k8s.io/v1alpha1 AzureASOManagedCluster is deprecated. infrastructure.cluster.x-k8s.io/v1beta1 is equivalent and should be used instead."
7273

7374
// AzureASOManagedCluster is the Schema for the azureasomanagedclusters API.
7475
type AzureASOManagedCluster struct {

api/v1beta1/azureasomanagedcontrolplane_types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ type AzureASOManagedControlPlaneStatus struct {
5757
// +kubebuilder:object:root=true
5858
// +kubebuilder:subresource:status
5959
// +kubebuilder:storageversion
60+
// +kubebuilder:deprecatedversion:warning="infrastructure.cluster.x-k8s.io/v1alpha1 AzureASOManagedControlPlane is deprecated. infrastructure.cluster.x-k8s.io/v1beta1 is equivalent and should be used instead."
6061

6162
// AzureASOManagedControlPlane is the Schema for the azureasomanagedcontrolplanes API.
6263
type AzureASOManagedControlPlane struct {

api/v1beta1/azureasomanagedmachinepool_types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ type AzureASOManagedMachinePoolStatus struct {
5252
// +kubebuilder:object:root=true
5353
// +kubebuilder:subresource:status
5454
// +kubebuilder:storageversion
55+
//+kubebuilder:deprecatedversion:warning="infrastructure.cluster.x-k8s.io/v1alpha1 AzureASOManagedMachinePool is deprecated. infrastructure.cluster.x-k8s.io/v1beta1 is equivalent and should be used instead."
5556

5657
// AzureASOManagedMachinePool is the Schema for the azureasomanagedmachinepools API.
5758
type AzureASOManagedMachinePool struct {

config/crd/bases/infrastructure.cluster.x-k8s.io_azureasomanagedclusters.yaml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,11 @@ spec:
110110
storage: false
111111
subresources:
112112
status: {}
113-
- name: v1beta1
113+
- deprecated: true
114+
deprecationWarning: infrastructure.cluster.x-k8s.io/v1alpha1 AzureASOManagedCluster
115+
is deprecated. infrastructure.cluster.x-k8s.io/v1beta1 is equivalent and should
116+
be used instead.
117+
name: v1beta1
114118
schema:
115119
openAPIV3Schema:
116120
description: AzureASOManagedCluster is the Schema for the azureasomanagedclusters
@@ -144,10 +148,11 @@ spec:
144148
in the API schema to permit resource admission.
145149
properties:
146150
host:
147-
description: The hostname on which the API server is serving.
151+
description: host is the hostname on which the API server is serving.
152+
maxLength: 512
148153
type: string
149154
port:
150-
description: The port on which the API server is serving.
155+
description: port is the port on which the API server is serving.
151156
format: int32
152157
type: integer
153158
required:

config/crd/bases/infrastructure.cluster.x-k8s.io_azureasomanagedcontrolplanes.yaml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,11 @@ spec:
123123
storage: false
124124
subresources:
125125
status: {}
126-
- name: v1beta1
126+
- deprecated: true
127+
deprecationWarning: infrastructure.cluster.x-k8s.io/v1alpha1 AzureASOManagedControlPlane
128+
is deprecated. infrastructure.cluster.x-k8s.io/v1beta1 is equivalent and should
129+
be used instead.
130+
name: v1beta1
127131
schema:
128132
openAPIV3Schema:
129133
description: AzureASOManagedControlPlane is the Schema for the azureasomanagedcontrolplanes
@@ -172,10 +176,11 @@ spec:
172176
cluster's API server.
173177
properties:
174178
host:
175-
description: The hostname on which the API server is serving.
179+
description: host is the hostname on which the API server is serving.
180+
maxLength: 512
176181
type: string
177182
port:
178-
description: The port on which the API server is serving.
183+
description: port is the port on which the API server is serving.
179184
format: int32
180185
type: integer
181186
required:

config/crd/bases/infrastructure.cluster.x-k8s.io_azureasomanagedmachinepools.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,11 @@ spec:
105105
storage: false
106106
subresources:
107107
status: {}
108-
- name: v1beta1
108+
- deprecated: true
109+
deprecationWarning: infrastructure.cluster.x-k8s.io/v1alpha1 AzureASOManagedMachinePool
110+
is deprecated. infrastructure.cluster.x-k8s.io/v1beta1 is equivalent and should
111+
be used instead.
112+
name: v1beta1
109113
schema:
110114
openAPIV3Schema:
111115
description: AzureASOManagedMachinePool is the Schema for the azureasomanagedmachinepools

main.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ import (
5858
"sigs.k8s.io/controller-runtime/pkg/manager"
5959
"sigs.k8s.io/controller-runtime/pkg/webhook"
6060

61-
infrav1alpha "sigs.k8s.io/cluster-api-provider-azure/api/v1alpha1"
6261
infrav1 "sigs.k8s.io/cluster-api-provider-azure/api/v1beta1"
6362
"sigs.k8s.io/cluster-api-provider-azure/azure"
6463
"sigs.k8s.io/cluster-api-provider-azure/controllers"
@@ -80,7 +79,7 @@ func init() {
8079
_ = clientgoscheme.AddToScheme(scheme)
8180
_ = infrav1.AddToScheme(scheme)
8281
_ = infrav1exp.AddToScheme(scheme)
83-
_ = infrav1alpha.AddToScheme(scheme)
82+
_ = infrav1.AddToScheme(scheme)
8483
_ = clusterv1.AddToScheme(scheme)
8584
_ = expv1.AddToScheme(scheme)
8685
_ = kubeadmv1.AddToScheme(scheme)

pkg/mutators/azureasomanagedcontrolplane_test.go

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

39-
infrav1alpha "sigs.k8s.io/cluster-api-provider-azure/api/v1alpha1"
39+
infrav1 "sigs.k8s.io/cluster-api-provider-azure/api/v1beta1"
4040
)
4141

4242
func TestSetManagedClusterDefaults(t *testing.T) {
@@ -45,16 +45,16 @@ func TestSetManagedClusterDefaults(t *testing.T) {
4545

4646
tests := []struct {
4747
name string
48-
asoManagedControlPlane *infrav1alpha.AzureASOManagedControlPlane
48+
asoManagedControlPlane *infrav1.AzureASOManagedControlPlane
4949
cluster *clusterv1.Cluster
5050
expected []*unstructured.Unstructured
5151
expectedErr error
5252
}{
5353
{
5454
name: "no ManagedCluster",
55-
asoManagedControlPlane: &infrav1alpha.AzureASOManagedControlPlane{
56-
Spec: infrav1alpha.AzureASOManagedControlPlaneSpec{
57-
AzureASOManagedControlPlaneTemplateResourceSpec: infrav1alpha.AzureASOManagedControlPlaneTemplateResourceSpec{
55+
asoManagedControlPlane: &infrav1.AzureASOManagedControlPlane{
56+
Spec: infrav1.AzureASOManagedControlPlaneSpec{
57+
AzureASOManagedControlPlaneTemplateResourceSpec: infrav1.AzureASOManagedControlPlaneTemplateResourceSpec{
5858
Resources: []runtime.RawExtension{},
5959
},
6060
},
@@ -63,9 +63,9 @@ func TestSetManagedClusterDefaults(t *testing.T) {
6363
},
6464
{
6565
name: "success",
66-
asoManagedControlPlane: &infrav1alpha.AzureASOManagedControlPlane{
67-
Spec: infrav1alpha.AzureASOManagedControlPlaneSpec{
68-
AzureASOManagedControlPlaneTemplateResourceSpec: infrav1alpha.AzureASOManagedControlPlaneTemplateResourceSpec{
66+
asoManagedControlPlane: &infrav1.AzureASOManagedControlPlane{
67+
Spec: infrav1.AzureASOManagedControlPlaneSpec{
68+
AzureASOManagedControlPlaneTemplateResourceSpec: infrav1.AzureASOManagedControlPlaneTemplateResourceSpec{
6969
Version: "vCAPI k8s version",
7070
Resources: []runtime.RawExtension{
7171
{
@@ -118,7 +118,7 @@ func TestSetManagedClusterDefaults(t *testing.T) {
118118

119119
s := runtime.NewScheme()
120120
g.Expect(asocontainerservicev1.AddToScheme(s)).To(Succeed())
121-
g.Expect(infrav1alpha.AddToScheme(s)).To(Succeed())
121+
g.Expect(infrav1.AddToScheme(s)).To(Succeed())
122122
c := fakeclient.NewClientBuilder().
123123
WithScheme(s).
124124
Build()
@@ -140,14 +140,14 @@ func TestSetManagedClusterKubernetesVersion(t *testing.T) {
140140

141141
tests := []struct {
142142
name string
143-
asoManagedControlPlane *infrav1alpha.AzureASOManagedControlPlane
143+
asoManagedControlPlane *infrav1.AzureASOManagedControlPlane
144144
managedCluster *asocontainerservicev1.ManagedCluster
145145
expected *asocontainerservicev1.ManagedCluster
146146
expectedErr error
147147
}{
148148
{
149149
name: "no CAPI opinion",
150-
asoManagedControlPlane: &infrav1alpha.AzureASOManagedControlPlane{},
150+
asoManagedControlPlane: &infrav1.AzureASOManagedControlPlane{},
151151
managedCluster: &asocontainerservicev1.ManagedCluster{
152152
Spec: asocontainerservicev1.ManagedCluster_Spec{
153153
KubernetesVersion: ptr.To("user k8s version"),
@@ -161,9 +161,9 @@ func TestSetManagedClusterKubernetesVersion(t *testing.T) {
161161
},
162162
{
163163
name: "set from CAPI opinion",
164-
asoManagedControlPlane: &infrav1alpha.AzureASOManagedControlPlane{
165-
Spec: infrav1alpha.AzureASOManagedControlPlaneSpec{
166-
AzureASOManagedControlPlaneTemplateResourceSpec: infrav1alpha.AzureASOManagedControlPlaneTemplateResourceSpec{
164+
asoManagedControlPlane: &infrav1.AzureASOManagedControlPlane{
165+
Spec: infrav1.AzureASOManagedControlPlaneSpec{
166+
AzureASOManagedControlPlaneTemplateResourceSpec: infrav1.AzureASOManagedControlPlaneTemplateResourceSpec{
167167
Version: "vCAPI k8s version",
168168
},
169169
},
@@ -177,9 +177,9 @@ func TestSetManagedClusterKubernetesVersion(t *testing.T) {
177177
},
178178
{
179179
name: "user value matching CAPI ok",
180-
asoManagedControlPlane: &infrav1alpha.AzureASOManagedControlPlane{
181-
Spec: infrav1alpha.AzureASOManagedControlPlaneSpec{
182-
AzureASOManagedControlPlaneTemplateResourceSpec: infrav1alpha.AzureASOManagedControlPlaneTemplateResourceSpec{
180+
asoManagedControlPlane: &infrav1.AzureASOManagedControlPlane{
181+
Spec: infrav1.AzureASOManagedControlPlaneSpec{
182+
AzureASOManagedControlPlaneTemplateResourceSpec: infrav1.AzureASOManagedControlPlaneTemplateResourceSpec{
183183
Version: "vCAPI k8s version",
184184
},
185185
},
@@ -197,9 +197,9 @@ func TestSetManagedClusterKubernetesVersion(t *testing.T) {
197197
},
198198
{
199199
name: "incompatible",
200-
asoManagedControlPlane: &infrav1alpha.AzureASOManagedControlPlane{
201-
Spec: infrav1alpha.AzureASOManagedControlPlaneSpec{
202-
AzureASOManagedControlPlaneTemplateResourceSpec: infrav1alpha.AzureASOManagedControlPlaneTemplateResourceSpec{
200+
asoManagedControlPlane: &infrav1.AzureASOManagedControlPlane{
201+
Spec: infrav1.AzureASOManagedControlPlaneSpec{
202+
AzureASOManagedControlPlaneTemplateResourceSpec: infrav1.AzureASOManagedControlPlaneTemplateResourceSpec{
203203
Version: "vCAPI k8s version",
204204
},
205205
},
@@ -508,7 +508,7 @@ func TestSetManagedClusterAgentPoolProfiles(t *testing.T) {
508508
ctx := context.Background()
509509
s := runtime.NewScheme()
510510
g.Expect(asocontainerservicev1.AddToScheme(s)).To(Succeed())
511-
g.Expect(infrav1alpha.AddToScheme(s)).To(Succeed())
511+
g.Expect(infrav1.AddToScheme(s)).To(Succeed())
512512
g.Expect(expv1.AddToScheme(s)).To(Succeed())
513513
fakeClientBuilder := func() *fakeclient.ClientBuilder {
514514
return fakeclient.NewClientBuilder().WithScheme(s)
@@ -565,8 +565,8 @@ func TestSetManagedClusterAgentPoolProfiles(t *testing.T) {
565565
managedCluster := &asocontainerservicev1.ManagedCluster{}
566566
umc := mcUnstructured(g, managedCluster)
567567

568-
asoManagedMachinePools := &infrav1alpha.AzureASOManagedMachinePoolList{
569-
Items: []infrav1alpha.AzureASOManagedMachinePool{
568+
asoManagedMachinePools := &infrav1.AzureASOManagedMachinePoolList{
569+
Items: []infrav1.AzureASOManagedMachinePool{
570570
{
571571
ObjectMeta: metav1.ObjectMeta{
572572
Name: "wrong-label",
@@ -582,8 +582,8 @@ func TestSetManagedClusterAgentPoolProfiles(t *testing.T) {
582582
},
583583
},
584584
},
585-
Spec: infrav1alpha.AzureASOManagedMachinePoolSpec{
586-
AzureASOManagedMachinePoolTemplateResourceSpec: infrav1alpha.AzureASOManagedMachinePoolTemplateResourceSpec{
585+
Spec: infrav1.AzureASOManagedMachinePoolSpec{
586+
AzureASOManagedMachinePoolTemplateResourceSpec: infrav1.AzureASOManagedMachinePoolTemplateResourceSpec{
587587
Resources: []runtime.RawExtension{
588588
{
589589
Raw: apJSON(g, &asocontainerservicev1.ManagedClustersAgentPool{
@@ -611,8 +611,8 @@ func TestSetManagedClusterAgentPoolProfiles(t *testing.T) {
611611
},
612612
},
613613
},
614-
Spec: infrav1alpha.AzureASOManagedMachinePoolSpec{
615-
AzureASOManagedMachinePoolTemplateResourceSpec: infrav1alpha.AzureASOManagedMachinePoolTemplateResourceSpec{
614+
Spec: infrav1.AzureASOManagedMachinePoolSpec{
615+
AzureASOManagedMachinePoolTemplateResourceSpec: infrav1.AzureASOManagedMachinePoolTemplateResourceSpec{
616616
Resources: []runtime.RawExtension{
617617
{
618618
Raw: apJSON(g, &asocontainerservicev1.ManagedClustersAgentPool{
@@ -640,8 +640,8 @@ func TestSetManagedClusterAgentPoolProfiles(t *testing.T) {
640640
},
641641
},
642642
},
643-
Spec: infrav1alpha.AzureASOManagedMachinePoolSpec{
644-
AzureASOManagedMachinePoolTemplateResourceSpec: infrav1alpha.AzureASOManagedMachinePoolTemplateResourceSpec{
643+
Spec: infrav1.AzureASOManagedMachinePoolSpec{
644+
AzureASOManagedMachinePoolTemplateResourceSpec: infrav1.AzureASOManagedMachinePoolTemplateResourceSpec{
645645
Resources: []runtime.RawExtension{
646646
{
647647
Raw: apJSON(g, &asocontainerservicev1.ManagedClustersAgentPool{
@@ -669,8 +669,8 @@ func TestSetManagedClusterAgentPoolProfiles(t *testing.T) {
669669
},
670670
},
671671
},
672-
Spec: infrav1alpha.AzureASOManagedMachinePoolSpec{
673-
AzureASOManagedMachinePoolTemplateResourceSpec: infrav1alpha.AzureASOManagedMachinePoolTemplateResourceSpec{
672+
Spec: infrav1.AzureASOManagedMachinePoolSpec{
673+
AzureASOManagedMachinePoolTemplateResourceSpec: infrav1.AzureASOManagedMachinePoolTemplateResourceSpec{
674674
Resources: []runtime.RawExtension{
675675
{
676676
Raw: apJSON(g, &asocontainerservicev1.ManagedClustersAgentPool{

pkg/mutators/azureasomanagedmachinepool_test.go

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import (
3333
"sigs.k8s.io/controller-runtime/pkg/client"
3434
fakeclient "sigs.k8s.io/controller-runtime/pkg/client/fake"
3535

36-
infrav1alpha "sigs.k8s.io/cluster-api-provider-azure/api/v1alpha1"
36+
infrav1 "sigs.k8s.io/cluster-api-provider-azure/api/v1beta1"
3737
)
3838

3939
func TestSetAgentPoolDefaults(t *testing.T) {
@@ -42,16 +42,16 @@ func TestSetAgentPoolDefaults(t *testing.T) {
4242

4343
tests := []struct {
4444
name string
45-
asoManagedMachinePool *infrav1alpha.AzureASOManagedMachinePool
45+
asoManagedMachinePool *infrav1.AzureASOManagedMachinePool
4646
machinePool *expv1.MachinePool
4747
expected []*unstructured.Unstructured
4848
expectedErr error
4949
}{
5050
{
5151
name: "no ManagedClustersAgentPool",
52-
asoManagedMachinePool: &infrav1alpha.AzureASOManagedMachinePool{
53-
Spec: infrav1alpha.AzureASOManagedMachinePoolSpec{
54-
AzureASOManagedMachinePoolTemplateResourceSpec: infrav1alpha.AzureASOManagedMachinePoolTemplateResourceSpec{
52+
asoManagedMachinePool: &infrav1.AzureASOManagedMachinePool{
53+
Spec: infrav1.AzureASOManagedMachinePoolSpec{
54+
AzureASOManagedMachinePoolTemplateResourceSpec: infrav1.AzureASOManagedMachinePoolTemplateResourceSpec{
5555
Resources: []runtime.RawExtension{},
5656
},
5757
},
@@ -60,9 +60,9 @@ func TestSetAgentPoolDefaults(t *testing.T) {
6060
},
6161
{
6262
name: "success",
63-
asoManagedMachinePool: &infrav1alpha.AzureASOManagedMachinePool{
64-
Spec: infrav1alpha.AzureASOManagedMachinePoolSpec{
65-
AzureASOManagedMachinePoolTemplateResourceSpec: infrav1alpha.AzureASOManagedMachinePoolTemplateResourceSpec{
63+
asoManagedMachinePool: &infrav1.AzureASOManagedMachinePool{
64+
Spec: infrav1.AzureASOManagedMachinePoolSpec{
65+
AzureASOManagedMachinePoolTemplateResourceSpec: infrav1.AzureASOManagedMachinePoolTemplateResourceSpec{
6666
Resources: []runtime.RawExtension{
6767
{
6868
Raw: apJSON(g, &asocontainerservicev1.ManagedClustersAgentPool{}),
@@ -251,7 +251,7 @@ func TestReconcileAutoscaling(t *testing.T) {
251251
machinePool: &expv1.MachinePool{
252252
ObjectMeta: metav1.ObjectMeta{
253253
Annotations: map[string]string{
254-
clusterv1.ReplicasManagedByAnnotation: infrav1alpha.ReplicasManagedByAKS,
254+
clusterv1.ReplicasManagedByAnnotation: infrav1.ReplicasManagedByAKS,
255255
},
256256
},
257257
},
@@ -267,14 +267,14 @@ func TestReconcileAutoscaling(t *testing.T) {
267267
machinePool: &expv1.MachinePool{
268268
ObjectMeta: metav1.ObjectMeta{
269269
Annotations: map[string]string{
270-
clusterv1.ReplicasManagedByAnnotation: "not-" + infrav1alpha.ReplicasManagedByAKS,
270+
clusterv1.ReplicasManagedByAnnotation: "not-" + infrav1.ReplicasManagedByAKS,
271271
},
272272
},
273273
},
274274
expected: &expv1.MachinePool{
275275
ObjectMeta: metav1.ObjectMeta{
276276
Annotations: map[string]string{
277-
clusterv1.ReplicasManagedByAnnotation: "not-" + infrav1alpha.ReplicasManagedByAKS,
277+
clusterv1.ReplicasManagedByAnnotation: "not-" + infrav1.ReplicasManagedByAKS,
278278
},
279279
},
280280
},
@@ -290,7 +290,7 @@ func TestReconcileAutoscaling(t *testing.T) {
290290
expected: &expv1.MachinePool{
291291
ObjectMeta: metav1.ObjectMeta{
292292
Annotations: map[string]string{
293-
clusterv1.ReplicasManagedByAnnotation: infrav1alpha.ReplicasManagedByAKS,
293+
clusterv1.ReplicasManagedByAnnotation: infrav1.ReplicasManagedByAKS,
294294
},
295295
},
296296
},
@@ -301,14 +301,14 @@ func TestReconcileAutoscaling(t *testing.T) {
301301
machinePool: &expv1.MachinePool{
302302
ObjectMeta: metav1.ObjectMeta{
303303
Annotations: map[string]string{
304-
clusterv1.ReplicasManagedByAnnotation: infrav1alpha.ReplicasManagedByAKS,
304+
clusterv1.ReplicasManagedByAnnotation: infrav1.ReplicasManagedByAKS,
305305
},
306306
},
307307
},
308308
expected: &expv1.MachinePool{
309309
ObjectMeta: metav1.ObjectMeta{
310310
Annotations: map[string]string{
311-
clusterv1.ReplicasManagedByAnnotation: infrav1alpha.ReplicasManagedByAKS,
311+
clusterv1.ReplicasManagedByAnnotation: infrav1.ReplicasManagedByAKS,
312312
},
313313
},
314314
},
@@ -320,7 +320,7 @@ func TestReconcileAutoscaling(t *testing.T) {
320320
ObjectMeta: metav1.ObjectMeta{
321321
Name: "mp",
322322
Annotations: map[string]string{
323-
clusterv1.ReplicasManagedByAnnotation: "not-" + infrav1alpha.ReplicasManagedByAKS,
323+
clusterv1.ReplicasManagedByAnnotation: "not-" + infrav1.ReplicasManagedByAKS,
324324
},
325325
},
326326
},
@@ -384,7 +384,7 @@ func TestSetAgentPoolCount(t *testing.T) {
384384
machinePool: &expv1.MachinePool{
385385
ObjectMeta: metav1.ObjectMeta{
386386
Annotations: map[string]string{
387-
clusterv1.ReplicasManagedByAnnotation: infrav1alpha.ReplicasManagedByAKS,
387+
clusterv1.ReplicasManagedByAnnotation: infrav1.ReplicasManagedByAKS,
388388
},
389389
},
390390
Spec: expv1.MachinePoolSpec{

0 commit comments

Comments
 (0)