Skip to content

Commit c79e4fd

Browse files
authored
Change IndividualJobRecreates to IndividualJobStatus.Recreates (#958)
* Change IndividualJobRecreates to IndividualJobStatus.Recreates * Review comments * Simplify resetIndividualJobRecreates * Review nit * Add documentation that Recreates is reset to 0 on JobSet restart * Run make generate * Create IndividualJobsStatus entry on job creation if it does not exist * Add integration tests
1 parent 1d42866 commit c79e4fd

File tree

20 files changed

+559
-85
lines changed

20 files changed

+559
-85
lines changed

api/jobset/v1alpha2/jobset_types.go

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,10 +185,21 @@ type JobSetStatus struct {
185185
// +listMapKey=name
186186
ReplicatedJobsStatus []ReplicatedJobStatus `json:"replicatedJobsStatus,omitempty"`
187187

188-
// IndividualJobRecreates tracks the number of times an individual Job within
189-
// the JobSet has been recreated (i.e. in case of RecreateJob failure policy).
188+
// IndividualJobsStatus tracks the status of individual Jobs within ReplicatedJobs.
190189
// +optional
191-
IndividualJobRecreates map[string]int32 `json:"individualJobRecreates,omitempty"`
190+
// +listType=map
191+
// +listMapKey=name
192+
IndividualJobsStatus []IndividualJobStatus `json:"individualJobsStatus,omitempty"`
193+
}
194+
195+
// IndividualJobStatus holds the status of an individual Job within a ReplicatedJob.
196+
type IndividualJobStatus struct {
197+
// Name of the Job.
198+
Name string `json:"name"`
199+
200+
// Recreates is the number of times an individual Job has been recreated.
201+
// This counter is reset to 0 if the parent ReplicatedJob or JobSet is restarted.
202+
Recreates int32 `json:"recreates"`
192203
}
193204

194205
// ReplicatedJobStatus defines the observed ReplicatedJobs Readiness.

api/jobset/v1alpha2/openapi_generated.go

Lines changed: 46 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/jobset/v1alpha2/zz_generated.deepcopy.go

Lines changed: 19 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client-go/applyconfiguration/jobset/v1alpha2/individualjobstatus.go

Lines changed: 44 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client-go/applyconfiguration/jobset/v1alpha2/jobsetstatus.go

Lines changed: 9 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client-go/applyconfiguration/utils.go

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/components/crd/bases/jobset.x-k8s.io_jobsets.yaml

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9151,14 +9151,30 @@ spec:
91519151
x-kubernetes-list-map-keys:
91529152
- type
91539153
x-kubernetes-list-type: map
9154-
individualJobRecreates:
9155-
additionalProperties:
9156-
format: int32
9157-
type: integer
9158-
description: |-
9159-
IndividualJobRecreates tracks the number of times an individual Job within
9160-
the JobSet has been recreated (i.e. in case of RecreateJob failure policy).
9161-
type: object
9154+
individualJobsStatus:
9155+
description: IndividualJobsStatus tracks the status of individual
9156+
Jobs within ReplicatedJobs.
9157+
items:
9158+
description: IndividualJobStatus holds the status of an individual
9159+
Job within a ReplicatedJob.
9160+
properties:
9161+
name:
9162+
description: Name of the Job.
9163+
type: string
9164+
recreates:
9165+
description: |-
9166+
Recreates is the number of times an individual Job has been recreated.
9167+
This counter is reset to 0 if the parent ReplicatedJob or JobSet is restarted.
9168+
format: int32
9169+
type: integer
9170+
required:
9171+
- name
9172+
- recreates
9173+
type: object
9174+
type: array
9175+
x-kubernetes-list-map-keys:
9176+
- name
9177+
x-kubernetes-list-type: map
91629178
replicatedJobsStatus:
91639179
description: ReplicatedJobsStatus track the number of JobsReady for
91649180
each replicatedJob.

hack/python-sdk/swagger.json

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,27 @@
110110
}
111111
}
112112
},
113+
"jobset.v1alpha2.IndividualJobStatus": {
114+
"description": "IndividualJobStatus holds the status of an individual Job within a ReplicatedJob.",
115+
"type": "object",
116+
"required": [
117+
"name",
118+
"recreates"
119+
],
120+
"properties": {
121+
"name": {
122+
"description": "Name of the Job.",
123+
"type": "string",
124+
"default": ""
125+
},
126+
"recreates": {
127+
"description": "Recreates is the number of times an individual Job has been recreated. This counter is reset to 0 if the parent ReplicatedJob or JobSet is restarted.",
128+
"type": "integer",
129+
"format": "int32",
130+
"default": 0
131+
}
132+
}
133+
},
113134
"jobset.v1alpha2.JobSet": {
114135
"description": "JobSet is the Schema for the jobsets API",
115136
"type": "object",
@@ -124,7 +145,7 @@
124145
},
125146
"metadata": {
126147
"default": {},
127-
"$ref": "https://raw.githubusercontent.com/kubernetes/kubernetes/refs/tags/v1.33.2/api/openapi-spec/swagger.json#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta"
148+
"$ref": "https://raw.githubusercontent.com/kubernetes/kubernetes/refs/tags/v1.33.3/api/openapi-spec/swagger.json#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta"
128149
},
129150
"spec": {
130151
"default": {},
@@ -160,7 +181,7 @@
160181
},
161182
"metadata": {
162183
"default": {},
163-
"$ref": "https://raw.githubusercontent.com/kubernetes/kubernetes/refs/tags/v1.33.2/api/openapi-spec/swagger.json#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ListMeta"
184+
"$ref": "https://raw.githubusercontent.com/kubernetes/kubernetes/refs/tags/v1.33.3/api/openapi-spec/swagger.json#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ListMeta"
164185
}
165186
}
166187
},
@@ -223,21 +244,24 @@
223244
"type": "array",
224245
"items": {
225246
"default": {},
226-
"$ref": "https://raw.githubusercontent.com/kubernetes/kubernetes/refs/tags/v1.33.2/api/openapi-spec/swagger.json#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.Condition"
247+
"$ref": "https://raw.githubusercontent.com/kubernetes/kubernetes/refs/tags/v1.33.3/api/openapi-spec/swagger.json#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.Condition"
227248
},
228249
"x-kubernetes-list-map-keys": [
229250
"type"
230251
],
231252
"x-kubernetes-list-type": "map"
232253
},
233-
"individualJobRecreates": {
234-
"description": "IndividualJobRecreates tracks the number of times an individual Job within the JobSet has been recreated (i.e. in case of RecreateJob failure policy).",
235-
"type": "object",
236-
"additionalProperties": {
237-
"type": "integer",
238-
"format": "int32",
239-
"default": 0
240-
}
254+
"individualJobsStatus": {
255+
"description": "IndividualJobsStatus tracks the status of individual Jobs within ReplicatedJobs.",
256+
"type": "array",
257+
"items": {
258+
"default": {},
259+
"$ref": "#/definitions/jobset.v1alpha2.IndividualJobStatus"
260+
},
261+
"x-kubernetes-list-map-keys": [
262+
"name"
263+
],
264+
"x-kubernetes-list-type": "map"
241265
},
242266
"replicatedJobsStatus": {
243267
"description": "ReplicatedJobsStatus track the number of JobsReady for each replicatedJob.",
@@ -321,7 +345,7 @@
321345
"template": {
322346
"description": "Template defines the template of the Job that will be created.",
323347
"default": {},
324-
"$ref": "https://raw.githubusercontent.com/kubernetes/kubernetes/refs/tags/v1.33.2/api/openapi-spec/swagger.json#/definitions/io.k8s.api.batch.v1.JobTemplateSpec"
348+
"$ref": "https://raw.githubusercontent.com/kubernetes/kubernetes/refs/tags/v1.33.3/api/openapi-spec/swagger.json#/definitions/io.k8s.api.batch.v1.JobTemplateSpec"
325349
}
326350
}
327351
},

0 commit comments

Comments
 (0)