Skip to main content

k8s_openapi/v1_37/api/scheduling/v1alpha3/
composite_pod_group_status.rs

1// Generated from definition io.k8s.api.scheduling.v1alpha3.CompositePodGroupStatus
2
3/// CompositePodGroupStatus represents information about the status of a composite pod group.
4#[derive(Clone, Debug, Default, PartialEq)]
5pub struct CompositePodGroupStatus {
6    /// conditions represent the latest observations of the CompositePodGroup's state.
7    ///
8    /// Known condition types: - "CompositePodGroupInitiallyScheduled": Indicates whether the overall scheduling requirement
9    ///   for the subtree under this CompositePodGroup has been satisfied. Once this condition
10    ///   transitions to True, it serves as a terminal state and will never revert to False,
11    ///   even if pods are subsequently deleted and group constraints are no longer met.
12    /// - "DisruptionTarget": Indicates whether the CompositePodGroup is about to be terminated
13    ///   due to disruption such as preemption.
14    ///
15    /// Known reasons for the CompositePodGroupInitiallyScheduled condition: - "Unschedulable": The CompositePodGroup's subtree could not be placed due to resource constraints,
16    ///   affinity/anti-affinity, or topological constraints.
17    /// - "SchedulerError": The CompositePodGroup cannot be scheduled due to some internal error
18    ///   that occurred during scheduling.
19    /// - "Invalid": Set to True when kube-scheduler detects an invalid group layout during
20    ///   runtime validation. The `message` field details the specific layout violation (such as
21    ///   a detected cycle, exceeding the maximum depth of 4, or referencing multiple distinct Workloads).
22    ///
23    /// Known reasons for the DisruptionTarget condition: - "PreemptionByScheduler": The CompositePodGroup was targeted by the scheduler's preemption loop
24    ///   to free up capacity for higher-priority preemptors.
25    pub conditions: Option<std::vec::Vec<crate::apimachinery::pkg::apis::meta::v1::Condition>>,
26}
27
28impl crate::DeepMerge for CompositePodGroupStatus {
29    fn merge_from(&mut self, other: Self) {
30        crate::merge_strategies::list::map(
31            &mut self.conditions,
32            other.conditions,
33            &[|lhs, rhs| lhs.type_ == rhs.type_],
34            |current_item, other_item| {
35                crate::DeepMerge::merge_from(current_item, other_item);
36            },
37        );
38    }
39}
40
41impl<'de> crate::serde::Deserialize<'de> for CompositePodGroupStatus {
42    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: crate::serde::Deserializer<'de> {
43        #[allow(non_camel_case_types)]
44        enum Field {
45            Key_conditions,
46            Other,
47        }
48
49        impl<'de> crate::serde::Deserialize<'de> for Field {
50            fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: crate::serde::Deserializer<'de> {
51                struct Visitor;
52
53                impl crate::serde::de::Visitor<'_> for Visitor {
54                    type Value = Field;
55
56                    fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
57                        f.write_str("field identifier")
58                    }
59
60                    fn visit_str<E>(self, v: &str) -> Result<Self::Value, E> where E: crate::serde::de::Error {
61                        Ok(match v {
62                            "conditions" => Field::Key_conditions,
63                            _ => Field::Other,
64                        })
65                    }
66                }
67
68                deserializer.deserialize_identifier(Visitor)
69            }
70        }
71
72        struct Visitor;
73
74        impl<'de> crate::serde::de::Visitor<'de> for Visitor {
75            type Value = CompositePodGroupStatus;
76
77            fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
78                f.write_str("CompositePodGroupStatus")
79            }
80
81            fn visit_map<A>(self, mut map: A) -> Result<Self::Value, A::Error> where A: crate::serde::de::MapAccess<'de> {
82                let mut value_conditions: Option<std::vec::Vec<crate::apimachinery::pkg::apis::meta::v1::Condition>> = None;
83
84                while let Some(key) = crate::serde::de::MapAccess::next_key::<Field>(&mut map)? {
85                    match key {
86                        Field::Key_conditions => value_conditions = crate::serde::de::MapAccess::next_value(&mut map)?,
87                        Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; },
88                    }
89                }
90
91                Ok(CompositePodGroupStatus {
92                    conditions: value_conditions,
93                })
94            }
95        }
96
97        deserializer.deserialize_struct(
98            "CompositePodGroupStatus",
99            &[
100                "conditions",
101            ],
102            Visitor,
103        )
104    }
105}
106
107impl crate::serde::Serialize for CompositePodGroupStatus {
108    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where S: crate::serde::Serializer {
109        let mut state = serializer.serialize_struct(
110            "CompositePodGroupStatus",
111            self.conditions.as_ref().map_or(0, |_| 1),
112        )?;
113        if let Some(value) = &self.conditions {
114            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "conditions", value)?;
115        }
116        crate::serde::ser::SerializeStruct::end(state)
117    }
118}
119
120#[cfg(feature = "schemars")]
121impl crate::schemars::JsonSchema for CompositePodGroupStatus {
122    fn schema_name() -> std::borrow::Cow<'static, str> {
123        "io.k8s.api.scheduling.v1alpha3.CompositePodGroupStatus".into()
124    }
125
126    fn json_schema(__gen: &mut crate::schemars::SchemaGenerator) -> crate::schemars::Schema {
127        crate::schemars::json_schema!({
128            "description": "CompositePodGroupStatus represents information about the status of a composite pod group.",
129            "type": "object",
130            "properties": {
131                "conditions": {
132                    "description": "conditions represent the latest observations of the CompositePodGroup's state.\n\nKnown condition types: - \"CompositePodGroupInitiallyScheduled\": Indicates whether the overall scheduling requirement\n  for the subtree under this CompositePodGroup has been satisfied. Once this condition\n  transitions to True, it serves as a terminal state and will never revert to False,\n  even if pods are subsequently deleted and group constraints are no longer met.\n- \"DisruptionTarget\": Indicates whether the CompositePodGroup is about to be terminated\n  due to disruption such as preemption.\n\nKnown reasons for the CompositePodGroupInitiallyScheduled condition: - \"Unschedulable\": The CompositePodGroup's subtree could not be placed due to resource constraints,\n  affinity/anti-affinity, or topological constraints.\n- \"SchedulerError\": The CompositePodGroup cannot be scheduled due to some internal error\n  that occurred during scheduling.\n- \"Invalid\": Set to True when kube-scheduler detects an invalid group layout during\n  runtime validation. The `message` field details the specific layout violation (such as\n  a detected cycle, exceeding the maximum depth of 4, or referencing multiple distinct Workloads).\n\nKnown reasons for the DisruptionTarget condition: - \"PreemptionByScheduler\": The CompositePodGroup was targeted by the scheduler's preemption loop\n  to free up capacity for higher-priority preemptors.",
133                    "type": "array",
134                    "items": (__gen.subschema_for::<crate::apimachinery::pkg::apis::meta::v1::Condition>()),
135                },
136            },
137        })
138    }
139}