Skip to content

Commit b375131

Browse files
committed
Add v1beta2 conditions to IBMPowerVSMachine
1 parent 757bcce commit b375131

File tree

5 files changed

+150
-10
lines changed

5 files changed

+150
-10
lines changed

api/v1beta1/ibmpowervs_conversion.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,3 +208,8 @@ func Convert_v1beta2_IBMPowerVSClusterStatus_To_v1beta1_IBMPowerVSClusterStatus(
208208
func Convert_v1beta2_IBMPowerVSImageSpec_To_v1beta1_IBMPowerVSImageSpec(in *infrav1beta2.IBMPowerVSImageSpec, out *IBMPowerVSImageSpec, s apiconversion.Scope) error {
209209
return autoConvert_v1beta2_IBMPowerVSImageSpec_To_v1beta1_IBMPowerVSImageSpec(in, out, s)
210210
}
211+
212+
func Convert_v1beta2_IBMPowerVSMachineStatus_To_v1beta1_IBMPowerVSMachineStatus(in *infrav1beta2.IBMPowerVSMachineStatus, out *IBMPowerVSMachineStatus, s apiconversion.Scope) error {
213+
// CAPI V1Beta2 was added in CAPIBM v1beta2
214+
return autoConvert_v1beta2_IBMPowerVSMachineStatus_To_v1beta1_IBMPowerVSMachineStatus(in, out, s)
215+
}

api/v1beta1/zz_generated.conversion.go

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

api/v1beta2/ibmpowervsmachine_types.go

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,9 @@ type IBMPowerVSMachineStatus struct {
197197
// Any transient errors that occur during the reconciliation of Machines
198198
// can be added as events to the Machine object and/or logged in the
199199
// controller's output.
200+
//
201+
// Deprecated: This field is deprecated and is going to be removed in the next apiVersion. Please see https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more details.
202+
//
200203
// +optional
201204
FailureReason *string `json:"failureReason,omitempty"`
202205

@@ -216,6 +219,9 @@ type IBMPowerVSMachineStatus struct {
216219
// Any transient errors that occur during the reconciliation of Machines
217220
// can be added as events to the Machine object and/or logged in the
218221
// controller's output.
222+
//
223+
// Deprecated: This field is deprecated and is going to be removed in the next apiVersion. Please see https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more details.
224+
//
219225
// +optional
220226
FailureMessage *string `json:"failureMessage,omitempty"`
221227

@@ -228,6 +234,22 @@ type IBMPowerVSMachineStatus struct {
228234

229235
// Zone specifies the Power VS Service instance zone.
230236
Zone *string `json:"zone,omitempty"`
237+
238+
// v1beta2 groups all the fields that will be added or modified in IBMPowerVSMachine's status with the V1Beta2 version.
239+
// +optional
240+
V1Beta2 *IBMPowerVSMachineV1Beta2Status `json:"v1beta2,omitempty"`
241+
}
242+
243+
// IBMPowerVSMachineV1Beta2Status groups all the fields that will be added or modified in IBMPowerVSMachineStatus with the V1Beta2 version.
244+
// See https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more context.
245+
type IBMPowerVSMachineV1Beta2Status struct {
246+
// conditions represents the observations of a IBMPowerVSMachine's current state.
247+
// Known condition types are Ready, InstanceReady and Paused.
248+
// +optional
249+
// +listType=map
250+
// +listMapKey=type
251+
// +kubebuilder:validation:MaxItems=32
252+
Conditions []metav1.Condition `json:"conditions,omitempty"`
231253
}
232254

233255
// +kubebuilder:object:root=true
@@ -261,6 +283,22 @@ func (r *IBMPowerVSMachine) SetConditions(conditions capiv1beta1.Conditions) {
261283
r.Status.Conditions = conditions
262284
}
263285

286+
// GetV1Beta2Conditions returns the set of conditions for this object.
287+
func (r *IBMPowerVSMachine) GetV1Beta2Conditions() []metav1.Condition {
288+
if r.Status.V1Beta2 == nil {
289+
return nil
290+
}
291+
return r.Status.V1Beta2.Conditions
292+
}
293+
294+
// SetV1Beta2Conditions sets conditions for an API object.
295+
func (r *IBMPowerVSMachine) SetV1Beta2Conditions(conditions []metav1.Condition) {
296+
if r.Status.V1Beta2 == nil {
297+
r.Status.V1Beta2 = &IBMPowerVSMachineV1Beta2Status{}
298+
}
299+
r.Status.V1Beta2.Conditions = conditions
300+
}
301+
264302
//+kubebuilder:object:root=true
265303

266304
// IBMPowerVSMachineList contains a list of IBMPowerVSMachine.

api/v1beta2/zz_generated.deepcopy.go

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

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

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -593,6 +593,8 @@ spec:
593593
Any transient errors that occur during the reconciliation of Machines
594594
can be added as events to the Machine object and/or logged in the
595595
controller's output.
596+
597+
Deprecated: This field is deprecated and is going to be removed in the next apiVersion. Please see https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more details.
596598
type: string
597599
failureReason:
598600
description: |-
@@ -612,6 +614,8 @@ spec:
612614
Any transient errors that occur during the reconciliation of Machines
613615
can be added as events to the Machine object and/or logged in the
614616
controller's output.
617+
618+
Deprecated: This field is deprecated and is going to be removed in the next apiVersion. Please see https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more details.
615619
type: string
616620
fault:
617621
description: Fault will report if any fault messages for the vsi.
@@ -630,6 +634,75 @@ spec:
630634
region:
631635
description: Region specifies the Power VS Service instance region.
632636
type: string
637+
v1beta2:
638+
description: v1beta2 groups all the fields that will be added or modified
639+
in IBMPowerVSMachine's status with the V1Beta2 version.
640+
properties:
641+
conditions:
642+
description: |-
643+
conditions represents the observations of a IBMPowerVSMachine's current state.
644+
Known condition types are Ready, InstanceReady and Paused.
645+
items:
646+
description: Condition contains details for one aspect of the
647+
current state of this API Resource.
648+
properties:
649+
lastTransitionTime:
650+
description: |-
651+
lastTransitionTime is the last time the condition transitioned from one status to another.
652+
This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.
653+
format: date-time
654+
type: string
655+
message:
656+
description: |-
657+
message is a human readable message indicating details about the transition.
658+
This may be an empty string.
659+
maxLength: 32768
660+
type: string
661+
observedGeneration:
662+
description: |-
663+
observedGeneration represents the .metadata.generation that the condition was set based upon.
664+
For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date
665+
with respect to the current state of the instance.
666+
format: int64
667+
minimum: 0
668+
type: integer
669+
reason:
670+
description: |-
671+
reason contains a programmatic identifier indicating the reason for the condition's last transition.
672+
Producers of specific condition types may define expected values and meanings for this field,
673+
and whether the values are considered a guaranteed API.
674+
The value should be a CamelCase string.
675+
This field may not be empty.
676+
maxLength: 1024
677+
minLength: 1
678+
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
679+
type: string
680+
status:
681+
description: status of the condition, one of True, False,
682+
Unknown.
683+
enum:
684+
- "True"
685+
- "False"
686+
- Unknown
687+
type: string
688+
type:
689+
description: type of condition in CamelCase or in foo.example.com/CamelCase.
690+
maxLength: 316
691+
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
692+
type: string
693+
required:
694+
- lastTransitionTime
695+
- message
696+
- reason
697+
- status
698+
- type
699+
type: object
700+
maxItems: 32
701+
type: array
702+
x-kubernetes-list-map-keys:
703+
- type
704+
x-kubernetes-list-type: map
705+
type: object
633706
zone:
634707
description: Zone specifies the Power VS Service instance zone.
635708
type: string

0 commit comments

Comments
 (0)