k8s_openapi/v1_37/api/scheduling/v1beta1/
gang_scheduling_policy.rs1#[derive(Clone, Debug, Default, PartialEq)]
5pub struct GangSchedulingPolicy {
6 pub min_count: i32,
10}
11
12impl crate::DeepMerge for GangSchedulingPolicy {
13 fn merge_from(&mut self, other: Self) {
14 crate::DeepMerge::merge_from(&mut self.min_count, other.min_count);
15 }
16}
17
18impl<'de> crate::serde::Deserialize<'de> for GangSchedulingPolicy {
19 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: crate::serde::Deserializer<'de> {
20 #[allow(non_camel_case_types)]
21 enum Field {
22 Key_min_count,
23 Other,
24 }
25
26 impl<'de> crate::serde::Deserialize<'de> for Field {
27 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: crate::serde::Deserializer<'de> {
28 struct Visitor;
29
30 impl crate::serde::de::Visitor<'_> for Visitor {
31 type Value = Field;
32
33 fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
34 f.write_str("field identifier")
35 }
36
37 fn visit_str<E>(self, v: &str) -> Result<Self::Value, E> where E: crate::serde::de::Error {
38 Ok(match v {
39 "minCount" => Field::Key_min_count,
40 _ => Field::Other,
41 })
42 }
43 }
44
45 deserializer.deserialize_identifier(Visitor)
46 }
47 }
48
49 struct Visitor;
50
51 impl<'de> crate::serde::de::Visitor<'de> for Visitor {
52 type Value = GangSchedulingPolicy;
53
54 fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
55 f.write_str("GangSchedulingPolicy")
56 }
57
58 fn visit_map<A>(self, mut map: A) -> Result<Self::Value, A::Error> where A: crate::serde::de::MapAccess<'de> {
59 let mut value_min_count: Option<i32> = None;
60
61 while let Some(key) = crate::serde::de::MapAccess::next_key::<Field>(&mut map)? {
62 match key {
63 Field::Key_min_count => value_min_count = crate::serde::de::MapAccess::next_value(&mut map)?,
64 Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; },
65 }
66 }
67
68 Ok(GangSchedulingPolicy {
69 min_count: value_min_count.unwrap_or_default(),
70 })
71 }
72 }
73
74 deserializer.deserialize_struct(
75 "GangSchedulingPolicy",
76 &[
77 "minCount",
78 ],
79 Visitor,
80 )
81 }
82}
83
84impl crate::serde::Serialize for GangSchedulingPolicy {
85 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where S: crate::serde::Serializer {
86 let mut state = serializer.serialize_struct(
87 "GangSchedulingPolicy",
88 1,
89 )?;
90 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "minCount", &self.min_count)?;
91 crate::serde::ser::SerializeStruct::end(state)
92 }
93}
94
95#[cfg(feature = "schemars")]
96impl crate::schemars::JsonSchema for GangSchedulingPolicy {
97 fn schema_name() -> std::borrow::Cow<'static, str> {
98 "io.k8s.api.scheduling.v1beta1.GangSchedulingPolicy".into()
99 }
100
101 fn json_schema(__gen: &mut crate::schemars::SchemaGenerator) -> crate::schemars::Schema {
102 crate::schemars::json_schema!({
103 "description": "GangSchedulingPolicy defines the parameters for gang scheduling.",
104 "type": "object",
105 "properties": {
106 "minCount": {
107 "description": "minCount is the minimum number of pods that must be schedulable or scheduled at the same time for the scheduler to admit the entire group. It must be a positive integer. This field is mutable to support workload scaling.\n\nNote that the scheduler operates on an eventually consistent model. Updates to minCount may not be immediately reflected in scheduling decisions due to propagation delays. If minCount is updated while a scheduling cycle is in progress for that group, the new value may not take effect until the next cycle. Moreover, minCount is only enforced during scheduling, meaning that modifications to this field do not affect already-scheduled pods, applying only to those evaluated in future cycles.",
108 "type": "integer",
109 "format": "int32",
110 },
111 },
112 "required": [
113 "minCount",
114 ],
115 })
116 }
117}