k8s_openapi/v1_33/api/batch/v1/
job_spec.rs

1// Generated from definition io.k8s.api.batch.v1.JobSpec
2
3/// JobSpec describes how the job execution will look like.
4#[derive(Clone, Debug, Default, PartialEq)]
5pub struct JobSpec {
6    /// Specifies the duration in seconds relative to the startTime that the job may be continuously active before the system tries to terminate it; value must be positive integer. If a Job is suspended (at creation or through an update), this timer will effectively be stopped and reset when the Job is resumed again.
7    pub active_deadline_seconds: Option<i64>,
8
9    /// Specifies the number of retries before marking this job failed. Defaults to 6
10    pub backoff_limit: Option<i32>,
11
12    /// Specifies the limit for the number of retries within an index before marking this index as failed. When enabled the number of failures per index is kept in the pod's batch.kubernetes.io/job-index-failure-count annotation. It can only be set when Job's completionMode=Indexed, and the Pod's restart policy is Never. The field is immutable.
13    pub backoff_limit_per_index: Option<i32>,
14
15    /// completionMode specifies how Pod completions are tracked. It can be `NonIndexed` (default) or `Indexed`.
16    ///
17    /// `NonIndexed` means that the Job is considered complete when there have been .spec.completions successfully completed Pods. Each Pod completion is homologous to each other.
18    ///
19    /// `Indexed` means that the Pods of a Job get an associated completion index from 0 to (.spec.completions - 1), available in the annotation batch.kubernetes.io/job-completion-index. The Job is considered complete when there is one successfully completed Pod for each index. When value is `Indexed`, .spec.completions must be specified and `.spec.parallelism` must be less than or equal to 10^5. In addition, The Pod name takes the form `$(job-name)-$(index)-$(random-string)`, the Pod hostname takes the form `$(job-name)-$(index)`.
20    ///
21    /// More completion modes can be added in the future. If the Job controller observes a mode that it doesn't recognize, which is possible during upgrades due to version skew, the controller skips updates for the Job.
22    pub completion_mode: Option<std::string::String>,
23
24    /// Specifies the desired number of successfully finished pods the job should be run with.  Setting to null means that the success of any pod signals the success of all pods, and allows parallelism to have any positive value.  Setting to 1 means that parallelism is limited to 1 and the success of that pod signals the success of the job. More info: https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/
25    pub completions: Option<i32>,
26
27    /// ManagedBy field indicates the controller that manages a Job. The k8s Job controller reconciles jobs which don't have this field at all or the field value is the reserved string `kubernetes.io/job-controller`, but skips reconciling Jobs with a custom value for this field. The value must be a valid domain-prefixed path (e.g. acme.io/foo) - all characters before the first "/" must be a valid subdomain as defined by RFC 1123. All characters trailing the first "/" must be valid HTTP Path characters as defined by RFC 3986. The value cannot exceed 63 characters. This field is immutable.
28    ///
29    /// This field is beta-level. The job controller accepts setting the field when the feature gate JobManagedBy is enabled (enabled by default).
30    pub managed_by: Option<std::string::String>,
31
32    /// manualSelector controls generation of pod labels and pod selectors. Leave `manualSelector` unset unless you are certain what you are doing. When false or unset, the system pick labels unique to this job and appends those labels to the pod template.  When true, the user is responsible for picking unique labels and specifying the selector.  Failure to pick a unique label may cause this and other jobs to not function correctly.  However, You may see `manualSelector=true` in jobs that were created with the old `extensions/v1beta1` API. More info: https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/#specifying-your-own-pod-selector
33    pub manual_selector: Option<bool>,
34
35    /// Specifies the maximal number of failed indexes before marking the Job as failed, when backoffLimitPerIndex is set. Once the number of failed indexes exceeds this number the entire Job is marked as Failed and its execution is terminated. When left as null the job continues execution of all of its indexes and is marked with the `Complete` Job condition. It can only be specified when backoffLimitPerIndex is set. It can be null or up to completions. It is required and must be less than or equal to 10^4 when is completions greater than 10^5.
36    pub max_failed_indexes: Option<i32>,
37
38    /// Specifies the maximum desired number of pods the job should run at any given time. The actual number of pods running in steady state will be less than this number when ((.spec.completions - .status.successful) \< .spec.parallelism), i.e. when the work left to do is less than max parallelism. More info: https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/
39    pub parallelism: Option<i32>,
40
41    /// Specifies the policy of handling failed pods. In particular, it allows to specify the set of actions and conditions which need to be satisfied to take the associated action. If empty, the default behaviour applies - the counter of failed pods, represented by the jobs's .status.failed field, is incremented and it is checked against the backoffLimit. This field cannot be used in combination with restartPolicy=OnFailure.
42    pub pod_failure_policy: Option<crate::api::batch::v1::PodFailurePolicy>,
43
44    /// podReplacementPolicy specifies when to create replacement Pods. Possible values are: - TerminatingOrFailed means that we recreate pods
45    ///   when they are terminating (has a metadata.deletionTimestamp) or failed.
46    /// - Failed means to wait until a previously created Pod is fully terminated (has phase
47    ///   Failed or Succeeded) before creating a replacement Pod.
48    ///
49    /// When using podFailurePolicy, Failed is the the only allowed value. TerminatingOrFailed and Failed are allowed values when podFailurePolicy is not in use. This is an beta field. To use this, enable the JobPodReplacementPolicy feature toggle. This is on by default.
50    pub pod_replacement_policy: Option<std::string::String>,
51
52    /// A label query over pods that should match the pod count. Normally, the system sets this field for you. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors
53    pub selector: Option<crate::apimachinery::pkg::apis::meta::v1::LabelSelector>,
54
55    /// successPolicy specifies the policy when the Job can be declared as succeeded. If empty, the default behavior applies - the Job is declared as succeeded only when the number of succeeded pods equals to the completions. When the field is specified, it must be immutable and works only for the Indexed Jobs. Once the Job meets the SuccessPolicy, the lingering pods are terminated.
56    pub success_policy: Option<crate::api::batch::v1::SuccessPolicy>,
57
58    /// suspend specifies whether the Job controller should create Pods or not. If a Job is created with suspend set to true, no Pods are created by the Job controller. If a Job is suspended after creation (i.e. the flag goes from false to true), the Job controller will delete all active Pods associated with this Job. Users must design their workload to gracefully handle this. Suspending a Job will reset the StartTime field of the Job, effectively resetting the ActiveDeadlineSeconds timer too. Defaults to false.
59    pub suspend: Option<bool>,
60
61    /// Describes the pod that will be created when executing a job. The only allowed template.spec.restartPolicy values are "Never" or "OnFailure". More info: https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/
62    pub template: crate::api::core::v1::PodTemplateSpec,
63
64    /// ttlSecondsAfterFinished limits the lifetime of a Job that has finished execution (either Complete or Failed). If this field is set, ttlSecondsAfterFinished after the Job finishes, it is eligible to be automatically deleted. When the Job is being deleted, its lifecycle guarantees (e.g. finalizers) will be honored. If this field is unset, the Job won't be automatically deleted. If this field is set to zero, the Job becomes eligible to be deleted immediately after it finishes.
65    pub ttl_seconds_after_finished: Option<i32>,
66}
67
68impl crate::DeepMerge for JobSpec {
69    fn merge_from(&mut self, other: Self) {
70        crate::DeepMerge::merge_from(&mut self.active_deadline_seconds, other.active_deadline_seconds);
71        crate::DeepMerge::merge_from(&mut self.backoff_limit, other.backoff_limit);
72        crate::DeepMerge::merge_from(&mut self.backoff_limit_per_index, other.backoff_limit_per_index);
73        crate::DeepMerge::merge_from(&mut self.completion_mode, other.completion_mode);
74        crate::DeepMerge::merge_from(&mut self.completions, other.completions);
75        crate::DeepMerge::merge_from(&mut self.managed_by, other.managed_by);
76        crate::DeepMerge::merge_from(&mut self.manual_selector, other.manual_selector);
77        crate::DeepMerge::merge_from(&mut self.max_failed_indexes, other.max_failed_indexes);
78        crate::DeepMerge::merge_from(&mut self.parallelism, other.parallelism);
79        crate::DeepMerge::merge_from(&mut self.pod_failure_policy, other.pod_failure_policy);
80        crate::DeepMerge::merge_from(&mut self.pod_replacement_policy, other.pod_replacement_policy);
81        crate::DeepMerge::merge_from(&mut self.selector, other.selector);
82        crate::DeepMerge::merge_from(&mut self.success_policy, other.success_policy);
83        crate::DeepMerge::merge_from(&mut self.suspend, other.suspend);
84        crate::DeepMerge::merge_from(&mut self.template, other.template);
85        crate::DeepMerge::merge_from(&mut self.ttl_seconds_after_finished, other.ttl_seconds_after_finished);
86    }
87}
88
89impl<'de> crate::serde::Deserialize<'de> for JobSpec {
90    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: crate::serde::Deserializer<'de> {
91        #[allow(non_camel_case_types)]
92        enum Field {
93            Key_active_deadline_seconds,
94            Key_backoff_limit,
95            Key_backoff_limit_per_index,
96            Key_completion_mode,
97            Key_completions,
98            Key_managed_by,
99            Key_manual_selector,
100            Key_max_failed_indexes,
101            Key_parallelism,
102            Key_pod_failure_policy,
103            Key_pod_replacement_policy,
104            Key_selector,
105            Key_success_policy,
106            Key_suspend,
107            Key_template,
108            Key_ttl_seconds_after_finished,
109            Other,
110        }
111
112        impl<'de> crate::serde::Deserialize<'de> for Field {
113            fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: crate::serde::Deserializer<'de> {
114                struct Visitor;
115
116                impl crate::serde::de::Visitor<'_> for Visitor {
117                    type Value = Field;
118
119                    fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
120                        f.write_str("field identifier")
121                    }
122
123                    fn visit_str<E>(self, v: &str) -> Result<Self::Value, E> where E: crate::serde::de::Error {
124                        Ok(match v {
125                            "activeDeadlineSeconds" => Field::Key_active_deadline_seconds,
126                            "backoffLimit" => Field::Key_backoff_limit,
127                            "backoffLimitPerIndex" => Field::Key_backoff_limit_per_index,
128                            "completionMode" => Field::Key_completion_mode,
129                            "completions" => Field::Key_completions,
130                            "managedBy" => Field::Key_managed_by,
131                            "manualSelector" => Field::Key_manual_selector,
132                            "maxFailedIndexes" => Field::Key_max_failed_indexes,
133                            "parallelism" => Field::Key_parallelism,
134                            "podFailurePolicy" => Field::Key_pod_failure_policy,
135                            "podReplacementPolicy" => Field::Key_pod_replacement_policy,
136                            "selector" => Field::Key_selector,
137                            "successPolicy" => Field::Key_success_policy,
138                            "suspend" => Field::Key_suspend,
139                            "template" => Field::Key_template,
140                            "ttlSecondsAfterFinished" => Field::Key_ttl_seconds_after_finished,
141                            _ => Field::Other,
142                        })
143                    }
144                }
145
146                deserializer.deserialize_identifier(Visitor)
147            }
148        }
149
150        struct Visitor;
151
152        impl<'de> crate::serde::de::Visitor<'de> for Visitor {
153            type Value = JobSpec;
154
155            fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
156                f.write_str("JobSpec")
157            }
158
159            fn visit_map<A>(self, mut map: A) -> Result<Self::Value, A::Error> where A: crate::serde::de::MapAccess<'de> {
160                let mut value_active_deadline_seconds: Option<i64> = None;
161                let mut value_backoff_limit: Option<i32> = None;
162                let mut value_backoff_limit_per_index: Option<i32> = None;
163                let mut value_completion_mode: Option<std::string::String> = None;
164                let mut value_completions: Option<i32> = None;
165                let mut value_managed_by: Option<std::string::String> = None;
166                let mut value_manual_selector: Option<bool> = None;
167                let mut value_max_failed_indexes: Option<i32> = None;
168                let mut value_parallelism: Option<i32> = None;
169                let mut value_pod_failure_policy: Option<crate::api::batch::v1::PodFailurePolicy> = None;
170                let mut value_pod_replacement_policy: Option<std::string::String> = None;
171                let mut value_selector: Option<crate::apimachinery::pkg::apis::meta::v1::LabelSelector> = None;
172                let mut value_success_policy: Option<crate::api::batch::v1::SuccessPolicy> = None;
173                let mut value_suspend: Option<bool> = None;
174                let mut value_template: Option<crate::api::core::v1::PodTemplateSpec> = None;
175                let mut value_ttl_seconds_after_finished: Option<i32> = None;
176
177                while let Some(key) = crate::serde::de::MapAccess::next_key::<Field>(&mut map)? {
178                    match key {
179                        Field::Key_active_deadline_seconds => value_active_deadline_seconds = crate::serde::de::MapAccess::next_value(&mut map)?,
180                        Field::Key_backoff_limit => value_backoff_limit = crate::serde::de::MapAccess::next_value(&mut map)?,
181                        Field::Key_backoff_limit_per_index => value_backoff_limit_per_index = crate::serde::de::MapAccess::next_value(&mut map)?,
182                        Field::Key_completion_mode => value_completion_mode = crate::serde::de::MapAccess::next_value(&mut map)?,
183                        Field::Key_completions => value_completions = crate::serde::de::MapAccess::next_value(&mut map)?,
184                        Field::Key_managed_by => value_managed_by = crate::serde::de::MapAccess::next_value(&mut map)?,
185                        Field::Key_manual_selector => value_manual_selector = crate::serde::de::MapAccess::next_value(&mut map)?,
186                        Field::Key_max_failed_indexes => value_max_failed_indexes = crate::serde::de::MapAccess::next_value(&mut map)?,
187                        Field::Key_parallelism => value_parallelism = crate::serde::de::MapAccess::next_value(&mut map)?,
188                        Field::Key_pod_failure_policy => value_pod_failure_policy = crate::serde::de::MapAccess::next_value(&mut map)?,
189                        Field::Key_pod_replacement_policy => value_pod_replacement_policy = crate::serde::de::MapAccess::next_value(&mut map)?,
190                        Field::Key_selector => value_selector = crate::serde::de::MapAccess::next_value(&mut map)?,
191                        Field::Key_success_policy => value_success_policy = crate::serde::de::MapAccess::next_value(&mut map)?,
192                        Field::Key_suspend => value_suspend = crate::serde::de::MapAccess::next_value(&mut map)?,
193                        Field::Key_template => value_template = crate::serde::de::MapAccess::next_value(&mut map)?,
194                        Field::Key_ttl_seconds_after_finished => value_ttl_seconds_after_finished = crate::serde::de::MapAccess::next_value(&mut map)?,
195                        Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; },
196                    }
197                }
198
199                Ok(JobSpec {
200                    active_deadline_seconds: value_active_deadline_seconds,
201                    backoff_limit: value_backoff_limit,
202                    backoff_limit_per_index: value_backoff_limit_per_index,
203                    completion_mode: value_completion_mode,
204                    completions: value_completions,
205                    managed_by: value_managed_by,
206                    manual_selector: value_manual_selector,
207                    max_failed_indexes: value_max_failed_indexes,
208                    parallelism: value_parallelism,
209                    pod_failure_policy: value_pod_failure_policy,
210                    pod_replacement_policy: value_pod_replacement_policy,
211                    selector: value_selector,
212                    success_policy: value_success_policy,
213                    suspend: value_suspend,
214                    template: value_template.unwrap_or_default(),
215                    ttl_seconds_after_finished: value_ttl_seconds_after_finished,
216                })
217            }
218        }
219
220        deserializer.deserialize_struct(
221            "JobSpec",
222            &[
223                "activeDeadlineSeconds",
224                "backoffLimit",
225                "backoffLimitPerIndex",
226                "completionMode",
227                "completions",
228                "managedBy",
229                "manualSelector",
230                "maxFailedIndexes",
231                "parallelism",
232                "podFailurePolicy",
233                "podReplacementPolicy",
234                "selector",
235                "successPolicy",
236                "suspend",
237                "template",
238                "ttlSecondsAfterFinished",
239            ],
240            Visitor,
241        )
242    }
243}
244
245impl crate::serde::Serialize for JobSpec {
246    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where S: crate::serde::Serializer {
247        let mut state = serializer.serialize_struct(
248            "JobSpec",
249            1 +
250            self.active_deadline_seconds.as_ref().map_or(0, |_| 1) +
251            self.backoff_limit.as_ref().map_or(0, |_| 1) +
252            self.backoff_limit_per_index.as_ref().map_or(0, |_| 1) +
253            self.completion_mode.as_ref().map_or(0, |_| 1) +
254            self.completions.as_ref().map_or(0, |_| 1) +
255            self.managed_by.as_ref().map_or(0, |_| 1) +
256            self.manual_selector.as_ref().map_or(0, |_| 1) +
257            self.max_failed_indexes.as_ref().map_or(0, |_| 1) +
258            self.parallelism.as_ref().map_or(0, |_| 1) +
259            self.pod_failure_policy.as_ref().map_or(0, |_| 1) +
260            self.pod_replacement_policy.as_ref().map_or(0, |_| 1) +
261            self.selector.as_ref().map_or(0, |_| 1) +
262            self.success_policy.as_ref().map_or(0, |_| 1) +
263            self.suspend.as_ref().map_or(0, |_| 1) +
264            self.ttl_seconds_after_finished.as_ref().map_or(0, |_| 1),
265        )?;
266        if let Some(value) = &self.active_deadline_seconds {
267            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "activeDeadlineSeconds", value)?;
268        }
269        if let Some(value) = &self.backoff_limit {
270            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "backoffLimit", value)?;
271        }
272        if let Some(value) = &self.backoff_limit_per_index {
273            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "backoffLimitPerIndex", value)?;
274        }
275        if let Some(value) = &self.completion_mode {
276            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "completionMode", value)?;
277        }
278        if let Some(value) = &self.completions {
279            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "completions", value)?;
280        }
281        if let Some(value) = &self.managed_by {
282            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "managedBy", value)?;
283        }
284        if let Some(value) = &self.manual_selector {
285            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "manualSelector", value)?;
286        }
287        if let Some(value) = &self.max_failed_indexes {
288            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "maxFailedIndexes", value)?;
289        }
290        if let Some(value) = &self.parallelism {
291            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "parallelism", value)?;
292        }
293        if let Some(value) = &self.pod_failure_policy {
294            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "podFailurePolicy", value)?;
295        }
296        if let Some(value) = &self.pod_replacement_policy {
297            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "podReplacementPolicy", value)?;
298        }
299        if let Some(value) = &self.selector {
300            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "selector", value)?;
301        }
302        if let Some(value) = &self.success_policy {
303            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "successPolicy", value)?;
304        }
305        if let Some(value) = &self.suspend {
306            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "suspend", value)?;
307        }
308        crate::serde::ser::SerializeStruct::serialize_field(&mut state, "template", &self.template)?;
309        if let Some(value) = &self.ttl_seconds_after_finished {
310            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "ttlSecondsAfterFinished", value)?;
311        }
312        crate::serde::ser::SerializeStruct::end(state)
313    }
314}
315
316#[cfg(feature = "schemars")]
317impl crate::schemars::JsonSchema for JobSpec {
318    fn schema_name() -> std::string::String {
319        "io.k8s.api.batch.v1.JobSpec".into()
320    }
321
322    fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema {
323        crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject {
324            metadata: Some(std::boxed::Box::new(crate::schemars::schema::Metadata {
325                description: Some("JobSpec describes how the job execution will look like.".into()),
326                ..Default::default()
327            })),
328            instance_type: Some(crate::schemars::schema::SingleOrVec::Single(std::boxed::Box::new(crate::schemars::schema::InstanceType::Object))),
329            object: Some(std::boxed::Box::new(crate::schemars::schema::ObjectValidation {
330                properties: [
331                    (
332                        "activeDeadlineSeconds".into(),
333                        crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject {
334                            metadata: Some(std::boxed::Box::new(crate::schemars::schema::Metadata {
335                                description: Some("Specifies the duration in seconds relative to the startTime that the job may be continuously active before the system tries to terminate it; value must be positive integer. If a Job is suspended (at creation or through an update), this timer will effectively be stopped and reset when the Job is resumed again.".into()),
336                                ..Default::default()
337                            })),
338                            instance_type: Some(crate::schemars::schema::SingleOrVec::Single(std::boxed::Box::new(crate::schemars::schema::InstanceType::Integer))),
339                            format: Some("int64".into()),
340                            ..Default::default()
341                        }),
342                    ),
343                    (
344                        "backoffLimit".into(),
345                        crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject {
346                            metadata: Some(std::boxed::Box::new(crate::schemars::schema::Metadata {
347                                description: Some("Specifies the number of retries before marking this job failed. Defaults to 6".into()),
348                                ..Default::default()
349                            })),
350                            instance_type: Some(crate::schemars::schema::SingleOrVec::Single(std::boxed::Box::new(crate::schemars::schema::InstanceType::Integer))),
351                            format: Some("int32".into()),
352                            ..Default::default()
353                        }),
354                    ),
355                    (
356                        "backoffLimitPerIndex".into(),
357                        crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject {
358                            metadata: Some(std::boxed::Box::new(crate::schemars::schema::Metadata {
359                                description: Some("Specifies the limit for the number of retries within an index before marking this index as failed. When enabled the number of failures per index is kept in the pod's batch.kubernetes.io/job-index-failure-count annotation. It can only be set when Job's completionMode=Indexed, and the Pod's restart policy is Never. The field is immutable.".into()),
360                                ..Default::default()
361                            })),
362                            instance_type: Some(crate::schemars::schema::SingleOrVec::Single(std::boxed::Box::new(crate::schemars::schema::InstanceType::Integer))),
363                            format: Some("int32".into()),
364                            ..Default::default()
365                        }),
366                    ),
367                    (
368                        "completionMode".into(),
369                        crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject {
370                            metadata: Some(std::boxed::Box::new(crate::schemars::schema::Metadata {
371                                description: Some("completionMode specifies how Pod completions are tracked. It can be `NonIndexed` (default) or `Indexed`.\n\n`NonIndexed` means that the Job is considered complete when there have been .spec.completions successfully completed Pods. Each Pod completion is homologous to each other.\n\n`Indexed` means that the Pods of a Job get an associated completion index from 0 to (.spec.completions - 1), available in the annotation batch.kubernetes.io/job-completion-index. The Job is considered complete when there is one successfully completed Pod for each index. When value is `Indexed`, .spec.completions must be specified and `.spec.parallelism` must be less than or equal to 10^5. In addition, The Pod name takes the form `$(job-name)-$(index)-$(random-string)`, the Pod hostname takes the form `$(job-name)-$(index)`.\n\nMore completion modes can be added in the future. If the Job controller observes a mode that it doesn't recognize, which is possible during upgrades due to version skew, the controller skips updates for the Job.".into()),
372                                ..Default::default()
373                            })),
374                            instance_type: Some(crate::schemars::schema::SingleOrVec::Single(std::boxed::Box::new(crate::schemars::schema::InstanceType::String))),
375                            ..Default::default()
376                        }),
377                    ),
378                    (
379                        "completions".into(),
380                        crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject {
381                            metadata: Some(std::boxed::Box::new(crate::schemars::schema::Metadata {
382                                description: Some("Specifies the desired number of successfully finished pods the job should be run with.  Setting to null means that the success of any pod signals the success of all pods, and allows parallelism to have any positive value.  Setting to 1 means that parallelism is limited to 1 and the success of that pod signals the success of the job. More info: https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/".into()),
383                                ..Default::default()
384                            })),
385                            instance_type: Some(crate::schemars::schema::SingleOrVec::Single(std::boxed::Box::new(crate::schemars::schema::InstanceType::Integer))),
386                            format: Some("int32".into()),
387                            ..Default::default()
388                        }),
389                    ),
390                    (
391                        "managedBy".into(),
392                        crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject {
393                            metadata: Some(std::boxed::Box::new(crate::schemars::schema::Metadata {
394                                description: Some("ManagedBy field indicates the controller that manages a Job. The k8s Job controller reconciles jobs which don't have this field at all or the field value is the reserved string `kubernetes.io/job-controller`, but skips reconciling Jobs with a custom value for this field. The value must be a valid domain-prefixed path (e.g. acme.io/foo) - all characters before the first \"/\" must be a valid subdomain as defined by RFC 1123. All characters trailing the first \"/\" must be valid HTTP Path characters as defined by RFC 3986. The value cannot exceed 63 characters. This field is immutable.\n\nThis field is beta-level. The job controller accepts setting the field when the feature gate JobManagedBy is enabled (enabled by default).".into()),
395                                ..Default::default()
396                            })),
397                            instance_type: Some(crate::schemars::schema::SingleOrVec::Single(std::boxed::Box::new(crate::schemars::schema::InstanceType::String))),
398                            ..Default::default()
399                        }),
400                    ),
401                    (
402                        "manualSelector".into(),
403                        crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject {
404                            metadata: Some(std::boxed::Box::new(crate::schemars::schema::Metadata {
405                                description: Some("manualSelector controls generation of pod labels and pod selectors. Leave `manualSelector` unset unless you are certain what you are doing. When false or unset, the system pick labels unique to this job and appends those labels to the pod template.  When true, the user is responsible for picking unique labels and specifying the selector.  Failure to pick a unique label may cause this and other jobs to not function correctly.  However, You may see `manualSelector=true` in jobs that were created with the old `extensions/v1beta1` API. More info: https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/#specifying-your-own-pod-selector".into()),
406                                ..Default::default()
407                            })),
408                            instance_type: Some(crate::schemars::schema::SingleOrVec::Single(std::boxed::Box::new(crate::schemars::schema::InstanceType::Boolean))),
409                            ..Default::default()
410                        }),
411                    ),
412                    (
413                        "maxFailedIndexes".into(),
414                        crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject {
415                            metadata: Some(std::boxed::Box::new(crate::schemars::schema::Metadata {
416                                description: Some("Specifies the maximal number of failed indexes before marking the Job as failed, when backoffLimitPerIndex is set. Once the number of failed indexes exceeds this number the entire Job is marked as Failed and its execution is terminated. When left as null the job continues execution of all of its indexes and is marked with the `Complete` Job condition. It can only be specified when backoffLimitPerIndex is set. It can be null or up to completions. It is required and must be less than or equal to 10^4 when is completions greater than 10^5.".into()),
417                                ..Default::default()
418                            })),
419                            instance_type: Some(crate::schemars::schema::SingleOrVec::Single(std::boxed::Box::new(crate::schemars::schema::InstanceType::Integer))),
420                            format: Some("int32".into()),
421                            ..Default::default()
422                        }),
423                    ),
424                    (
425                        "parallelism".into(),
426                        crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject {
427                            metadata: Some(std::boxed::Box::new(crate::schemars::schema::Metadata {
428                                description: Some("Specifies the maximum desired number of pods the job should run at any given time. The actual number of pods running in steady state will be less than this number when ((.spec.completions - .status.successful) < .spec.parallelism), i.e. when the work left to do is less than max parallelism. More info: https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/".into()),
429                                ..Default::default()
430                            })),
431                            instance_type: Some(crate::schemars::schema::SingleOrVec::Single(std::boxed::Box::new(crate::schemars::schema::InstanceType::Integer))),
432                            format: Some("int32".into()),
433                            ..Default::default()
434                        }),
435                    ),
436                    (
437                        "podFailurePolicy".into(),
438                        {
439                            let mut schema_obj = __gen.subschema_for::<crate::api::batch::v1::PodFailurePolicy>().into_object();
440                            schema_obj.metadata = Some(std::boxed::Box::new(crate::schemars::schema::Metadata {
441                                description: Some("Specifies the policy of handling failed pods. In particular, it allows to specify the set of actions and conditions which need to be satisfied to take the associated action. If empty, the default behaviour applies - the counter of failed pods, represented by the jobs's .status.failed field, is incremented and it is checked against the backoffLimit. This field cannot be used in combination with restartPolicy=OnFailure.".into()),
442                                ..Default::default()
443                            }));
444                            crate::schemars::schema::Schema::Object(schema_obj)
445                        },
446                    ),
447                    (
448                        "podReplacementPolicy".into(),
449                        crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject {
450                            metadata: Some(std::boxed::Box::new(crate::schemars::schema::Metadata {
451                                description: Some("podReplacementPolicy specifies when to create replacement Pods. Possible values are: - TerminatingOrFailed means that we recreate pods\n  when they are terminating (has a metadata.deletionTimestamp) or failed.\n- Failed means to wait until a previously created Pod is fully terminated (has phase\n  Failed or Succeeded) before creating a replacement Pod.\n\nWhen using podFailurePolicy, Failed is the the only allowed value. TerminatingOrFailed and Failed are allowed values when podFailurePolicy is not in use. This is an beta field. To use this, enable the JobPodReplacementPolicy feature toggle. This is on by default.".into()),
452                                ..Default::default()
453                            })),
454                            instance_type: Some(crate::schemars::schema::SingleOrVec::Single(std::boxed::Box::new(crate::schemars::schema::InstanceType::String))),
455                            ..Default::default()
456                        }),
457                    ),
458                    (
459                        "selector".into(),
460                        {
461                            let mut schema_obj = __gen.subschema_for::<crate::apimachinery::pkg::apis::meta::v1::LabelSelector>().into_object();
462                            schema_obj.metadata = Some(std::boxed::Box::new(crate::schemars::schema::Metadata {
463                                description: Some("A label query over pods that should match the pod count. Normally, the system sets this field for you. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors".into()),
464                                ..Default::default()
465                            }));
466                            crate::schemars::schema::Schema::Object(schema_obj)
467                        },
468                    ),
469                    (
470                        "successPolicy".into(),
471                        {
472                            let mut schema_obj = __gen.subschema_for::<crate::api::batch::v1::SuccessPolicy>().into_object();
473                            schema_obj.metadata = Some(std::boxed::Box::new(crate::schemars::schema::Metadata {
474                                description: Some("successPolicy specifies the policy when the Job can be declared as succeeded. If empty, the default behavior applies - the Job is declared as succeeded only when the number of succeeded pods equals to the completions. When the field is specified, it must be immutable and works only for the Indexed Jobs. Once the Job meets the SuccessPolicy, the lingering pods are terminated.".into()),
475                                ..Default::default()
476                            }));
477                            crate::schemars::schema::Schema::Object(schema_obj)
478                        },
479                    ),
480                    (
481                        "suspend".into(),
482                        crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject {
483                            metadata: Some(std::boxed::Box::new(crate::schemars::schema::Metadata {
484                                description: Some("suspend specifies whether the Job controller should create Pods or not. If a Job is created with suspend set to true, no Pods are created by the Job controller. If a Job is suspended after creation (i.e. the flag goes from false to true), the Job controller will delete all active Pods associated with this Job. Users must design their workload to gracefully handle this. Suspending a Job will reset the StartTime field of the Job, effectively resetting the ActiveDeadlineSeconds timer too. Defaults to false.".into()),
485                                ..Default::default()
486                            })),
487                            instance_type: Some(crate::schemars::schema::SingleOrVec::Single(std::boxed::Box::new(crate::schemars::schema::InstanceType::Boolean))),
488                            ..Default::default()
489                        }),
490                    ),
491                    (
492                        "template".into(),
493                        {
494                            let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::PodTemplateSpec>().into_object();
495                            schema_obj.metadata = Some(std::boxed::Box::new(crate::schemars::schema::Metadata {
496                                description: Some("Describes the pod that will be created when executing a job. The only allowed template.spec.restartPolicy values are \"Never\" or \"OnFailure\". More info: https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/".into()),
497                                ..Default::default()
498                            }));
499                            crate::schemars::schema::Schema::Object(schema_obj)
500                        },
501                    ),
502                    (
503                        "ttlSecondsAfterFinished".into(),
504                        crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject {
505                            metadata: Some(std::boxed::Box::new(crate::schemars::schema::Metadata {
506                                description: Some("ttlSecondsAfterFinished limits the lifetime of a Job that has finished execution (either Complete or Failed). If this field is set, ttlSecondsAfterFinished after the Job finishes, it is eligible to be automatically deleted. When the Job is being deleted, its lifecycle guarantees (e.g. finalizers) will be honored. If this field is unset, the Job won't be automatically deleted. If this field is set to zero, the Job becomes eligible to be deleted immediately after it finishes.".into()),
507                                ..Default::default()
508                            })),
509                            instance_type: Some(crate::schemars::schema::SingleOrVec::Single(std::boxed::Box::new(crate::schemars::schema::InstanceType::Integer))),
510                            format: Some("int32".into()),
511                            ..Default::default()
512                        }),
513                    ),
514                ].into(),
515                required: [
516                    "template".into(),
517                ].into(),
518                ..Default::default()
519            })),
520            ..Default::default()
521        })
522    }
523}