@@ -33,6 +33,85 @@ const (
3333 LiveIsoDiskFormat = "live-iso"
3434)
3535
36+ // Metal3Machine's Ready condition and corresponding reasons that will be used in v1Beta2 API version.
37+ const (
38+ // Metal3MachineReadyV1Beta2Condition is true if the Metal3Machine's deletionTimestamp is not set, Metal3Machine's
39+ // BareMetalHostProvisioned is true.
40+ Metal3MachineReadyV1Beta2Condition = clusterv1beta1 .ReadyV1Beta2Condition
41+
42+ // Metal3MachineReadyV1Beta2Reason surfaces when the Metal3Machine readiness criteria is met.
43+ Metal3MachineReadyV1Beta2Reason = clusterv1beta1 .ReadyV1Beta2Reason
44+
45+ // Metal3MachineNotReadyV1Beta2Reason surfaces when the Metal3Machine readiness criteria is not met.
46+ Metal3MachineNotReadyV1Beta2Reason = clusterv1beta1 .NotReadyV1Beta2Reason
47+
48+ // Metal3MachineReadyUnknownV1Beta2Reason surfaces when at least one Metal3Machine readiness criteria is unknown
49+ // and no Metal3Machine readiness criteria is not met.
50+ Metal3MachineReadyUnknownV1Beta2Reason = clusterv1beta1 .ReadyUnknownV1Beta2Reason
51+ )
52+
53+ // Metal3Machine condition and corresponding reasons that will be used in v1Beta2 API version.
54+ const (
55+ // AssociateBareMetalHostV1Beta2Condition documents the status of the association of Metal3Machine with a BareMetalHost.
56+ AssociateBareMetalHostV1Beta2Condition = "AssociateBareMetalHost"
57+
58+ // AssociateBareMetalHostFailedV1Beta2Reason documents any errors while associating Metal3Machine with a BareMetalHost.
59+ AssociateBareMetalHostFailedV1Beta2Reason = "AssociateBareMetalHostFailed"
60+
61+ // AssociateBareMetalHostSuccessV1Beta2Reason surfaces when the Metal3Machine is successfully associated with a BareMetalHost.
62+ AssociateBareMetalHostSuccessV1Beta2Reason = "AssociateBareMetalHostSuccess"
63+
64+ // WaitingForClusterInfrastructureReadyV1Beta2Reason used when waiting for cluster
65+ // infrastructure to be ready before proceeding.
66+ WaitingForClusterInfrastructureReadyV1Beta2Reason = clusterv1beta1 .WaitingForClusterInfrastructureReadyV1Beta2Reason
67+
68+ // WaitingForBootstrapDataV1Beta2Reason used when waiting for bootstrap to be ready before proceeding.
69+ WaitingForBootstrapDataV1Beta2Reason = clusterv1beta1 .WaitingForBootstrapDataV1Beta2Reason
70+
71+ // WaitingForMetal3MachineOwnerRefV1Beta2Reason is used when Metal3Machine is waiting for OwnerReference to be
72+ // set before proceeding.
73+ WaitingForMetal3MachineOwnerRefV1Beta2Reason = "WaitingForMetal3MachineOwnerRef"
74+
75+ // WaitingforMetal3ClusterReason is used when Metal3Machine is waiting for Metal3Cluster.
76+ WaitingforMetal3ClusterV1Beta2Reason = "WaitingforMetal3Cluster"
77+
78+ // BareMetalHostPauseAnnotationRemoveFailedV1Beta2Reason is used when failed to remove/check pause annotation on associated BareMetalHost.
79+ BareMetalHostPauseAnnotationRemoveFailedV1Beta2Reason = "BareMetalHostPauseAnnotationRemoveFailed"
80+
81+ // BareMetalHostPauseAnnotationSetFailedV1Beta2Reason is used when failed to set pause annotation on associated BareMetalHost.
82+ BareMetalHostPauseAnnotationSetFailedV1Beta2Reason = "BareMetalHostPauseAnnotationSetFailed"
83+
84+ // AssociateMetal3MachineMetaDataV1Beta2Condition documents the transition of a Metal3Machine into a Kubernetes Node.
85+ AssociateMetal3MachineMetaDataV1Beta2Condition = "AssociateMetal3MachineMetaData"
86+
87+ // AssociateMetal3MachineMetaDataFailedV1Beta2Reason is used when failed to associate Metadata to Metal3Machine.
88+ AssociateMetal3MachineMetaDataFailedV1Beta2Reason = "AssociateMetal3MachineMetaDataFailed"
89+
90+ // AssociateMetal3MachineMetaDataSuccessV1Beta2Reason is used when successfully associated Metadata to Metal3Machine.
91+ AssociateMetal3MachineMetaDataSuccessV1Beta2Reason = "AssociateMetal3MachineMetaDataSuccess"
92+
93+ // Metal3DataReadyV1Beta2Condition reports a summary of Metal3Data status.
94+ Metal3DataReadyV1Beta2Condition = "Metal3DataReady"
95+
96+ // WaitingForMetal3DataV1Beta2Reason used when waiting for Metal3Data
97+ // to be ready before proceeding.
98+ WaitingForMetal3DataV1Beta2Reason = "WaitingForMetal3Data"
99+
100+ // Metal3DataSecretsReadyV1Beta2Reason used when metal3data secrets are ready
101+ // to be ready before proceeding.
102+ Metal3DataSecretsReadyV1Beta2Reason = "Metal3DataSecretsReady"
103+
104+ // DisassociateM3MetaDataFailedReason is used when failed to remove OwnerReference of Meta3DataTemplate.
105+ DisassociateM3MetaDataFailedV1Beta2Reason = "DisassociateM3MetaDataFailed"
106+
107+ // DeletingV1Beta2Reason (Severity=Info) documents a condition not in Status=True because the underlying object it is currently being deleted.
108+ Metal3MachineDeletingV1Beta2Reason = clusterv1beta1 .DeletingV1Beta2Reason
109+
110+ // Metal3MachineDeletingFailedV1Beta2Reason (Severity=Warning) documents a condition not in Status=True because the underlying object
111+ // encountered problems during deletion. This is a warning because the reconciler will retry deletion.
112+ Metal3MachineDeletingFailedV1Beta2Reason = "DeletionFailed"
113+ )
114+
36115// Metal3MachineSpec defines the desired state of Metal3Machine.
37116type Metal3MachineSpec struct {
38117 // ProviderID will be the Metal3 machine in ProviderID format
@@ -168,6 +247,22 @@ type Metal3MachineStatus struct {
168247 // Conditions defines current service state of the Metal3Machine.
169248 // +optional
170249 Conditions clusterv1beta1.Conditions `json:"conditions,omitempty"`
250+
251+ // v1beta2 groups all the fields that will be added or modified in Metal3Machine's status with the V1Beta2 version.
252+ // +optional
253+ V1Beta2 * Metal3MachineV1Beta2Status `json:"v1beta2,omitempty"`
254+ }
255+
256+ // Metal3MachineV1Beta2Status groups all the fields that will be added or modified in Metal3MachineStatus with the V1Beta2 version.
257+ // See https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more context.
258+ type Metal3MachineV1Beta2Status struct {
259+ // conditions represents the observations of a Metal3Machine's current state.
260+ // Known condition types are Ready, AssociateBareMetalHost, KubernetesNodeReady, Metal3DataReady and Paused.
261+ // +optional
262+ // +listType=map
263+ // +listMapKey=type
264+ // +kubebuilder:validation:MaxItems=32
265+ Conditions []metav1.Condition `json:"conditions,omitempty"`
171266}
172267
173268// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
@@ -216,3 +311,19 @@ func (c *Metal3Machine) SetConditions(conditions clusterv1beta1.Conditions) {
216311func init () {
217312 objectTypes = append (objectTypes , & Metal3Machine {}, & Metal3MachineList {})
218313}
314+
315+ // GetV1Beta2Conditions returns the set of conditions for this object.
316+ func (c * Metal3Machine ) GetV1Beta2Conditions () []metav1.Condition {
317+ if c .Status .V1Beta2 == nil {
318+ return nil
319+ }
320+ return c .Status .V1Beta2 .Conditions
321+ }
322+
323+ // SetV1Beta2Conditions sets conditions for an API object.
324+ func (c * Metal3Machine ) SetV1Beta2Conditions (conditions []metav1.Condition ) {
325+ if c .Status .V1Beta2 == nil {
326+ c .Status .V1Beta2 = & Metal3MachineV1Beta2Status {}
327+ }
328+ c .Status .V1Beta2 .Conditions = conditions
329+ }
0 commit comments