k8s_openapi/v1_32/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. This field is beta-level. It can be used when the `JobBackoffLimitPerIndex` feature gate is enabled (enabled by default).
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<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<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. This field is beta-level. It can be used when the `JobBackoffLimitPerIndex` feature gate is enabled (enabled by default).
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<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    ///
57    /// This field is beta-level. To use this field, you must enable the `JobSuccessPolicy` feature gate (enabled by default).
58    pub success_policy: Option<crate::api::batch::v1::SuccessPolicy>,
59
60    /// 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.
61    pub suspend: Option<bool>,
62
63    /// 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/
64    pub template: crate::api::core::v1::PodTemplateSpec,
65
66    /// 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.
67    pub ttl_seconds_after_finished: Option<i32>,
68}
69
70impl crate::DeepMerge for JobSpec {
71    fn merge_from(&mut self, other: Self) {
72        crate::DeepMerge::merge_from(&mut self.active_deadline_seconds, other.active_deadline_seconds);
73        crate::DeepMerge::merge_from(&mut self.backoff_limit, other.backoff_limit);
74        crate::DeepMerge::merge_from(&mut self.backoff_limit_per_index, other.backoff_limit_per_index);
75        crate::DeepMerge::merge_from(&mut self.completion_mode, other.completion_mode);
76        crate::DeepMerge::merge_from(&mut self.completions, other.completions);
77        crate::DeepMerge::merge_from(&mut self.managed_by, other.managed_by);
78        crate::DeepMerge::merge_from(&mut self.manual_selector, other.manual_selector);
79        crate::DeepMerge::merge_from(&mut self.max_failed_indexes, other.max_failed_indexes);
80        crate::DeepMerge::merge_from(&mut self.parallelism, other.parallelism);
81        crate::DeepMerge::merge_from(&mut self.pod_failure_policy, other.pod_failure_policy);
82        crate::DeepMerge::merge_from(&mut self.pod_replacement_policy, other.pod_replacement_policy);
83        crate::DeepMerge::merge_from(&mut self.selector, other.selector);
84        crate::DeepMerge::merge_from(&mut self.success_policy, other.success_policy);
85        crate::DeepMerge::merge_from(&mut self.suspend, other.suspend);
86        crate::DeepMerge::merge_from(&mut self.template, other.template);
87        crate::DeepMerge::merge_from(&mut self.ttl_seconds_after_finished, other.ttl_seconds_after_finished);
88    }
89}
90
91impl<'de> crate::serde::Deserialize<'de> for JobSpec {
92    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: crate::serde::Deserializer<'de> {
93        #[allow(non_camel_case_types)]
94        enum Field {
95            Key_active_deadline_seconds,
96            Key_backoff_limit,
97            Key_backoff_limit_per_index,
98            Key_completion_mode,
99            Key_completions,
100            Key_managed_by,
101            Key_manual_selector,
102            Key_max_failed_indexes,
103            Key_parallelism,
104            Key_pod_failure_policy,
105            Key_pod_replacement_policy,
106            Key_selector,
107            Key_success_policy,
108            Key_suspend,
109            Key_template,
110            Key_ttl_seconds_after_finished,
111            Other,
112        }
113
114        impl<'de> crate::serde::Deserialize<'de> for Field {
115            fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: crate::serde::Deserializer<'de> {
116                struct Visitor;
117
118                impl crate::serde::de::Visitor<'_> for Visitor {
119                    type Value = Field;
120
121                    fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
122                        f.write_str("field identifier")
123                    }
124
125                    fn visit_str<E>(self, v: &str) -> Result<Self::Value, E> where E: crate::serde::de::Error {
126                        Ok(match v {
127                            "activeDeadlineSeconds" => Field::Key_active_deadline_seconds,
128                            "backoffLimit" => Field::Key_backoff_limit,
129                            "backoffLimitPerIndex" => Field::Key_backoff_limit_per_index,
130                            "completionMode" => Field::Key_completion_mode,
131                            "completions" => Field::Key_completions,
132                            "managedBy" => Field::Key_managed_by,
133                            "manualSelector" => Field::Key_manual_selector,
134                            "maxFailedIndexes" => Field::Key_max_failed_indexes,
135                            "parallelism" => Field::Key_parallelism,
136                            "podFailurePolicy" => Field::Key_pod_failure_policy,
137                            "podReplacementPolicy" => Field::Key_pod_replacement_policy,
138                            "selector" => Field::Key_selector,
139                            "successPolicy" => Field::Key_success_policy,
140                            "suspend" => Field::Key_suspend,
141                            "template" => Field::Key_template,
142                            "ttlSecondsAfterFinished" => Field::Key_ttl_seconds_after_finished,
143                            _ => Field::Other,
144                        })
145                    }
146                }
147
148                deserializer.deserialize_identifier(Visitor)
149            }
150        }
151
152        struct Visitor;
153
154        impl<'de> crate::serde::de::Visitor<'de> for Visitor {
155            type Value = JobSpec;
156
157            fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
158                f.write_str("JobSpec")
159            }
160
161            fn visit_map<A>(self, mut map: A) -> Result<Self::Value, A::Error> where A: crate::serde::de::MapAccess<'de> {
162                let mut value_active_deadline_seconds: Option<i64> = None;
163                let mut value_backoff_limit: Option<i32> = None;
164                let mut value_backoff_limit_per_index: Option<i32> = None;
165                let mut value_completion_mode: Option<String> = None;
166                let mut value_completions: Option<i32> = None;
167                let mut value_managed_by: Option<String> = None;
168                let mut value_manual_selector: Option<bool> = None;
169                let mut value_max_failed_indexes: Option<i32> = None;
170                let mut value_parallelism: Option<i32> = None;
171                let mut value_pod_failure_policy: Option<crate::api::batch::v1::PodFailurePolicy> = None;
172                let mut value_pod_replacement_policy: Option<String> = None;
173                let mut value_selector: Option<crate::apimachinery::pkg::apis::meta::v1::LabelSelector> = None;
174                let mut value_success_policy: Option<crate::api::batch::v1::SuccessPolicy> = None;
175                let mut value_suspend: Option<bool> = None;
176                let mut value_template: Option<crate::api::core::v1::PodTemplateSpec> = None;
177                let mut value_ttl_seconds_after_finished: Option<i32> = None;
178
179                while let Some(key) = crate::serde::de::MapAccess::next_key::<Field>(&mut map)? {
180                    match key {
181                        Field::Key_active_deadline_seconds => value_active_deadline_seconds = crate::serde::de::MapAccess::next_value(&mut map)?,
182                        Field::Key_backoff_limit => value_backoff_limit = crate::serde::de::MapAccess::next_value(&mut map)?,
183                        Field::Key_backoff_limit_per_index => value_backoff_limit_per_index = crate::serde::de::MapAccess::next_value(&mut map)?,
184                        Field::Key_completion_mode => value_completion_mode = crate::serde::de::MapAccess::next_value(&mut map)?,
185                        Field::Key_completions => value_completions = crate::serde::de::MapAccess::next_value(&mut map)?,
186                        Field::Key_managed_by => value_managed_by = crate::serde::de::MapAccess::next_value(&mut map)?,
187                        Field::Key_manual_selector => value_manual_selector = crate::serde::de::MapAccess::next_value(&mut map)?,
188                        Field::Key_max_failed_indexes => value_max_failed_indexes = crate::serde::de::MapAccess::next_value(&mut map)?,
189                        Field::Key_parallelism => value_parallelism = crate::serde::de::MapAccess::next_value(&mut map)?,
190                        Field::Key_pod_failure_policy => value_pod_failure_policy = crate::serde::de::MapAccess::next_value(&mut map)?,
191                        Field::Key_pod_replacement_policy => value_pod_replacement_policy = crate::serde::de::MapAccess::next_value(&mut map)?,
192                        Field::Key_selector => value_selector = crate::serde::de::MapAccess::next_value(&mut map)?,
193                        Field::Key_success_policy => value_success_policy = crate::serde::de::MapAccess::next_value(&mut map)?,
194                        Field::Key_suspend => value_suspend = crate::serde::de::MapAccess::next_value(&mut map)?,
195                        Field::Key_template => value_template = crate::serde::de::MapAccess::next_value(&mut map)?,
196                        Field::Key_ttl_seconds_after_finished => value_ttl_seconds_after_finished = crate::serde::de::MapAccess::next_value(&mut map)?,
197                        Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; },
198                    }
199                }
200
201                Ok(JobSpec {
202                    active_deadline_seconds: value_active_deadline_seconds,
203                    backoff_limit: value_backoff_limit,
204                    backoff_limit_per_index: value_backoff_limit_per_index,
205                    completion_mode: value_completion_mode,
206                    completions: value_completions,
207                    managed_by: value_managed_by,
208                    manual_selector: value_manual_selector,
209                    max_failed_indexes: value_max_failed_indexes,
210                    parallelism: value_parallelism,
211                    pod_failure_policy: value_pod_failure_policy,
212                    pod_replacement_policy: value_pod_replacement_policy,
213                    selector: value_selector,
214                    success_policy: value_success_policy,
215                    suspend: value_suspend,
216                    template: value_template.unwrap_or_default(),
217                    ttl_seconds_after_finished: value_ttl_seconds_after_finished,
218                })
219            }
220        }
221
222        deserializer.deserialize_struct(
223            "JobSpec",
224            &[
225                "activeDeadlineSeconds",
226                "backoffLimit",
227                "backoffLimitPerIndex",
228                "completionMode",
229                "completions",
230                "managedBy",
231                "manualSelector",
232                "maxFailedIndexes",
233                "parallelism",
234                "podFailurePolicy",
235                "podReplacementPolicy",
236                "selector",
237                "successPolicy",
238                "suspend",
239                "template",
240                "ttlSecondsAfterFinished",
241            ],
242            Visitor,
243        )
244    }
245}
246
247impl crate::serde::Serialize for JobSpec {
248    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where S: crate::serde::Serializer {
249        let mut state = serializer.serialize_struct(
250            "JobSpec",
251            1 +
252            self.active_deadline_seconds.as_ref().map_or(0, |_| 1) +
253            self.backoff_limit.as_ref().map_or(0, |_| 1) +
254            self.backoff_limit_per_index.as_ref().map_or(0, |_| 1) +
255            self.completion_mode.as_ref().map_or(0, |_| 1) +
256            self.completions.as_ref().map_or(0, |_| 1) +
257            self.managed_by.as_ref().map_or(0, |_| 1) +
258            self.manual_selector.as_ref().map_or(0, |_| 1) +
259            self.max_failed_indexes.as_ref().map_or(0, |_| 1) +
260            self.parallelism.as_ref().map_or(0, |_| 1) +
261            self.pod_failure_policy.as_ref().map_or(0, |_| 1) +
262            self.pod_replacement_policy.as_ref().map_or(0, |_| 1) +
263            self.selector.as_ref().map_or(0, |_| 1) +
264            self.success_policy.as_ref().map_or(0, |_| 1) +
265            self.suspend.as_ref().map_or(0, |_| 1) +
266            self.ttl_seconds_after_finished.as_ref().map_or(0, |_| 1),
267        )?;
268        if let Some(value) = &self.active_deadline_seconds {
269            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "activeDeadlineSeconds", value)?;
270        }
271        if let Some(value) = &self.backoff_limit {
272            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "backoffLimit", value)?;
273        }
274        if let Some(value) = &self.backoff_limit_per_index {
275            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "backoffLimitPerIndex", value)?;
276        }
277        if let Some(value) = &self.completion_mode {
278            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "completionMode", value)?;
279        }
280        if let Some(value) = &self.completions {
281            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "completions", value)?;
282        }
283        if let Some(value) = &self.managed_by {
284            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "managedBy", value)?;
285        }
286        if let Some(value) = &self.manual_selector {
287            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "manualSelector", value)?;
288        }
289        if let Some(value) = &self.max_failed_indexes {
290            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "maxFailedIndexes", value)?;
291        }
292        if let Some(value) = &self.parallelism {
293            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "parallelism", value)?;
294        }
295        if let Some(value) = &self.pod_failure_policy {
296            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "podFailurePolicy", value)?;
297        }
298        if let Some(value) = &self.pod_replacement_policy {
299            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "podReplacementPolicy", value)?;
300        }
301        if let Some(value) = &self.selector {
302            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "selector", value)?;
303        }
304        if let Some(value) = &self.success_policy {
305            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "successPolicy", value)?;
306        }
307        if let Some(value) = &self.suspend {
308            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "suspend", value)?;
309        }
310        crate::serde::ser::SerializeStruct::serialize_field(&mut state, "template", &self.template)?;
311        if let Some(value) = &self.ttl_seconds_after_finished {
312            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "ttlSecondsAfterFinished", value)?;
313        }
314        crate::serde::ser::SerializeStruct::end(state)
315    }
316}
317
318#[cfg(feature = "schemars")]
319impl crate::schemars::JsonSchema for JobSpec {
320    fn schema_name() -> String {
321        "io.k8s.api.batch.v1.JobSpec".to_owned()
322    }
323
324    fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema {
325        crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject {
326            metadata: Some(Box::new(crate::schemars::schema::Metadata {
327                description: Some("JobSpec describes how the job execution will look like.".to_owned()),
328                ..Default::default()
329            })),
330            instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))),
331            object: Some(Box::new(crate::schemars::schema::ObjectValidation {
332                properties: [
333                    (
334                        "activeDeadlineSeconds".to_owned(),
335                        crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject {
336                            metadata: Some(Box::new(crate::schemars::schema::Metadata {
337                                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.".to_owned()),
338                                ..Default::default()
339                            })),
340                            instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))),
341                            format: Some("int64".to_owned()),
342                            ..Default::default()
343                        }),
344                    ),
345                    (
346                        "backoffLimit".to_owned(),
347                        crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject {
348                            metadata: Some(Box::new(crate::schemars::schema::Metadata {
349                                description: Some("Specifies the number of retries before marking this job failed. Defaults to 6".to_owned()),
350                                ..Default::default()
351                            })),
352                            instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))),
353                            format: Some("int32".to_owned()),
354                            ..Default::default()
355                        }),
356                    ),
357                    (
358                        "backoffLimitPerIndex".to_owned(),
359                        crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject {
360                            metadata: Some(Box::new(crate::schemars::schema::Metadata {
361                                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. This field is beta-level. It can be used when the `JobBackoffLimitPerIndex` feature gate is enabled (enabled by default).".to_owned()),
362                                ..Default::default()
363                            })),
364                            instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))),
365                            format: Some("int32".to_owned()),
366                            ..Default::default()
367                        }),
368                    ),
369                    (
370                        "completionMode".to_owned(),
371                        crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject {
372                            metadata: Some(Box::new(crate::schemars::schema::Metadata {
373                                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.".to_owned()),
374                                ..Default::default()
375                            })),
376                            instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))),
377                            ..Default::default()
378                        }),
379                    ),
380                    (
381                        "completions".to_owned(),
382                        crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject {
383                            metadata: Some(Box::new(crate::schemars::schema::Metadata {
384                                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/".to_owned()),
385                                ..Default::default()
386                            })),
387                            instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))),
388                            format: Some("int32".to_owned()),
389                            ..Default::default()
390                        }),
391                    ),
392                    (
393                        "managedBy".to_owned(),
394                        crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject {
395                            metadata: Some(Box::new(crate::schemars::schema::Metadata {
396                                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).".to_owned()),
397                                ..Default::default()
398                            })),
399                            instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))),
400                            ..Default::default()
401                        }),
402                    ),
403                    (
404                        "manualSelector".to_owned(),
405                        crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject {
406                            metadata: Some(Box::new(crate::schemars::schema::Metadata {
407                                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".to_owned()),
408                                ..Default::default()
409                            })),
410                            instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))),
411                            ..Default::default()
412                        }),
413                    ),
414                    (
415                        "maxFailedIndexes".to_owned(),
416                        crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject {
417                            metadata: Some(Box::new(crate::schemars::schema::Metadata {
418                                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. This field is beta-level. It can be used when the `JobBackoffLimitPerIndex` feature gate is enabled (enabled by default).".to_owned()),
419                                ..Default::default()
420                            })),
421                            instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))),
422                            format: Some("int32".to_owned()),
423                            ..Default::default()
424                        }),
425                    ),
426                    (
427                        "parallelism".to_owned(),
428                        crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject {
429                            metadata: Some(Box::new(crate::schemars::schema::Metadata {
430                                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/".to_owned()),
431                                ..Default::default()
432                            })),
433                            instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))),
434                            format: Some("int32".to_owned()),
435                            ..Default::default()
436                        }),
437                    ),
438                    (
439                        "podFailurePolicy".to_owned(),
440                        {
441                            let mut schema_obj = __gen.subschema_for::<crate::api::batch::v1::PodFailurePolicy>().into_object();
442                            schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata {
443                                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.".to_owned()),
444                                ..Default::default()
445                            }));
446                            crate::schemars::schema::Schema::Object(schema_obj)
447                        },
448                    ),
449                    (
450                        "podReplacementPolicy".to_owned(),
451                        crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject {
452                            metadata: Some(Box::new(crate::schemars::schema::Metadata {
453                                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.".to_owned()),
454                                ..Default::default()
455                            })),
456                            instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))),
457                            ..Default::default()
458                        }),
459                    ),
460                    (
461                        "selector".to_owned(),
462                        {
463                            let mut schema_obj = __gen.subschema_for::<crate::apimachinery::pkg::apis::meta::v1::LabelSelector>().into_object();
464                            schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata {
465                                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".to_owned()),
466                                ..Default::default()
467                            }));
468                            crate::schemars::schema::Schema::Object(schema_obj)
469                        },
470                    ),
471                    (
472                        "successPolicy".to_owned(),
473                        {
474                            let mut schema_obj = __gen.subschema_for::<crate::api::batch::v1::SuccessPolicy>().into_object();
475                            schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata {
476                                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.\n\nThis field is beta-level. To use this field, you must enable the `JobSuccessPolicy` feature gate (enabled by default).".to_owned()),
477                                ..Default::default()
478                            }));
479                            crate::schemars::schema::Schema::Object(schema_obj)
480                        },
481                    ),
482                    (
483                        "suspend".to_owned(),
484                        crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject {
485                            metadata: Some(Box::new(crate::schemars::schema::Metadata {
486                                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.".to_owned()),
487                                ..Default::default()
488                            })),
489                            instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))),
490                            ..Default::default()
491                        }),
492                    ),
493                    (
494                        "template".to_owned(),
495                        {
496                            let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::PodTemplateSpec>().into_object();
497                            schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata {
498                                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/".to_owned()),
499                                ..Default::default()
500                            }));
501                            crate::schemars::schema::Schema::Object(schema_obj)
502                        },
503                    ),
504                    (
505                        "ttlSecondsAfterFinished".to_owned(),
506                        crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject {
507                            metadata: Some(Box::new(crate::schemars::schema::Metadata {
508                                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.".to_owned()),
509                                ..Default::default()
510                            })),
511                            instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))),
512                            format: Some("int32".to_owned()),
513                            ..Default::default()
514                        }),
515                    ),
516                ].into(),
517                required: [
518                    "template".to_owned(),
519                ].into(),
520                ..Default::default()
521            })),
522            ..Default::default()
523        })
524    }
525}