From 1276e02d009f496c1b773b6c8bef122bed4b1d39 Mon Sep 17 00:00:00 2001 From: Michal Wozniak Date: Thu, 7 Mar 2024 10:14:54 +0100 Subject: [PATCH 1/2] Adjust the API comments to the current state Kubernetes-commit: 1163c7ed9c6cfbb7fddc9c072b4699d7db0ff92f --- batch/v1/generated.proto | 5 +---- batch/v1/types.go | 5 +---- batch/v1/types_swagger_doc_generated.go | 6 +++--- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/batch/v1/generated.proto b/batch/v1/generated.proto index b6d5f4d47..1c8e38a84 100644 --- a/batch/v1/generated.proto +++ b/batch/v1/generated.proto @@ -367,8 +367,7 @@ message JobStatus { // type "Complete" and status true. // // A job is considered finished when it is in a terminal condition, either - // "Complete" or "Failed". At that point, all pods of the job are in terminal - // phase. Job cannot be both in the "Complete" and "Failed" conditions. + // "Complete" or "Failed". Job cannot be both in the "Complete" and "Failed" conditions. // Additionally, it cannot be in the "Complete" and "FailureTarget" conditions. // The "Complete", "Failed" and "FailureTarget" conditions cannot be disabled. // @@ -418,7 +417,6 @@ message JobStatus { // The number of pods which are terminating (in phase Pending or Running // and have a deletionTimestamp). - // The value is zero (or null) for finished jobs. // // This field is beta-level. The job controller populates the field when // the feature gate JobPodReplacementPolicy is enabled (enabled by default). @@ -469,7 +467,6 @@ message JobStatus { optional UncountedTerminatedPods uncountedTerminatedPods = 8; // The number of pods which have a Ready condition. - // The value is zero (or null) for finished jobs. // +optional optional int32 ready = 9; } diff --git a/batch/v1/types.go b/batch/v1/types.go index 78ca6f6e6..cc945f413 100644 --- a/batch/v1/types.go +++ b/batch/v1/types.go @@ -495,8 +495,7 @@ type JobStatus struct { // type "Complete" and status true. // // A job is considered finished when it is in a terminal condition, either - // "Complete" or "Failed". At that point, all pods of the job are in terminal - // phase. Job cannot be both in the "Complete" and "Failed" conditions. + // "Complete" or "Failed". Job cannot be both in the "Complete" and "Failed" conditions. // Additionally, it cannot be in the "Complete" and "FailureTarget" conditions. // The "Complete", "Failed" and "FailureTarget" conditions cannot be disabled. // @@ -546,7 +545,6 @@ type JobStatus struct { // The number of pods which are terminating (in phase Pending or Running // and have a deletionTimestamp). - // The value is zero (or null) for finished jobs. // // This field is beta-level. The job controller populates the field when // the feature gate JobPodReplacementPolicy is enabled (enabled by default). @@ -597,7 +595,6 @@ type JobStatus struct { UncountedTerminatedPods *UncountedTerminatedPods `json:"uncountedTerminatedPods,omitempty" protobuf:"bytes,8,opt,name=uncountedTerminatedPods"` // The number of pods which have a Ready condition. - // The value is zero (or null) for finished jobs. // +optional Ready *int32 `json:"ready,omitempty" protobuf:"varint,9,opt,name=ready"` } diff --git a/batch/v1/types_swagger_doc_generated.go b/batch/v1/types_swagger_doc_generated.go index da8026799..e8905b186 100644 --- a/batch/v1/types_swagger_doc_generated.go +++ b/batch/v1/types_swagger_doc_generated.go @@ -136,17 +136,17 @@ func (JobSpec) SwaggerDoc() map[string]string { var map_JobStatus = map[string]string{ "": "JobStatus represents the current state of a Job.", - "conditions": "The latest available observations of an object's current state. When a Job fails, one of the conditions will have type \"Failed\" and status true. When a Job is suspended, one of the conditions will have type \"Suspended\" and status true; when the Job is resumed, the status of this condition will become false. When a Job is completed, one of the conditions will have type \"Complete\" and status true.\n\nA job is considered finished when it is in a terminal condition, either \"Complete\" or \"Failed\". At that point, all pods of the job are in terminal phase. Job cannot be both in the \"Complete\" and \"Failed\" conditions. Additionally, it cannot be in the \"Complete\" and \"FailureTarget\" conditions. The \"Complete\", \"Failed\" and \"FailureTarget\" conditions cannot be disabled.\n\nMore info: https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/", + "conditions": "The latest available observations of an object's current state. When a Job fails, one of the conditions will have type \"Failed\" and status true. When a Job is suspended, one of the conditions will have type \"Suspended\" and status true; when the Job is resumed, the status of this condition will become false. When a Job is completed, one of the conditions will have type \"Complete\" and status true.\n\nA job is considered finished when it is in a terminal condition, either \"Complete\" or \"Failed\". Job cannot be both in the \"Complete\" and \"Failed\" conditions. Additionally, it cannot be in the \"Complete\" and \"FailureTarget\" conditions. The \"Complete\", \"Failed\" and \"FailureTarget\" conditions cannot be disabled.\n\nMore info: https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/", "startTime": "Represents time when the job controller started processing a job. When a Job is created in the suspended state, this field is not set until the first time it is resumed. This field is reset every time a Job is resumed from suspension. It is represented in RFC3339 form and is in UTC.\n\nOnce set, the field can only be removed when the job is suspended. The field cannot be modified while the job is unsuspended or finished.", "completionTime": "Represents time when the job was completed. It is not guaranteed to be set in happens-before order across separate operations. It is represented in RFC3339 form and is in UTC. The completion time is set when the job finishes successfully, and only then. The value cannot be updated or removed. The value indicates the same or later point in time as the startTime field.", "active": "The number of pending and running pods which are not terminating (without a deletionTimestamp). The value is zero for finished jobs.", "succeeded": "The number of pods which reached phase Succeeded. The value increases monotonically for a given spec. However, it may decrease in reaction to scale down of elastic indexed jobs.", "failed": "The number of pods which reached phase Failed. The value increases monotonically.", - "terminating": "The number of pods which are terminating (in phase Pending or Running and have a deletionTimestamp). The value is zero (or null) for finished jobs.\n\nThis field is beta-level. The job controller populates the field when the feature gate JobPodReplacementPolicy is enabled (enabled by default).", + "terminating": "The number of pods which are terminating (in phase Pending or Running and have a deletionTimestamp).\n\nThis field is beta-level. The job controller populates the field when the feature gate JobPodReplacementPolicy is enabled (enabled by default).", "completedIndexes": "completedIndexes holds the completed indexes when .spec.completionMode = \"Indexed\" in a text format. The indexes are represented as decimal integers separated by commas. The numbers are listed in increasing order. Three or more consecutive numbers are compressed and represented by the first and last element of the series, separated by a hyphen. For example, if the completed indexes are 1, 3, 4, 5 and 7, they are represented as \"1,3-5,7\".", "failedIndexes": "FailedIndexes holds the failed indexes when spec.backoffLimitPerIndex is set. The indexes are represented in the text format analogous as for the `completedIndexes` field, ie. they are kept as decimal integers separated by commas. The numbers are listed in increasing order. Three or more consecutive numbers are compressed and represented by the first and last element of the series, separated by a hyphen. For example, if the failed indexes are 1, 3, 4, 5 and 7, they are represented as \"1,3-5,7\". The set of failed indexes cannot overlap with the set of completed indexes.\n\nThis field is beta-level. It can be used when the `JobBackoffLimitPerIndex` feature gate is enabled (enabled by default).", "uncountedTerminatedPods": "uncountedTerminatedPods holds the UIDs of Pods that have terminated but the job controller hasn't yet accounted for in the status counters.\n\nThe job controller creates pods with a finalizer. When a pod terminates (succeeded or failed), the controller does three steps to account for it in the job status:\n\n1. Add the pod UID to the arrays in this field. 2. Remove the pod finalizer. 3. Remove the pod UID from the arrays while increasing the corresponding\n counter.\n\nOld jobs might not be tracked using this field, in which case the field remains null. The structure is empty for finished jobs.", - "ready": "The number of pods which have a Ready condition. The value is zero (or null) for finished jobs.", + "ready": "The number of pods which have a Ready condition.", } func (JobStatus) SwaggerDoc() map[string]string { From e5f396f737ae513665f6da562ccca417dc62cb05 Mon Sep 17 00:00:00 2001 From: Michal Wozniak Date: Thu, 7 Mar 2024 22:59:14 +0100 Subject: [PATCH 2/2] Adjust the validation to the current state Kubernetes-commit: 79fe37537c3e96561ceb12c1471bfe10d85b74f1 --- batch/v1/generated.proto | 2 +- batch/v1/types.go | 2 +- batch/v1/types_swagger_doc_generated.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/batch/v1/generated.proto b/batch/v1/generated.proto index 1c8e38a84..833b118d0 100644 --- a/batch/v1/generated.proto +++ b/batch/v1/generated.proto @@ -367,7 +367,7 @@ message JobStatus { // type "Complete" and status true. // // A job is considered finished when it is in a terminal condition, either - // "Complete" or "Failed". Job cannot be both in the "Complete" and "Failed" conditions. + // "Complete" or "Failed". A Job cannot have both the "Complete" and "Failed" conditions. // Additionally, it cannot be in the "Complete" and "FailureTarget" conditions. // The "Complete", "Failed" and "FailureTarget" conditions cannot be disabled. // diff --git a/batch/v1/types.go b/batch/v1/types.go index cc945f413..49b0ec644 100644 --- a/batch/v1/types.go +++ b/batch/v1/types.go @@ -495,7 +495,7 @@ type JobStatus struct { // type "Complete" and status true. // // A job is considered finished when it is in a terminal condition, either - // "Complete" or "Failed". Job cannot be both in the "Complete" and "Failed" conditions. + // "Complete" or "Failed". A Job cannot have both the "Complete" and "Failed" conditions. // Additionally, it cannot be in the "Complete" and "FailureTarget" conditions. // The "Complete", "Failed" and "FailureTarget" conditions cannot be disabled. // diff --git a/batch/v1/types_swagger_doc_generated.go b/batch/v1/types_swagger_doc_generated.go index e8905b186..84073b8d8 100644 --- a/batch/v1/types_swagger_doc_generated.go +++ b/batch/v1/types_swagger_doc_generated.go @@ -136,7 +136,7 @@ func (JobSpec) SwaggerDoc() map[string]string { var map_JobStatus = map[string]string{ "": "JobStatus represents the current state of a Job.", - "conditions": "The latest available observations of an object's current state. When a Job fails, one of the conditions will have type \"Failed\" and status true. When a Job is suspended, one of the conditions will have type \"Suspended\" and status true; when the Job is resumed, the status of this condition will become false. When a Job is completed, one of the conditions will have type \"Complete\" and status true.\n\nA job is considered finished when it is in a terminal condition, either \"Complete\" or \"Failed\". Job cannot be both in the \"Complete\" and \"Failed\" conditions. Additionally, it cannot be in the \"Complete\" and \"FailureTarget\" conditions. The \"Complete\", \"Failed\" and \"FailureTarget\" conditions cannot be disabled.\n\nMore info: https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/", + "conditions": "The latest available observations of an object's current state. When a Job fails, one of the conditions will have type \"Failed\" and status true. When a Job is suspended, one of the conditions will have type \"Suspended\" and status true; when the Job is resumed, the status of this condition will become false. When a Job is completed, one of the conditions will have type \"Complete\" and status true.\n\nA job is considered finished when it is in a terminal condition, either \"Complete\" or \"Failed\". A Job cannot have both the \"Complete\" and \"Failed\" conditions. Additionally, it cannot be in the \"Complete\" and \"FailureTarget\" conditions. The \"Complete\", \"Failed\" and \"FailureTarget\" conditions cannot be disabled.\n\nMore info: https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/", "startTime": "Represents time when the job controller started processing a job. When a Job is created in the suspended state, this field is not set until the first time it is resumed. This field is reset every time a Job is resumed from suspension. It is represented in RFC3339 form and is in UTC.\n\nOnce set, the field can only be removed when the job is suspended. The field cannot be modified while the job is unsuspended or finished.", "completionTime": "Represents time when the job was completed. It is not guaranteed to be set in happens-before order across separate operations. It is represented in RFC3339 form and is in UTC. The completion time is set when the job finishes successfully, and only then. The value cannot be updated or removed. The value indicates the same or later point in time as the startTime field.", "active": "The number of pending and running pods which are not terminating (without a deletionTimestamp). The value is zero for finished jobs.",