Skip to content

Commit 5f1ec6d

Browse files
committed
Adopt v1beta2 conditions for IBM VPC Machine
1 parent 264ac1e commit 5f1ec6d

9 files changed

+559
-142
lines changed

api/v1beta1/zz_generated.conversion.go

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

api/v1beta2/conditions_consts.go

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,35 @@ const (
3737
IBMPowerVSMachineReadyUnknownV1Beta2Reason = clusterv1beta1.ReadyUnknownV1Beta2Reason
3838
)
3939

40+
const (
41+
// IBMVPCMachineReadyV1Beta2Condition is true if the IBMVPCMachine's deletionTimestamp is not set, IBMVPCMachine's
42+
// IBMVPCMachineInstanceReadyV1Beta2Condition is true.
43+
IBMVPCMachineReadyV1Beta2Condition = clusterv1beta1.ReadyV1Beta2Condition
44+
45+
// IBMVPCMachineReadyV1Beta2Reason surfaces when the IBMVPCMachine readiness criteria is met.
46+
IBMVPCMachineReadyV1Beta2Reason = clusterv1beta1.ReadyV1Beta2Reason
47+
48+
// IBMVPCMachineNotReadyV1Beta2Reason surfaces when the IBMVPCMachine readiness criteria is not met.
49+
IBMVPCMachineNotReadyV1Beta2Reason = clusterv1beta1.NotReadyV1Beta2Reason
50+
51+
// IBMVPCMachineReadyUnknownV1Beta2Reason surfaces when at least one IBMVPCMachine readiness criteria is unknown.
52+
IBMVPCMachineReadyUnknownV1Beta2Reason = clusterv1beta1.ReadyUnknownV1Beta2Reason
53+
)
54+
55+
// IBMVPCMachine's InstanceReady condition and corresponding reasons that will be used in v1Beta2 API version.
56+
const (
57+
// IBMVPCMachineInstanceReadyV1Beta2Condition documents the status of the instance that is controlled
58+
// by the IBMVPCMachine.
59+
IBMVPCMachineInstanceReadyV1Beta2Condition = "InstanceReady"
60+
61+
// IBMVPCMachineInstanceReadyV1Beta2Reason surfaces when the instance that is controlled
62+
// by the IBMVPCMachine is ready.
63+
IBMVPCMachineInstanceReadyV1Beta2Reason = "InstanceReady"
64+
65+
// IBMVPCMachineInstanceNotReadyV1Beta2Reason surfaces when the instance that is controlled
66+
// by the IBMVPCMachine is not ready.
67+
IBMVPCMachineInstanceNotReadyV1Beta2Reason = "InstanceNotReady"
68+
)
4069
const (
4170
// IBMPowerVSMachineInstanceReadyV1Beta2Condition documents the status of the instance that is controlled
4271
// by the IBMPowerVSMachine.
@@ -95,6 +124,9 @@ const (
95124
// InstanceNotReadyReason used when the instance is in a not ready state.
96125
InstanceNotReadyReason = "InstanceNotReady"
97126

127+
// InstanceDeletingReason is used when the instance is in deleting state.
128+
InstanceDeletingReason = "InstanceDeleting"
129+
98130
// InstanceStateUnknownReason used when the instance is in a unknown state.
99131
InstanceStateUnknownReason = "InstanceStateUnknown"
100132
)

api/v1beta2/ibmvpcmachine_types.go

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,21 @@ type IBMVPCMachineStatus struct {
175175
// LoadBalancerPoolMembers is the status of IBM Cloud VPC Load Balancer Backend Pools the machine is a member.
176176
// +optional
177177
LoadBalancerPoolMembers []VPCLoadBalancerBackendPoolMember `json:"loadBalancerPoolMembers,omitempty"`
178+
179+
// V1beta2 groups all the fields that will be added or modified in IBMVPCMachine's status with the V1Beta2 version.
180+
// +optional
181+
V1Beta2 *IBMVPCMachineV1Beta2Status `json:"v1beta2,omitempty"`
182+
}
183+
184+
// IBMVPCMachineV1Beta2Status groups all the fields that will be added or modified in IBMVPCMachineStatus with the V1Beta2 version.
185+
// See https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more context.
186+
type IBMVPCMachineV1Beta2Status struct {
187+
// Conditions represents the observations of a IBMVPCMachine's current state.
188+
// +optional
189+
// +listType=map
190+
// +listMapKey=type
191+
// +kubebuilder:validation:MaxItems=32
192+
Conditions []metav1.Condition `json:"conditions,omitempty"`
178193
}
179194

180195
// +kubebuilder:object:root=true
@@ -211,6 +226,22 @@ type IBMVPCMachineList struct {
211226
Items []IBMVPCMachine `json:"items"`
212227
}
213228

229+
// GetV1Beta2Conditions returns the set of conditions for IBMVPCMachine object.
230+
func (r *IBMVPCMachine) GetV1Beta2Conditions() []metav1.Condition {
231+
if r.Status.V1Beta2 == nil {
232+
return nil
233+
}
234+
return r.Status.V1Beta2.Conditions
235+
}
236+
237+
// SetV1Beta2Conditions sets conditions for IBMVPCMachine object.
238+
func (r *IBMVPCMachine) SetV1Beta2Conditions(conditions []metav1.Condition) {
239+
if r.Status.V1Beta2 == nil {
240+
r.Status.V1Beta2 = &IBMVPCMachineV1Beta2Status{}
241+
}
242+
r.Status.V1Beta2.Conditions = conditions
243+
}
244+
214245
func init() {
215246
objectTypes = append(objectTypes, &IBMVPCMachine{}, &IBMVPCMachineList{})
216247
}

api/v1beta2/zz_generated.deepcopy.go

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

0 commit comments

Comments
 (0)