Skip to content

Commit 6674313

Browse files
🌱 Add v1beta2 conditions to VSphereMachine and VSphereVM (#3406)
* Add v1beta2 conditions to VSphereMachine and VSphereVM * Generate manifests * Address feedback * More feedback
1 parent 68be3e5 commit 6674313

18 files changed

+573
-8
lines changed

‎apis/v1beta1/vspheremachine_types.go‎

Lines changed: 75 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,80 @@ const (
2929
MachineFinalizer = "vspheremachine.infrastructure.cluster.x-k8s.io"
3030
)
3131

32+
// VSphereMachine's Ready condition and corresponding reasons that will be used in v1Beta2 API version.
33+
const (
34+
// VSphereMachineReadyV1Beta2Condition is true if the VSphereMachine's deletionTimestamp is not set, VSphereMachine's
35+
// VirtualMachineProvisioned is true.
36+
VSphereMachineReadyV1Beta2Condition = clusterv1.ReadyV1Beta2Condition
37+
38+
// VSphereMachineReadyV1Beta2Reason surfaces when the VSphereMachine readiness criteria is met.
39+
VSphereMachineReadyV1Beta2Reason = clusterv1.ReadyV1Beta2Reason
40+
41+
// VSphereMachineNotReadyV1Beta2Reason surfaces when the VSphereMachine readiness criteria is not met.
42+
VSphereMachineNotReadyV1Beta2Reason = clusterv1.NotReadyV1Beta2Reason
43+
44+
// VSphereMachineReadyUnknownV1Beta2Reason surfaces when at least one VSphereMachine readiness criteria is unknown
45+
// and no VSphereMachine readiness criteria is not met.
46+
VSphereMachineReadyUnknownV1Beta2Reason = clusterv1.ReadyUnknownV1Beta2Reason
47+
)
48+
49+
// VSphereMachine's VirtualMachineProvisioned condition and corresponding reasons that will be used in v1Beta2 API version.
50+
//
51+
// NOTE:
52+
// - In supervisor mode, before creating the VM the VirtualMachine goes trough a series of preflight checks; if one is failing, the
53+
// reason for this failure and the message are surfaced in the VSphereMachine's VirtualMachineProvisioned condition.
54+
// - In govmomi mode, in some cases, reason and message from the VSphereVM are surfaced in the VSphereMachine's
55+
// VirtualMachineProvisioned condition.
56+
const (
57+
// VSphereMachineVirtualMachineProvisionedV1Beta2Condition documents the status of the VirtualMachine that is controlled
58+
// by the VSphereMachine.
59+
VSphereMachineVirtualMachineProvisionedV1Beta2Condition = "VirtualMachineProvisioned"
60+
61+
// VSphereMachineVirtualMachineWaitingForClusterInfrastructureReadyV1Beta2Reason documents the VirtualMachine that is controlled
62+
// by the VSphereMachine waiting for the cluster infrastructure to be ready.
63+
// Note: This reason is used only in govmomi mode.
64+
VSphereMachineVirtualMachineWaitingForClusterInfrastructureReadyV1Beta2Reason = clusterv1.WaitingForClusterInfrastructureReadyV1Beta2Reason
65+
66+
// VSphereMachineVirtualMachineWaitingForControlPlaneInitializedV1Beta2Reason documents the VirtualMachine that is controlled
67+
// by the VSphereMachine waiting for the control plane to be initialized.
68+
VSphereMachineVirtualMachineWaitingForControlPlaneInitializedV1Beta2Reason = clusterv1.WaitingForControlPlaneInitializedV1Beta2Reason
69+
70+
// VSphereMachineVirtualMachineWaitingForBootstrapDataV1Beta2Reason documents the VirtualMachine that is controlled
71+
// by the VSphereMachine waiting for the bootstrap data to be ready.
72+
VSphereMachineVirtualMachineWaitingForBootstrapDataV1Beta2Reason = clusterv1.WaitingForBootstrapDataV1Beta2Reason
73+
74+
// VSphereMachineVirtualMachineProvisioningV1Beta2Reason surfaces when the VirtualMachine that is controlled
75+
// by the VSphereMachine is provisioning.
76+
// Note: This reason is used only in supervisor mode.
77+
VSphereMachineVirtualMachineProvisioningV1Beta2Reason = "Provisioning"
78+
79+
// VSphereMachineVirtualMachinePoweringOnV1Beta2Reason surfaces when the VirtualMachine that is controlled
80+
// by the VSphereMachine is executing the power on sequence.
81+
// Note: This reason is used only in supervisor mode.
82+
VSphereMachineVirtualMachinePoweringOnV1Beta2Reason = "PoweringOn"
83+
84+
// VSphereMachineVirtualMachineWaitingForNetworkAddressV1Beta2Reason surfaces when the VirtualMachine that is controlled
85+
// by the VSphereMachine waiting for the machine network settings to be reported after machine being powered on.
86+
VSphereMachineVirtualMachineWaitingForNetworkAddressV1Beta2Reason = "WaitingForNetworkAddress"
87+
88+
// VSphereMachineVirtualMachineWaitingForBIOSUUIDV1Beta2Reason surfaces when the VirtualMachine that is controlled
89+
// by the VSphereMachine waiting for the machine to have a BIOS UUID.
90+
// Note: This reason is used only in supervisor mode.
91+
VSphereMachineVirtualMachineWaitingForBIOSUUIDV1Beta2Reason = "WaitingForBIOSUUID"
92+
93+
// VSphereMachineVirtualMachineProvisionedV1Beta2Reason surfaces when the VirtualMachine that is controlled
94+
// by the VSphereMachine is provisioned.
95+
VSphereMachineVirtualMachineProvisionedV1Beta2Reason = clusterv1.ProvisionedV1Beta2Reason
96+
97+
// VSphereMachineVirtualMachineNotProvisionedV1Beta2Reason surfaces when the VirtualMachine that is controlled
98+
// by the VSphereMachine is not provisioned.
99+
VSphereMachineVirtualMachineNotProvisionedV1Beta2Reason = clusterv1.NotProvisionedV1Beta2Reason
100+
101+
// VSphereMachineVirtualMachineDeletingV1Beta2Reason surfaces when the VirtualMachine that is controlled
102+
// by the VSphereMachine is being deleted.
103+
VSphereMachineVirtualMachineDeletingV1Beta2Reason = clusterv1.DeletingV1Beta2Reason
104+
)
105+
32106
// VSphereMachineSpec defines the desired state of VSphereMachine.
33107
type VSphereMachineSpec struct {
34108
VirtualMachineCloneSpec `json:",inline"`
@@ -159,7 +233,7 @@ type VSphereMachineStatus struct {
159233
// See https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more context.
160234
type VSphereMachineV1Beta2Status struct {
161235
// conditions represents the observations of a VSphereMachine's current state.
162-
// Known condition types are Paused.
236+
// Known condition types are Ready, VirtualMachineProvisioned and Paused.
163237
// +optional
164238
// +listType=map
165239
// +listMapKey=type

‎apis/v1beta1/vspherevm_types.go‎

Lines changed: 139 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,143 @@ const (
4040
GuestSoftPowerOffDefaultTimeout = 5 * time.Minute
4141
)
4242

43+
// VSphereVM's Ready condition and corresponding reasons that will be used in v1Beta2 API version.
44+
const (
45+
// VSphereVMReadyV1Beta2Condition is true if the VSphereVM's deletionTimestamp is not set, VSphereVM's
46+
// VirtualMachineProvisioned, VCenterAvailable and IPAddressClaimsFulfilled are true.
47+
VSphereVMReadyV1Beta2Condition = clusterv1.ReadyV1Beta2Condition
48+
49+
// VSphereVMReadyV1Beta2Reason surfaces when the VSphereVM readiness criteria is met.
50+
VSphereVMReadyV1Beta2Reason = clusterv1.ReadyV1Beta2Reason
51+
52+
// VSphereVMNotReadyV1Beta2Reason surfaces when the VSphereVM readiness criteria is not met.
53+
VSphereVMNotReadyV1Beta2Reason = clusterv1.NotReadyV1Beta2Reason
54+
55+
// VSphereVMReadyUnknownV1Beta2Reason surfaces when at least one VSphereVM readiness criteria is unknown
56+
// and no VSphereVM readiness criteria is not met.
57+
VSphereVMReadyUnknownV1Beta2Reason = clusterv1.ReadyUnknownV1Beta2Reason
58+
)
59+
60+
// VSphereVM's VirtualMachineProvisioned condition and corresponding reasons that will be used in v1Beta2 API version.
61+
const (
62+
// VSphereVMVirtualMachineProvisionedV1Beta2Condition documents the status of the VirtualMachine that is controlled
63+
// by the VSphereVM.
64+
VSphereVMVirtualMachineProvisionedV1Beta2Condition = "VirtualMachineProvisioned"
65+
66+
// VSphereVMVirtualMachineWaitingForCloneV1Beta2Reason documents the VirtualMachine that is controlled
67+
// by the VSphereVM waiting for the clone operation to complete.
68+
VSphereVMVirtualMachineWaitingForCloneV1Beta2Reason = "WaitingForClone"
69+
70+
// VSphereVMVirtualMachineWaitingForStaticIPAllocationV1Beta2Reason documents the VirtualMachine that is controlled
71+
// by the VSphereVM waiting for the allocation of a static IP address.
72+
VSphereVMVirtualMachineWaitingForStaticIPAllocationV1Beta2Reason = "WaitingForStaticIPAllocation"
73+
74+
// VSphereVMVirtualMachineWaitingForIPAddressV1Beta2Reason documents the VirtualMachine that is controlled
75+
// by the VSphereVM waiting for an IP address to be provisioned from the IPAM provider.
76+
VSphereVMVirtualMachineWaitingForIPAddressV1Beta2Reason = "WaitingForIPAddress"
77+
78+
// VSphereVMVirtualMachineWaitingForIPAllocationV1Beta2Reason documents the VirtualMachine that is controlled
79+
// by the VSphereVM waiting for the allocation of an IP address.
80+
// This is used when the dhcp4 or dhcp6 for a VirtualMachine is set and the VirtualMachine is waiting for the
81+
// relevant IP address to show up on the VM.
82+
VSphereVMVirtualMachineWaitingForIPAllocationV1Beta2Reason = "WaitingForIPAllocation"
83+
84+
// VSphereVMVirtualMachinePoweringOnV1Beta2Reason surfaces when the VirtualMachine that is controlled
85+
// by the VSphereVM is executing the power on sequence.
86+
VSphereVMVirtualMachinePoweringOnV1Beta2Reason = "PoweringOn"
87+
88+
// VSphereVMVirtualMachineProvisionedV1Beta2Reason surfaces when the VirtualMachine that is controlled
89+
// by the VSphereVM is provisioned.
90+
VSphereVMVirtualMachineProvisionedV1Beta2Reason = clusterv1.ProvisionedV1Beta2Reason
91+
92+
// VSphereVMVirtualMachineTaskFailedV1Beta2Reason surfaces when a task for the VirtualMachine that is controlled
93+
// by the VSphereVM failed; the reconcile look will automatically retry the operation,
94+
// but a user intervention might be required to fix the problem.
95+
VSphereVMVirtualMachineTaskFailedV1Beta2Reason = "TaskFailed"
96+
97+
// VSphereVMVirtualMachineNotFoundByBIOSUUIDV1Beta2Reason surfaces when the VirtualMachine that is controlled
98+
// by the VSphereVM can't be found by BIOS UUID.
99+
// Those kind of errors could be transient sometimes and failed VSphereVM are automatically
100+
// reconciled by the controller.
101+
VSphereVMVirtualMachineNotFoundByBIOSUUIDV1Beta2Reason = "NotFoundByBIOSUUID"
102+
103+
// VSphereVMVirtualMachineNotProvisionedV1Beta2Reason surfaces when the VirtualMachine that is controlled
104+
// by the VSphereVM is not provisioned.
105+
VSphereVMVirtualMachineNotProvisionedV1Beta2Reason = clusterv1.NotProvisionedV1Beta2Reason
106+
107+
// VSphereVMVirtualMachineDeletingV1Beta2Reason surfaces when the VirtualMachine that is controlled
108+
// by the VSphereVM is being deleted.
109+
VSphereVMVirtualMachineDeletingV1Beta2Reason = clusterv1.DeletingV1Beta2Reason
110+
)
111+
112+
// VSphereVM's VCenterAvailable condition and corresponding reasons that will be used in v1Beta2 API version.
113+
const (
114+
// VSphereVMVCenterAvailableV1Beta2Condition documents the availability of the VCenter hosting the VSphereVM.
115+
VSphereVMVCenterAvailableV1Beta2Condition = "VCenterAvailable"
116+
117+
// VSphereVMVCenterAvailableV1Beta2Reason documents the VCenter hosting the VSphereVM
118+
// being available.
119+
VSphereVMVCenterAvailableV1Beta2Reason = clusterv1.AvailableV1Beta2Reason
120+
121+
// VSphereVMVCenterUnreachableV1Beta2Reason documents the VCenter hosting the VSphereVM
122+
// cannot be reached.
123+
VSphereVMVCenterUnreachableV1Beta2Reason = "VCenterUnreachable"
124+
)
125+
126+
// VSphereVM's IPAddressClaimsFulfilled condition and corresponding reasons that will be used in v1Beta2 API version.
127+
const (
128+
// VSphereVMIPAddressClaimsFulfilledV1Beta2Condition documents the status of claiming an IP address
129+
// from an IPAM provider.
130+
VSphereVMIPAddressClaimsFulfilledV1Beta2Condition = "IPAddressClaimsFulfilled"
131+
132+
// VSphereVMIPAddressClaimsBeingCreatedV1Beta2Reason documents that claims for the
133+
// IP addresses required by the VSphereVM are being created.
134+
VSphereVMIPAddressClaimsBeingCreatedV1Beta2Reason = "IPAddressClaimsBeingCreated"
135+
136+
// VSphereVMIPAddressClaimsWaitingForIPAddressV1Beta2Reason documents that claims for the
137+
// IP addresses required by the VSphereVM are waiting for IP addresses.
138+
VSphereVMIPAddressClaimsWaitingForIPAddressV1Beta2Reason = "WaitingForIPAddress"
139+
140+
// VSphereVMIPAddressClaimsFulfilledV1Beta2Reason documents that claims for the
141+
// IP addresses required by the VSphereVM are fulfilled.
142+
VSphereVMIPAddressClaimsFulfilledV1Beta2Reason = "Fulfilled"
143+
144+
// VSphereVMIPAddressClaimsNotFulfilledV1Beta2Reason documents that claims for the
145+
// IP addresses required by the VSphereVM are not fulfilled.
146+
VSphereVMIPAddressClaimsNotFulfilledV1Beta2Reason = "NotFulfilled"
147+
)
148+
149+
// VSphereVM's GuestSoftPowerOffSucceeded condition and corresponding reasons that will be used in v1Beta2 API version.
150+
const (
151+
// VSphereVMGuestSoftPowerOffSucceededV1Beta2Condition documents the status of performing guest initiated
152+
// graceful shutdown.
153+
VSphereVMGuestSoftPowerOffSucceededV1Beta2Condition string = "GuestSoftPowerOffSucceeded"
154+
155+
// VSphereVMGuestSoftPowerOffInProgressV1Beta2Reason documents that the guest receives
156+
// a graceful shutdown request.
157+
VSphereVMGuestSoftPowerOffInProgressV1Beta2Reason = "InProgress"
158+
159+
// GuestSoftPowerOffFailedV1Beta2Reason documents that the graceful
160+
// shutdown request failed.
161+
VSphereVMGuestSoftPowerOffFailedV1Beta2Reason = "Failed"
162+
163+
// GuestSoftPowerOffSucceededV1Beta2Reason documents that the graceful
164+
// shutdown request succeeded.
165+
VSphereVMGuestSoftPowerOffSucceededV1Beta2Reason = "Succeeded"
166+
)
167+
168+
// VSphereVM's PCIDevicesDetached condition and corresponding reasons that will be used in v1Beta2 API version.
169+
const (
170+
// VSphereVMPCIDevicesDetachedV1Beta2Condition documents the status of the attached PCI devices on the VSphereVM.
171+
// It is a negative condition to notify the user that the device(s) is no longer attached to
172+
// the underlying VM and would require manual intervention to fix the situation.
173+
VSphereVMPCIDevicesDetachedV1Beta2Condition string = "PCIDevicesDetached"
174+
175+
// VSphereVMPCIDevicesDetachedNotFoundV1Beta2Reason documents the VSphereVM not having the PCI device attached during VM startup.
176+
// This would indicate that the PCI devices were removed out of band by an external entity.
177+
VSphereVMPCIDevicesDetachedNotFoundV1Beta2Reason = "NotFound"
178+
)
179+
43180
// VSphereVMSpec defines the desired state of VSphereVM.
44181
type VSphereVMSpec struct {
45182
VirtualMachineCloneSpec `json:",inline"`
@@ -188,7 +325,8 @@ type VSphereVMStatus struct {
188325
// See https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more context.
189326
type VSphereVMV1Beta2Status struct {
190327
// conditions represents the observations of a VSphereVM's current state.
191-
// Known condition types are Paused.
328+
// Known condition types are Ready, VirtualMachineProvisioned, VCenterAvailable and IPAddressClaimsFulfilled,
329+
// GuestSoftPowerOffSucceeded, PCIDevicesDetached and Paused.
192330
// +optional
193331
// +listType=map
194332
// +listMapKey=type

‎apis/vmware/v1beta1/vspheremachine_types.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ type VSphereMachineStatus struct {
186186
// See https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more context.
187187
type VSphereMachineV1Beta2Status struct {
188188
// conditions represents the observations of a VSphereMachine's current state.
189-
// Known condition types are Paused.
189+
// Known condition types are Ready, VirtualMachineProvisioned and Paused.
190190
// +optional
191191
// +listType=map
192192
// +listMapKey=type

‎config/default/crd/bases/infrastructure.cluster.x-k8s.io_vspheremachines.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1657,7 +1657,7 @@ spec:
16571657
conditions:
16581658
description: |-
16591659
conditions represents the observations of a VSphereMachine's current state.
1660-
Known condition types are Paused.
1660+
Known condition types are Ready, VirtualMachineProvisioned and Paused.
16611661
items:
16621662
description: Condition contains details for one aspect of the
16631663
current state of this API Resource.

‎config/default/crd/bases/infrastructure.cluster.x-k8s.io_vspherevms.yaml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1726,7 +1726,8 @@ spec:
17261726
conditions:
17271727
description: |-
17281728
conditions represents the observations of a VSphereVM's current state.
1729-
Known condition types are Paused.
1729+
Known condition types are Ready, VirtualMachineProvisioned, VCenterAvailable and IPAddressClaimsFulfilled,
1730+
GuestSoftPowerOffSucceeded, PCIDevicesDetached and Paused.
17301731
items:
17311732
description: Condition contains details for one aspect of the
17321733
current state of this API Resource.

‎config/supervisor/crd/bases/vmware.infrastructure.cluster.x-k8s.io_vspheremachines.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ spec:
281281
conditions:
282282
description: |-
283283
conditions represents the observations of a VSphereMachine's current state.
284-
Known condition types are Paused.
284+
Known condition types are Ready, VirtualMachineProvisioned and Paused.
285285
items:
286286
description: Condition contains details for one aspect of the
287287
current state of this API Resource.

0 commit comments

Comments
 (0)