Skip to content

Commit a3db62e

Browse files
committed
Revert public APIS back to v1beta1 while internally using v1beta2
Introducing v1beta2 on public types is a breaking change so they have to stay in v1beta1. Internally though, migration to v1beta2 is happening (except for conditions). Signed-off-by: Borja Clemente <[email protected]>
1 parent 134ea1c commit a3db62e

39 files changed

+134
-218
lines changed

api/v1beta1/awscluster_types.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import (
2020
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2121

2222
clusterv1beta1 "sigs.k8s.io/cluster-api/api/core/v1beta1"
23-
clusterv1 "sigs.k8s.io/cluster-api/api/core/v1beta2"
2423
)
2524

2625
const (
@@ -46,7 +45,7 @@ type AWSClusterSpec struct {
4645

4746
// ControlPlaneEndpoint represents the endpoint used to communicate with the control plane.
4847
// +optional
49-
ControlPlaneEndpoint clusterv1.APIEndpoint `json:"controlPlaneEndpoint"`
48+
ControlPlaneEndpoint clusterv1beta1.APIEndpoint `json:"controlPlaneEndpoint"`
5049

5150
// AdditionalTags is an optional set of tags to add to AWS resources managed by the AWS provider, in addition to the
5251
// ones added by default.

api/v1beta1/zz_generated.conversion.go

Lines changed: 2 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/v1beta2/awscluster_types.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import (
2020
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2121

2222
clusterv1beta1 "sigs.k8s.io/cluster-api/api/core/v1beta1"
23-
clusterv1 "sigs.k8s.io/cluster-api/api/core/v1beta2"
2423
)
2524

2625
const (
@@ -50,7 +49,7 @@ type AWSClusterSpec struct {
5049

5150
// ControlPlaneEndpoint represents the endpoint used to communicate with the control plane.
5251
// +optional
53-
ControlPlaneEndpoint clusterv1.APIEndpoint `json:"controlPlaneEndpoint"`
52+
ControlPlaneEndpoint clusterv1beta1.APIEndpoint `json:"controlPlaneEndpoint"`
5453

5554
// AdditionalTags is an optional set of tags to add to AWS resources managed by the AWS provider, in addition to the
5655
// ones added by default.
@@ -277,11 +276,11 @@ type AdditionalListenerSpec struct {
277276
// AWSClusterStatus defines the observed state of AWSCluster.
278277
type AWSClusterStatus struct {
279278
// +kubebuilder:default=false
280-
Ready bool `json:"ready"`
281-
Network NetworkStatus `json:"networkStatus,omitempty"`
282-
FailureDomains map[string]clusterv1.FailureDomain `json:"failureDomains,omitempty"`
283-
Bastion *Instance `json:"bastion,omitempty"`
284-
Conditions clusterv1beta1.Conditions `json:"conditions,omitempty"`
279+
Ready bool `json:"ready"`
280+
Network NetworkStatus `json:"networkStatus,omitempty"`
281+
FailureDomains clusterv1beta1.FailureDomains `json:"failureDomains,omitempty"`
282+
Bastion *Instance `json:"bastion,omitempty"`
283+
Conditions clusterv1beta1.Conditions `json:"conditions,omitempty"`
285284
}
286285

287286
// S3Bucket defines a supporting S3 bucket for the cluster, currently can be optionally used for Ignition.

api/v1beta2/awscluster_webhook_test.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import (
3333

3434
"sigs.k8s.io/cluster-api-provider-aws/v2/feature"
3535
"sigs.k8s.io/cluster-api-provider-aws/v2/util/defaulting"
36+
clusterv1beta1 "sigs.k8s.io/cluster-api/api/core/v1beta1"
3637
clusterv1 "sigs.k8s.io/cluster-api/api/core/v1beta2"
3738
)
3839

@@ -945,15 +946,15 @@ func TestAWSClusterValidateUpdate(t *testing.T) {
945946
name: "controlPlaneEndpoint is immutable",
946947
oldCluster: &AWSCluster{
947948
Spec: AWSClusterSpec{
948-
ControlPlaneEndpoint: clusterv1.APIEndpoint{
949+
ControlPlaneEndpoint: clusterv1beta1.APIEndpoint{
949950
Host: "example.com",
950951
Port: int32(8000),
951952
},
952953
},
953954
},
954955
newCluster: &AWSCluster{
955956
Spec: AWSClusterSpec{
956-
ControlPlaneEndpoint: clusterv1.APIEndpoint{
957+
ControlPlaneEndpoint: clusterv1beta1.APIEndpoint{
957958
Host: "foo.example.com",
958959
Port: int32(9000),
959960
},
@@ -965,12 +966,12 @@ func TestAWSClusterValidateUpdate(t *testing.T) {
965966
name: "controlPlaneEndpoint can be updated if it is empty",
966967
oldCluster: &AWSCluster{
967968
Spec: AWSClusterSpec{
968-
ControlPlaneEndpoint: clusterv1.APIEndpoint{},
969+
ControlPlaneEndpoint: clusterv1beta1.APIEndpoint{},
969970
},
970971
},
971972
newCluster: &AWSCluster{
972973
Spec: AWSClusterSpec{
973-
ControlPlaneEndpoint: clusterv1.APIEndpoint{
974+
ControlPlaneEndpoint: clusterv1beta1.APIEndpoint{
974975
Host: "example.com",
975976
Port: int32(8000),
976977
},

api/v1beta2/awsmanagedcluster_types.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,13 @@ import (
2020
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2121

2222
clusterv1beta1 "sigs.k8s.io/cluster-api/api/core/v1beta1"
23-
clusterv1 "sigs.k8s.io/cluster-api/api/core/v1beta2"
2423
)
2524

2625
// AWSManagedClusterSpec defines the desired state of AWSManagedCluster
2726
type AWSManagedClusterSpec struct {
2827
// ControlPlaneEndpoint represents the endpoint used to communicate with the control plane.
2928
// +optional
30-
ControlPlaneEndpoint clusterv1.APIEndpoint `json:"controlPlaneEndpoint"`
29+
ControlPlaneEndpoint clusterv1beta1.APIEndpoint `json:"controlPlaneEndpoint"`
3130
}
3231

3332
// AWSManagedClusterStatus defines the observed state of AWSManagedCluster
@@ -38,7 +37,7 @@ type AWSManagedClusterStatus struct {
3837

3938
// FailureDomains specifies a list fo available availability zones that can be used
4039
// +optional
41-
FailureDomains map[string]clusterv1.FailureDomain `json:"failureDomains,omitempty"`
40+
FailureDomains clusterv1beta1.FailureDomains `json:"failureDomains,omitempty"`
4241

4342
// Conditions defines current service state of the AWSManagedCluster.
4443
// +optional

api/v1beta2/zz_generated.deepcopy.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bootstrap/eks/controllers/eksconfig_controller.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ import (
4848
"sigs.k8s.io/cluster-api/feature"
4949
"sigs.k8s.io/cluster-api/util"
5050
v1beta1conditions "sigs.k8s.io/cluster-api/util/deprecated/v1beta1/conditions"
51-
patch "sigs.k8s.io/cluster-api/util/deprecated/v1beta1/patch"
51+
v1beta1patch "sigs.k8s.io/cluster-api/util/deprecated/v1beta1/patch"
5252
"sigs.k8s.io/cluster-api/util/predicates"
5353
)
5454

@@ -118,7 +118,7 @@ func (r *EKSConfigReconciler) Reconcile(ctx context.Context, req ctrl.Request) (
118118
return ctrl.Result{}, err
119119
}
120120

121-
patchHelper, err := patch.NewHelper(config, r.Client)
121+
patchHelper, err := v1beta1patch.NewHelper(config, r.Client)
122122
if err != nil {
123123
return ctrl.Result{}, err
124124
}
@@ -132,9 +132,9 @@ func (r *EKSConfigReconciler) Reconcile(ctx context.Context, req ctrl.Request) (
132132
v1beta1conditions.WithStepCounter(),
133133
)
134134

135-
patchOpts := []patch.Option{}
135+
patchOpts := []v1beta1patch.Option{}
136136
if rerr == nil {
137-
patchOpts = append(patchOpts, patch.WithStatusObservedGeneration{})
137+
patchOpts = append(patchOpts, v1beta1patch.WithStatusObservedGeneration{})
138138
}
139139
if err := patchHelper.Patch(ctx, config, patchOpts...); err != nil {
140140
log.Error(rerr, "Failed to patch config")

config/crd/bases/controlplane.cluster.x-k8s.io_awsmanagedcontrolplanes.yaml

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -154,19 +154,18 @@ spec:
154154
controlPlaneEndpoint:
155155
description: ControlPlaneEndpoint represents the endpoint used to
156156
communicate with the control plane.
157-
minProperties: 1
158157
properties:
159158
host:
160159
description: host is the hostname on which the API server is serving.
161160
maxLength: 512
162-
minLength: 1
163161
type: string
164162
port:
165163
description: port is the port on which the API server is serving.
166164
format: int32
167-
maximum: 65535
168-
minimum: 1
169165
type: integer
166+
required:
167+
- host
168+
- port
170169
type: object
171170
disableVPCCNI:
172171
default: false
@@ -2388,19 +2387,18 @@ spec:
23882387
controlPlaneEndpoint:
23892388
description: ControlPlaneEndpoint represents the endpoint used to
23902389
communicate with the control plane.
2391-
minProperties: 1
23922390
properties:
23932391
host:
23942392
description: host is the hostname on which the API server is serving.
23952393
maxLength: 512
2396-
minLength: 1
23972394
type: string
23982395
port:
23992396
description: port is the port on which the API server is serving.
24002397
format: int32
2401-
maximum: 65535
2402-
minimum: 1
24032398
type: integer
2399+
required:
2400+
- host
2401+
- port
24042402
type: object
24052403
eksClusterName:
24062404
description: |-
@@ -3895,7 +3893,7 @@ spec:
38953893
failureDomains:
38963894
additionalProperties:
38973895
description: |-
3898-
FailureDomain is the Schema for Cluster API failure domains.
3896+
FailureDomainSpec is the Schema for Cluster API failure domains.
38993897
It allows controllers to understand how many failure domains a cluster can optionally span across.
39003898
properties:
39013899
attributes:
@@ -3908,13 +3906,6 @@ spec:
39083906
description: controlPlane determines if this failure domain
39093907
is suitable for use by control plane machines.
39103908
type: boolean
3911-
name:
3912-
description: name is the name of the failure domain.
3913-
maxLength: 256
3914-
minLength: 1
3915-
type: string
3916-
required:
3917-
- name
39183909
type: object
39193910
description: FailureDomains specifies a list fo available availability
39203911
zones that can be used

config/crd/bases/controlplane.cluster.x-k8s.io_awsmanagedcontrolplanetemplates.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,21 +172,20 @@ spec:
172172
controlPlaneEndpoint:
173173
description: ControlPlaneEndpoint represents the endpoint
174174
used to communicate with the control plane.
175-
minProperties: 1
176175
properties:
177176
host:
178177
description: host is the hostname on which the API server
179178
is serving.
180179
maxLength: 512
181-
minLength: 1
182180
type: string
183181
port:
184182
description: port is the port on which the API server
185183
is serving.
186184
format: int32
187-
maximum: 65535
188-
minimum: 1
189185
type: integer
186+
required:
187+
- host
188+
- port
190189
type: object
191190
eksClusterName:
192191
description: |-

config/crd/bases/controlplane.cluster.x-k8s.io_rosacontrolplanes.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,19 +183,18 @@ spec:
183183
controlPlaneEndpoint:
184184
description: ControlPlaneEndpoint represents the endpoint used to
185185
communicate with the control plane.
186-
minProperties: 1
187186
properties:
188187
host:
189188
description: host is the hostname on which the API server is serving.
190189
maxLength: 512
191-
minLength: 1
192190
type: string
193191
port:
194192
description: port is the port on which the API server is serving.
195193
format: int32
196-
maximum: 65535
197-
minimum: 1
198194
type: integer
195+
required:
196+
- host
197+
- port
199198
type: object
200199
credentialsSecretRef:
201200
description: |-

0 commit comments

Comments
 (0)