Skip to content

Commit 81da31e

Browse files
fix(kubeadm): Ensure strict <1.33.0 check for cloud-provider flag (#542)
* fix(test): Switch last-release to v1.6.1 for upgrade test * fix(release): Update metadata.yaml and Makefile Add v1.7.99 to Makefile and 1.7 series to metadata. * fix(deps): update e2e tests to kubernertes v1.32 and CAPI 1.9 * fix(kubeadm): Ensure strict <1.33.0 check for cloud-provider flag * fix(test): Use kubernetes 1.33 and CAPI 1.10 for e2e * Update kubernetes-controller-tools to v0.18.0 Update controller-gen and regenerate manifests. * fix(test): Add required controlPlane field to NutanixFailureDomainConfig in tests Controller-gen v0.18.0 now properly enforces the +kubebuilder:validation:Required annotation on the controlPlane field in NutanixFailureDomainConfig. The previous version (v0.14.0) did not enforce this validation in the generated CRD schema, but the newer version correctly marks controlPlane as a required field. This caused unit test panics because test objects were being created without setting the controlPlane field, which now violates the CRD schema validation. Fixed by adding ControlPlane: true to all NutanixFailureDomainConfig test objects in helpers_test.go and nutanixcluster_controller_test.go. * feat: Upgrade cluster-api dependency to v1.10.3 This commit upgrades cluster-api from v1.8.1 to v1.10.3 to ensure compatibility with controller-gen v0.18.0. The upgrade required several changes: 1. **Updated dependencies**: - sigs.k8s.io/cluster-api v1.8.1 → v1.10.3 - sigs.k8s.io/cluster-api/test v1.8.1 → v1.10.3 - Updated many transitive dependencies 2. **Fixed RateLimiter type compatibility**: - Updated ControllerConfig to use workqueue.TypedRateLimiter[reconcile.Request] - Fixed predicate function calls to include scheme parameter - Updated test cases to use typed rate limiters 3. **Addressed breaking changes**: - Fixed predicates.ClusterUnpausedAndInfrastructureReady() calls - Removed deprecated MetricsBindAddr field usage in tests - Updated main.go rate limiter configurations This upgrade resolves the e2e test failures that were occurring with the controller-gen v0.18.0 upgrade by ensuring all dependencies are compatible. * fix(deps): upgrade cluster-api/test to v1.10.3 * fix(manifests): regenerate manifests * fix(test): set clusterproxy in helpers * fix(lint): gofumpt * fix(deps): remove dependency on cluster-api/errors pkg package is deprecated and will be removed in future. * fix(manifests): config/manager/kustomization.yaml * fix(controller): add named controllers and skip uniqueness validation * fix(test): update test helpers * fix(refactor): use a const to denote CreateError * fix(test): use 1 version older kubernetes for clusterctl upgrade CAPX 1.6.1 can't create 1.33 cluster so we use kubernetes v1.32 for clusterctl upgrade test. this is temporary workaround to fix the broken CI until we release CAPX 1.7.0 and update the test to use 1.7.0 instead of 1.6.1. * fix(controller): Skip unique controller name validation in unit tests
1 parent c82fed7 commit 81da31e

40 files changed

+614
-559
lines changed

api/v1beta1/nutanixcluster_types.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import (
2424
corev1 "k8s.io/api/core/v1"
2525
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2626
capiv1 "sigs.k8s.io/cluster-api/api/v1beta1"
27-
"sigs.k8s.io/cluster-api/errors"
2827
)
2928

3029
const (
@@ -98,7 +97,7 @@ type NutanixClusterStatus struct {
9897

9998
// Will be set in case of failure of Cluster instance
10099
// +optional
101-
FailureReason *errors.ClusterStatusError `json:"failureReason,omitempty"`
100+
FailureReason *string `json:"failureReason,omitempty"`
102101

103102
// Will be set in case of failure of Cluster instance
104103
// +optional

api/v1beta1/nutanixmachine_types.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import (
2121
"k8s.io/apimachinery/pkg/api/resource"
2222
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2323
capiv1 "sigs.k8s.io/cluster-api/api/v1beta1"
24-
"sigs.k8s.io/cluster-api/errors"
2524
)
2625

2726
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
@@ -271,7 +270,7 @@ type NutanixMachineStatus struct {
271270

272271
// Will be set in case of failure of Machine instance
273272
// +optional
274-
FailureReason *errors.MachineStatusError `json:"failureReason,omitempty"`
273+
FailureReason *string `json:"failureReason,omitempty"`
275274

276275
// Will be set in case of failure of Machine instance
277276
// +optional

api/v1beta1/zz_generated.deepcopy.go

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

clusterctl.yaml.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ NUTANIX_INSECURE: false # Set to true for when using a self-signed certificate f
99
NUTANIX_PRISM_ELEMENT_CLUSTER_NAME: ""
1010
NUTANIX_SUBNET_NAME: ""
1111

12-
KUBERNETES_VERSION: "v1.31.0" # Kubernetes version, must match the version in NUTANIX_MACHINE_TEMPLATE_IMAGE_NAME
12+
KUBERNETES_VERSION: "v1.33.0" # Kubernetes version, must match the version in NUTANIX_MACHINE_TEMPLATE_IMAGE_NAME
1313
NUTANIX_MACHINE_TEMPLATE_IMAGE_NAME: "" # OS image name, must match the version in KUBERNETES_VERSION
1414
CONTROL_PLANE_ENDPOINT_IP: "" # An available IP that will be used by kube-vip for the Kubernetes API Server
1515
NUTANIX_SSH_AUTHORIZED_KEY: "" # Public key to use with user 'capiuser' on all Machines

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

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
33
kind: CustomResourceDefinition
44
metadata:
55
annotations:
6-
controller-gen.kubebuilder.io/version: v0.14.0
6+
controller-gen.kubebuilder.io/version: v0.18.0
77
name: nutanixclusters.infrastructure.cluster.x-k8s.io
88
spec:
99
group: infrastructure.cluster.x-k8s.io
@@ -62,10 +62,11 @@ spec:
6262
host can be either DNS name or ip address
6363
properties:
6464
host:
65-
description: The hostname on which the API server is serving.
65+
description: host is the hostname on which the API server is serving.
66+
maxLength: 512
6667
type: string
6768
port:
68-
description: The port on which the API server is serving.
69+
description: port is the port on which the API server is serving.
6970
format: int32
7071
type: integer
7172
required:
@@ -88,9 +89,7 @@ spec:
8889
This field is effectively required, but due to backwards compatibility is
8990
allowed to be empty. Instances of this type with an empty value here are
9091
almost certainly wrong.
91-
TODO: Add other useful fields. apiVersion, kind, uid?
9292
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
93-
TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
9493
type: string
9594
type: object
9695
x-kubernetes-map-type: atomic
@@ -104,13 +103,11 @@ spec:
104103
When set, the failure domains defined here may be used to spread Machines across
105104
prism element clusters to improve fault tolerance of the cluster.
106105
107-
108106
Deprecated: This field is replaced by the field controlPlaneFailureDomains and will be removed in the next apiVersion.
109107
items:
110108
description: |-
111109
NutanixFailureDomainConfig configures failure domain information for Nutanix.
112110
113-
114111
Deprecated: This type is replaced by the NutanixFailureDomain CRD type and will be removed in the next apiVersion.
115112
properties:
116113
cluster:
@@ -179,6 +176,7 @@ spec:
179176
type: array
180177
required:
181178
- cluster
179+
- controlPlane
182180
- name
183181
- subnets
184182
type: object
@@ -270,36 +268,43 @@ spec:
270268
properties:
271269
lastTransitionTime:
272270
description: |-
273-
Last time the condition transitioned from one status to another.
271+
lastTransitionTime is the last time the condition transitioned from one status to another.
274272
This should be when the underlying condition changed. If that is not known, then using the time when
275273
the API field changed is acceptable.
276274
format: date-time
277275
type: string
278276
message:
279277
description: |-
280-
A human readable message indicating details about the transition.
278+
message is a human readable message indicating details about the transition.
281279
This field may be empty.
280+
maxLength: 10240
281+
minLength: 1
282282
type: string
283283
reason:
284284
description: |-
285-
The reason for the condition's last transition in CamelCase.
285+
reason is the reason for the condition's last transition in CamelCase.
286286
The specific API may choose whether or not this field is considered a guaranteed API.
287-
This field may not be empty.
287+
This field may be empty.
288+
maxLength: 256
289+
minLength: 1
288290
type: string
289291
severity:
290292
description: |-
291-
Severity provides an explicit classification of Reason code, so the users or machines can immediately
293+
severity provides an explicit classification of Reason code, so the users or machines can immediately
292294
understand the current situation and act accordingly.
293295
The Severity field MUST be set only when Status=False.
296+
maxLength: 32
294297
type: string
295298
status:
296-
description: Status of the condition, one of True, False, Unknown.
299+
description: status of the condition, one of True, False, Unknown.
297300
type: string
298301
type:
299302
description: |-
300-
Type of condition in CamelCase or in foo.example.com/CamelCase.
303+
type of condition in CamelCase or in foo.example.com/CamelCase.
301304
Many .condition.type values are consistent across resources like Available, but because arbitrary conditions
302305
can be useful (see .node.status.conditions), the ability to deconflict is important.
306+
maxLength: 256
307+
minLength: 1
303308
type: string
304309
required:
305310
- lastTransitionTime
@@ -316,11 +321,11 @@ spec:
316321
attributes:
317322
additionalProperties:
318323
type: string
319-
description: Attributes is a free form map of attributes an
324+
description: attributes is a free form map of attributes an
320325
infrastructure provider might use or require.
321326
type: object
322327
controlPlane:
323-
description: ControlPlane determines if this failure domain
328+
description: controlPlane determines if this failure domain
324329
is suitable for use by control plane machines.
325330
type: boolean
326331
type: object

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
33
kind: CustomResourceDefinition
44
metadata:
55
annotations:
6-
controller-gen.kubebuilder.io/version: v0.14.0
6+
controller-gen.kubebuilder.io/version: v0.18.0
77
name: nutanixclustertemplates.infrastructure.cluster.x-k8s.io
88
spec:
99
group: infrastructure.cluster.x-k8s.io
@@ -55,10 +55,13 @@ spec:
5555
host can be either DNS name or ip address
5656
properties:
5757
host:
58-
description: The hostname on which the API server is serving.
58+
description: host is the hostname on which the API server
59+
is serving.
60+
maxLength: 512
5961
type: string
6062
port:
61-
description: The port on which the API server is serving.
63+
description: port is the port on which the API server
64+
is serving.
6265
format: int32
6366
type: integer
6467
required:
@@ -81,9 +84,7 @@ spec:
8184
This field is effectively required, but due to backwards compatibility is
8285
allowed to be empty. Instances of this type with an empty value here are
8386
almost certainly wrong.
84-
TODO: Add other useful fields. apiVersion, kind, uid?
8587
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
86-
TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
8788
type: string
8889
type: object
8990
x-kubernetes-map-type: atomic
@@ -97,13 +98,11 @@ spec:
9798
When set, the failure domains defined here may be used to spread Machines across
9899
prism element clusters to improve fault tolerance of the cluster.
99100
100-
101101
Deprecated: This field is replaced by the field controlPlaneFailureDomains and will be removed in the next apiVersion.
102102
items:
103103
description: |-
104104
NutanixFailureDomainConfig configures failure domain information for Nutanix.
105105
106-
107106
Deprecated: This type is replaced by the NutanixFailureDomain CRD type and will be removed in the next apiVersion.
108107
properties:
109108
cluster:
@@ -176,6 +175,7 @@ spec:
176175
type: array
177176
required:
178177
- cluster
178+
- controlPlane
179179
- name
180180
- subnets
181181
type: object

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

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
33
kind: CustomResourceDefinition
44
metadata:
55
annotations:
6-
controller-gen.kubebuilder.io/version: v0.14.0
6+
controller-gen.kubebuilder.io/version: v0.18.0
77
name: nutanixfailuredomains.infrastructure.cluster.x-k8s.io
88
spec:
99
group: infrastructure.cluster.x-k8s.io
@@ -111,36 +111,43 @@ spec:
111111
properties:
112112
lastTransitionTime:
113113
description: |-
114-
Last time the condition transitioned from one status to another.
114+
lastTransitionTime is the last time the condition transitioned from one status to another.
115115
This should be when the underlying condition changed. If that is not known, then using the time when
116116
the API field changed is acceptable.
117117
format: date-time
118118
type: string
119119
message:
120120
description: |-
121-
A human readable message indicating details about the transition.
121+
message is a human readable message indicating details about the transition.
122122
This field may be empty.
123+
maxLength: 10240
124+
minLength: 1
123125
type: string
124126
reason:
125127
description: |-
126-
The reason for the condition's last transition in CamelCase.
128+
reason is the reason for the condition's last transition in CamelCase.
127129
The specific API may choose whether or not this field is considered a guaranteed API.
128-
This field may not be empty.
130+
This field may be empty.
131+
maxLength: 256
132+
minLength: 1
129133
type: string
130134
severity:
131135
description: |-
132-
Severity provides an explicit classification of Reason code, so the users or machines can immediately
136+
severity provides an explicit classification of Reason code, so the users or machines can immediately
133137
understand the current situation and act accordingly.
134138
The Severity field MUST be set only when Status=False.
139+
maxLength: 32
135140
type: string
136141
status:
137-
description: Status of the condition, one of True, False, Unknown.
142+
description: status of the condition, one of True, False, Unknown.
138143
type: string
139144
type:
140145
description: |-
141-
Type of condition in CamelCase or in foo.example.com/CamelCase.
146+
type of condition in CamelCase or in foo.example.com/CamelCase.
142147
Many .condition.type values are consistent across resources like Available, but because arbitrary conditions
143148
can be useful (see .node.status.conditions), the ability to deconflict is important.
149+
maxLength: 256
150+
minLength: 1
144151
type: string
145152
required:
146153
- lastTransitionTime

0 commit comments

Comments
 (0)