Skip to content

Commit 73e4394

Browse files
authored
Merge pull request #5660 from alimaazamat/v1beta1AzureASOManaged
Migrated AzureASOManaged API to v1beta1
2 parents e849ec5 + 5aafd56 commit 73e4394

File tree

61 files changed

+2051
-382
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+2051
-382
lines changed

api/v1alpha1/azureasomanagedcluster_types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ type StatusResource struct {
6868

6969
//+kubebuilder:object:root=true
7070
//+kubebuilder:subresource:status
71+
//+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."
7172

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

api/v1alpha1/azureasomanagedclustertemplate_types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ type AzureASOManagedClusterTemplateResourceSpec struct {
3939
}
4040

4141
//+kubebuilder:object:root=true
42+
//+kubebuilder:deprecatedversion:warning="infrastructure.cluster.x-k8s.io/v1alpha1 AzureASOManagedClusterTemplate is deprecated. infrastructure.cluster.x-k8s.io/v1beta1 is equivalent and should be used instead."
4243

4344
// AzureASOManagedClusterTemplate is the Schema for the azureasomanagedclustertemplates API.
4445
type AzureASOManagedClusterTemplate struct {

api/v1alpha1/azureasomanagedcontrolplane_types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ type AzureASOManagedControlPlaneStatus struct {
5656

5757
//+kubebuilder:object:root=true
5858
//+kubebuilder:subresource:status
59+
//+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."
5960

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

api/v1alpha1/azureasomanagedcontrolplanetemplate_types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ type AzureASOManagedControlPlaneTemplateResourceSpec struct {
4444
}
4545

4646
//+kubebuilder:object:root=true
47+
//+kubebuilder:deprecatedversion:warning="infrastructure.cluster.x-k8s.io/v1alpha1 AzureASOManagedControlPlaneTemplate is deprecated. infrastructure.cluster.x-k8s.io/v1beta1 is equivalent and should be used instead."
4748

4849
// AzureASOManagedControlPlaneTemplate is the Schema for the azureasomanagedcontrolplanetemplates API.
4950
type AzureASOManagedControlPlaneTemplate struct {

api/v1alpha1/azureasomanagedmachinepool_types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ type AzureASOManagedMachinePoolStatus struct {
5151

5252
//+kubebuilder:object:root=true
5353
//+kubebuilder:subresource:status
54+
//+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."
5455

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

api/v1alpha1/azureasomanagedmachinepooltemplate_types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ type AzureASOManagedMachinePoolTemplateResourceSpec struct {
4343
}
4444

4545
//+kubebuilder:object:root=true
46+
//+kubebuilder:deprecatedversion:warning="infrastructure.cluster.x-k8s.io/v1alpha1 AzureASOManagedMachinePoolTemplate is deprecated. infrastructure.cluster.x-k8s.io/v1beta1 is equivalent and should be used instead."
4647

4748
// AzureASOManagedMachinePoolTemplate is the Schema for the azureasomanagedmachinepooltemplates API.
4849
type AzureASOManagedMachinePoolTemplate struct {
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
/*
2+
Copyright 2025 The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package v1beta1
18+
19+
import (
20+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
21+
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
22+
)
23+
24+
const (
25+
// AzureASOManagedClusterKind is the kind for AzureASOManagedCluster.
26+
AzureASOManagedClusterKind = "AzureASOManagedCluster"
27+
28+
// AzureASOManagedControlPlaneFinalizer is the finalizer added to AzureASOManagedControlPlanes.
29+
AzureASOManagedControlPlaneFinalizer = "azureasomanagedcontrolplane.infrastructure.cluster.x-k8s.io"
30+
)
31+
32+
// AzureASOManagedClusterSpec defines the desired state of AzureASOManagedCluster.
33+
type AzureASOManagedClusterSpec struct {
34+
AzureASOManagedClusterTemplateResourceSpec `json:",inline"`
35+
36+
// ControlPlaneEndpoint is the location of the API server within the control plane. CAPZ manages this field
37+
// and it should not be set by the user. It fulfills Cluster API's cluster infrastructure provider contract.
38+
// Because this field is programmatically set by CAPZ after resource creation, we define it as +optional
39+
// in the API schema to permit resource admission.
40+
//+optional
41+
ControlPlaneEndpoint clusterv1.APIEndpoint `json:"controlPlaneEndpoint"`
42+
}
43+
44+
// AzureASOManagedClusterStatus defines the observed state of AzureASOManagedCluster.
45+
type AzureASOManagedClusterStatus struct {
46+
// Ready represents whether or not the cluster has been provisioned and is ready. It fulfills Cluster
47+
// API's cluster infrastructure provider contract.
48+
//+optional
49+
Ready bool `json:"ready"`
50+
51+
//+optional
52+
Resources []ResourceStatus `json:"resources,omitempty"`
53+
}
54+
55+
// ResourceStatus represents the status of a resource.
56+
type ResourceStatus struct {
57+
Resource StatusResource `json:"resource"`
58+
Ready bool `json:"ready"`
59+
}
60+
61+
// StatusResource is a handle to a resource.
62+
type StatusResource struct {
63+
Group string `json:"group"`
64+
Version string `json:"version"`
65+
Kind string `json:"kind"`
66+
Name string `json:"name"`
67+
}
68+
69+
// +kubebuilder:object:root=true
70+
// +kubebuilder:subresource:status
71+
// +kubebuilder:storageversion
72+
73+
// AzureASOManagedCluster is the Schema for the azureasomanagedclusters API.
74+
type AzureASOManagedCluster struct {
75+
metav1.TypeMeta `json:",inline"`
76+
metav1.ObjectMeta `json:"metadata,omitempty"`
77+
78+
Spec AzureASOManagedClusterSpec `json:"spec,omitempty"`
79+
Status AzureASOManagedClusterStatus `json:"status,omitempty"`
80+
}
81+
82+
// GetResourceStatuses returns the status of resources.
83+
func (a *AzureASOManagedCluster) GetResourceStatuses() []ResourceStatus {
84+
return a.Status.Resources
85+
}
86+
87+
// SetResourceStatuses sets the status of resources.
88+
func (a *AzureASOManagedCluster) SetResourceStatuses(r []ResourceStatus) {
89+
a.Status.Resources = r
90+
}
91+
92+
//+kubebuilder:object:root=true
93+
94+
// AzureASOManagedClusterList contains a list of AzureASOManagedCluster.
95+
type AzureASOManagedClusterList struct {
96+
metav1.TypeMeta `json:",inline"`
97+
metav1.ListMeta `json:"metadata,omitempty"`
98+
Items []AzureASOManagedCluster `json:"items"`
99+
}
100+
101+
func init() {
102+
SchemeBuilder.Register(&AzureASOManagedCluster{}, &AzureASOManagedClusterList{})
103+
}

api/v1alpha1/azureasomanagedcluster_webhook.go renamed to api/v1beta1/azureasomanagedcluster_webhook.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2024 The Kubernetes Authors.
2+
Copyright 2025 The Kubernetes Authors.
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
package v1alpha1
17+
package v1beta1
1818

1919
import (
2020
"context"
@@ -31,18 +31,18 @@ import (
3131

3232
// SetupAzureASOManagedClusterWebhookWithManager sets up and registers the webhook with the manager.
3333
func SetupAzureASOManagedClusterWebhookWithManager(mgr ctrl.Manager) error {
34-
w := &azureASOManagedClusterWebhook{}
34+
azureASOManagedClusterWebhook := &azureASOManagedClusterWebhook{}
3535
return ctrl.NewWebhookManagedBy(mgr).
3636
For(&AzureASOManagedCluster{}).
37-
WithValidator(w).
37+
WithValidator(azureASOManagedClusterWebhook).
3838
Complete()
3939
}
4040

4141
// azureASOManagedClusterWebhook implements a validating and defaulting webhook for AzureASOManagedCluster.
4242
type azureASOManagedClusterWebhook struct {
4343
}
4444

45-
// +kubebuilder:webhook:verbs=create,path=/validate-infrastructure-cluster-x-k8s-io-v1alpha1-azureasomanagedcluster,mutating=false,failurePolicy=fail,groups=infrastructure.cluster.x-k8s.io,resources=azureasomanagedclusters,versions=v1alpha1,name=validation.azureasomanagedcluster.infrastructure.cluster.x-k8s.io,sideEffects=None,admissionReviewVersions=v1;v1beta1
45+
// +kubebuilder:webhook:verbs=create,path=/validate-infrastructure-cluster-x-k8s-io-v1beta1-azureasomanagedcluster,mutating=false,failurePolicy=fail,groups=infrastructure.cluster.x-k8s.io,resources=azureasomanagedclusters,versions=v1beta1,name=validation.azureasomanagedcluster.infrastructure.cluster.x-k8s.io,sideEffects=None,admissionReviewVersions=v1;v1beta1
4646

4747
// ValidateCreate implements webhook.Validator so a webhook will be registered for the type.
4848
func (ampw *azureASOManagedClusterWebhook) ValidateCreate(_ context.Context, obj runtime.Object) (admission.Warnings, error) {
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
/*
2+
Copyright 2025 The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package v1beta1
18+
19+
import (
20+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
21+
"k8s.io/apimachinery/pkg/runtime"
22+
)
23+
24+
// AzureASOManagedClusterTemplateSpec defines the desired state of AzureASOManagedClusterTemplate.
25+
type AzureASOManagedClusterTemplateSpec struct {
26+
Template AzureASOManagedClusterTemplateResource `json:"template"`
27+
}
28+
29+
// AzureASOManagedClusterTemplateResource defines the templated resource.
30+
type AzureASOManagedClusterTemplateResource struct {
31+
Spec AzureASOManagedClusterTemplateResourceSpec `json:"spec,omitempty"`
32+
}
33+
34+
// AzureASOManagedClusterTemplateResourceSpec defines the desired state of the templated resource.
35+
type AzureASOManagedClusterTemplateResourceSpec struct {
36+
// Resources are embedded ASO resources to be managed by this resource.
37+
//+optional
38+
Resources []runtime.RawExtension `json:"resources,omitempty"`
39+
}
40+
41+
// +kubebuilder:object:root=true
42+
// +kubebuilder:storageversion
43+
44+
// AzureASOManagedClusterTemplate is the Schema for the azureasomanagedclustertemplates API.
45+
type AzureASOManagedClusterTemplate struct {
46+
metav1.TypeMeta `json:",inline"`
47+
metav1.ObjectMeta `json:"metadata,omitempty"`
48+
49+
Spec AzureASOManagedClusterTemplateSpec `json:"spec,omitempty"`
50+
}
51+
52+
//+kubebuilder:object:root=true
53+
54+
// AzureASOManagedClusterTemplateList contains a list of AzureASOManagedClusterTemplate.
55+
type AzureASOManagedClusterTemplateList struct {
56+
metav1.TypeMeta `json:",inline"`
57+
metav1.ListMeta `json:"metadata,omitempty"`
58+
Items []AzureASOManagedClusterTemplate `json:"items"`
59+
}
60+
61+
func init() {
62+
SchemeBuilder.Register(&AzureASOManagedClusterTemplate{}, &AzureASOManagedClusterTemplateList{})
63+
}
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
/*
2+
Copyright 2025 The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package v1beta1
18+
19+
import (
20+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
21+
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
22+
)
23+
24+
// AzureASOManagedControlPlaneKind is the kind for AzureASOManagedControlPlane.
25+
const AzureASOManagedControlPlaneKind = "AzureASOManagedControlPlane"
26+
27+
// AzureASOManagedControlPlaneSpec defines the desired state of AzureASOManagedControlPlane.
28+
type AzureASOManagedControlPlaneSpec struct {
29+
AzureASOManagedControlPlaneTemplateResourceSpec `json:",inline"`
30+
}
31+
32+
// AzureASOManagedControlPlaneStatus defines the observed state of AzureASOManagedControlPlane.
33+
type AzureASOManagedControlPlaneStatus struct {
34+
// Initialized represents whether or not the API server has been provisioned. It fulfills Cluster API's
35+
// control plane provider contract. For AKS, this is equivalent to `ready`.
36+
//+optional
37+
Initialized bool `json:"initialized"`
38+
39+
// Ready represents whether or not the API server is ready to receive requests. It fulfills Cluster API's
40+
// control plane provider contract. For AKS, this is equivalent to `initialized`.
41+
//+optional
42+
Ready bool `json:"ready"`
43+
44+
// Version is the observed Kubernetes version of the control plane. It fulfills Cluster API's control
45+
// plane provider contract.
46+
//+optional
47+
Version string `json:"version,omitempty"`
48+
49+
//+optional
50+
Resources []ResourceStatus `json:"resources,omitempty"`
51+
52+
// ControlPlaneEndpoint represents the endpoint for the cluster's API server.
53+
//+optional
54+
ControlPlaneEndpoint clusterv1.APIEndpoint `json:"controlPlaneEndpoint"`
55+
}
56+
57+
// +kubebuilder:object:root=true
58+
// +kubebuilder:subresource:status
59+
// +kubebuilder:storageversion
60+
61+
// AzureASOManagedControlPlane is the Schema for the azureasomanagedcontrolplanes API.
62+
type AzureASOManagedControlPlane struct {
63+
metav1.TypeMeta `json:",inline"`
64+
metav1.ObjectMeta `json:"metadata,omitempty"`
65+
66+
Spec AzureASOManagedControlPlaneSpec `json:"spec,omitempty"`
67+
Status AzureASOManagedControlPlaneStatus `json:"status,omitempty"`
68+
}
69+
70+
// GetResourceStatuses returns the status of resources.
71+
func (a *AzureASOManagedControlPlane) GetResourceStatuses() []ResourceStatus {
72+
return a.Status.Resources
73+
}
74+
75+
// SetResourceStatuses sets the status of resources.
76+
func (a *AzureASOManagedControlPlane) SetResourceStatuses(r []ResourceStatus) {
77+
a.Status.Resources = r
78+
}
79+
80+
//+kubebuilder:object:root=true
81+
82+
// AzureASOManagedControlPlaneList contains a list of AzureASOManagedControlPlane.
83+
type AzureASOManagedControlPlaneList struct {
84+
metav1.TypeMeta `json:",inline"`
85+
metav1.ListMeta `json:"metadata,omitempty"`
86+
Items []AzureASOManagedControlPlane `json:"items"`
87+
}
88+
89+
func init() {
90+
SchemeBuilder.Register(&AzureASOManagedControlPlane{}, &AzureASOManagedControlPlaneList{})
91+
}

api/v1alpha1/azureasomanagedcontrolplane_webhook.go renamed to api/v1beta1/azureasomanagedcontrolplane_webhook.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2024 The Kubernetes Authors.
2+
Copyright 2025 The Kubernetes Authors.
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
package v1alpha1
17+
package v1beta1
1818

1919
import (
2020
"context"
@@ -31,18 +31,18 @@ import (
3131

3232
// SetupAzureASOManagedControlPlaneWebhookWithManager sets up and registers the webhook with the manager.
3333
func SetupAzureASOManagedControlPlaneWebhookWithManager(mgr ctrl.Manager) error {
34-
w := &azureASOManagedControlPlaneWebhook{}
34+
azureASOManagedControlPlaneWebhook := &azureASOManagedControlPlaneWebhook{}
3535
return ctrl.NewWebhookManagedBy(mgr).
3636
For(&AzureASOManagedControlPlane{}).
37-
WithValidator(w).
37+
WithValidator(azureASOManagedControlPlaneWebhook).
3838
Complete()
3939
}
4040

4141
// azureASOManagedControlPlaneWebhook implements a validating webhook for AzureASOManagedControlPlane.
4242
type azureASOManagedControlPlaneWebhook struct {
4343
}
4444

45-
// +kubebuilder:webhook:verbs=create,path=/validate-infrastructure-cluster-x-k8s-io-v1alpha1-azureasomanagedcontrolplane,mutating=false,failurePolicy=fail,groups=infrastructure.cluster.x-k8s.io,resources=azureasomanagedcontrolplanes,versions=v1alpha1,name=validation.azureasomanagedcontrolplane.infrastructure.cluster.x-k8s.io,sideEffects=None,admissionReviewVersions=v1;v1beta1
45+
// +kubebuilder:webhook:verbs=create,path=/validate-infrastructure-cluster-x-k8s-io-v1beta1-azureasomanagedcontrolplane,mutating=false,failurePolicy=fail,groups=infrastructure.cluster.x-k8s.io,resources=azureasomanagedcontrolplanes,versions=v1beta1,name=validation.azureasomanagedcontrolplane.infrastructure.cluster.x-k8s.io,sideEffects=None,admissionReviewVersions=v1;v1beta1
4646

4747
// ValidateCreate implements webhook.Validator so a webhook will be registered for the type.
4848
func (ampw *azureASOManagedControlPlaneWebhook) ValidateCreate(_ context.Context, obj runtime.Object) (admission.Warnings, error) {

0 commit comments

Comments
 (0)