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