k8s_cluster_api/v1beta1/cluster/condition.rs
1use super::*;
2
3// ANCHOR: ConditionSeverity
4
5// ConditionSeverity expresses the severity of a Condition Type failing.
6#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Serialize)]
7pub enum ConditionSeverity {
8 // ConditionSeverityError specifies that a condition with `Status=False` is an error.
9 Error,
10
11 // ConditionSeverityWarning specifies that a condition with `Status=False` is a warning.
12 Warning,
13
14 // ConditionSeverityInfo specifies that a condition with `Status=False` is informative.
15 Info,
16
17 // ConditionSeverityNone should apply only to conditions with `Status=True`.
18 #[serde(rename = "")]
19 None,
20}
21
22// ANCHOR_END: ConditionSeverity
23
24#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Serialize)]
25pub enum ConditionStatus {
26 True,
27 False,
28 Unknown,
29}
30
31// ANCHOR: ConditionType
32
33// ConditionType is a valid value for Condition.Type.
34pub type ConditionType = String;
35
36// ANCHOR_END: ConditionType
37
38// ANCHOR: Condition
39
40// Condition defines an observation of a Cluster API resource operational state.
41#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
42#[serde(rename_all = "camelCase")]
43pub struct Condition {
44 // Type of condition in CamelCase or in foo.example.com/CamelCase.
45 // Many .condition.type values are consistent across resources like Available, but because arbitrary conditions
46 // can be useful (see .node.status.conditions), the ability to deconflict is important.
47 pub r#type: ConditionType,
48
49 // Status of the condition, one of True, False, Unknown.
50 pub status: ConditionStatus,
51
52 // Severity provides an explicit classification of Reason code, so the users or machines can immediately
53 // understand the current situation and act accordingly.
54 // The Severity field MUST be set only when Status=False.
55 // +optional
56 pub severity: Option<ConditionSeverity>,
57
58 // Last time the condition transitioned from one status to another.
59 // This should be when the underlying condition changed. If that is not known, then using the time when
60 // the API field changed is acceptable.
61 pub last_transition_time: metav1::Time,
62
63 // The reason for the condition's last transition in CamelCase.
64 // The specific API may choose whether or not this field is considered a guaranteed API.
65 // This field may not be empty.
66 // +optional
67 pub reason: Option<String>,
68
69 // A human readable message indicating details about the transition.
70 // This field may be empty.
71 // +optional
72 pub message: Option<String>,
73}
74
75// ANCHOR_END: Condition
76
77// ANCHOR: Conditions
78
79// Conditions provide observations of the operational state of a Cluster API resource.
80pub type Conditions = Vec<Condition>;
81
82// ANCHOR_END: Conditions