@@ -180,8 +180,9 @@ could be stopped at any point and executed again from the first step without
180
180
losing information. Generally, all the steps happen in a single Job sync
181
181
cycle.
182
182
183
- 0 . kube-apiserver adds the ` batch.kubernetes.io/job-completion ` finalizer
184
- to newly created Jobs.
183
+ 0 . kube-apiserver adds the ` batch.kubernetes.io/job-completion ` annotation
184
+ to newly created Jobs. This annotation allows the distinction of new Jobs
185
+ from Jobs that are already tracked with the legacy algorithm.
185
186
1 . The Job controller calculates the number of succeeded Pods as the sum of:
186
187
- ` .status.succeeded ` ,
187
188
- the size of ` job.status.uncountedTerminatedPods.succeeded ` and
@@ -210,9 +211,6 @@ cycle.
210
211
The counts increment the ` .status.failed ` and ` .status.succeeded ` and clears
211
212
counted Pods from ` .status.uncountedTerminatedPods ` lists. The controller
212
213
sends a status update.
213
- 5 . The Job controller removes the ` batch.kubernetes.io/job-completion ` finalizer
214
- from the Job if it has completed (succeeded or failed) and no Job Pod's have
215
- finalizers.
216
214
217
215
Steps 2 to 4 might deal with a potentially big number of Pods. Thus, status
218
216
updates can potentially stress the kube-apiserver. For this reason, the Job
@@ -269,9 +267,11 @@ failures.
269
267
270
268
### Deleted Jobs
271
269
272
- When a user or another controller deletes a Job, the job controller scans
273
- associated Pods and removes finalizers from them without updating any Job
274
- status.
270
+ When a user or another controller deletes a Job, the cascading makes sure that
271
+ each Pods gets a deletion timestamp. The job controller captures this Pod
272
+ update event, adding the orphan Pod (Pod for which the Job controller doesn't
273
+ exist) to a separate work queue. A single worker scans this work queue to
274
+ remove the finalizer from the Pod.
275
275
276
276
### Pod adoption
277
277
@@ -312,13 +312,20 @@ the owner reference.
312
312
- Processing 5000 Pods per minute across any number of Jobs, with Pod creation
313
313
having higher priority than status updates. This might depend on
314
314
[ Priority and Fairness] ( https://git.k8s.io/enhancements/keps/sig-api-machinery/1040-priority-and-fairness ) .
315
+ - Ensure that tracking Jobs with big number of Pods doesn't cause starvation of
316
+ smaller jobs.
315
317
- Metrics:
316
318
- latency
317
319
- errors
318
320
- Tests are in Testgrid and linked in KEP
319
321
320
322
#### Beta -> GA Graduation
321
323
324
+ - Established a plan to remove legacy tracking and the use of
325
+ ` batch.kubernetes.io/job-completion ` as an annotation. The tentative
326
+ expectation is to keep them for two releases after the graduation to GA.
327
+ This time can be reduced if we can envision an algorithm to safely transition
328
+ a Job from legacy to new tracking.
322
329
- E2E test graduates to conformance.
323
330
- Job tracking scales to 10^5 completions per Job processed within an order of
324
331
minutes.
@@ -328,19 +335,23 @@ the owner reference.
328
335
When the feature ` JobTrackingWithFinalizers ` is enabled for the first
329
336
time, the cluster can have Jobs whose Pods don't have the
330
337
` batch.kubernetes.io/job-completion ` finalizer. It would be hard to add the
331
- finalizer to all Pods while preventing race conditions.
338
+ finalizer to all Pods while preventing race conditions. That is, at the time
339
+ of migration to the new tracking, a Pod could not have the finalizer for two
340
+ reasons: it wasn't migrated yet, or it was already counted.
332
341
333
- The job controller uses the existence of the finalizer
342
+ The job controller uses the existence of the Job annotation
334
343
` batch.kubernetes.io/job-completion ` to determine if it should use tracking with
335
- finalizers. If the finalizer is not present, and the Job is not yet completed,
344
+ finalizers. If the annotation is not present, and the Job is not yet completed,
336
345
the job controllers tracks Pods using the legacy tracking (with lingering Pods).
337
346
338
- The kube-apiserver sets the ` batch.kubernetes.io/job-completion ` finalizer to
347
+ The kube-apiserver sets the ` batch.kubernetes.io/job-completion ` annotation to
339
348
newly created Jobs when the feature gate ` JobTrackingWithFinalizers ` is enabled.
349
+ This annotation cannot be added in a Job update.
340
350
341
351
When the feature is disabled after being enabled for some time, the next time
342
352
the Job controller syncs a Job:
343
- 1 . It removes finalizers from the Job and all the Pods owned by it.
353
+ 1 . It removes finalizers from the Pods owned by it and the annotation from the
354
+ Job.
344
355
2 . Sets ` .status.uncountedTerminatedPods ` to nil.
345
356
346
357
After this point, the Job will no longer be tracked using finalizers, even if
@@ -480,9 +491,6 @@ previous answers based on experience in the field._
480
491
- estimated throughput: one per Pod created by the Job controller, when Pod
481
492
finishes or is removed.
482
493
- originating component: kube-controller-manager
483
- - PATCH Jobs, to remove finalizers.
484
- - estimated throughput: one call for each Job created.
485
- - originating component: kube-controller-manager
486
494
- PUT Job status, to keep track of uncounted Pods.
487
495
- estimated throughput: at least one per Job sync. The job controller
488
496
throttles additional calls at 1 per a few seconds (precise throughput TBD
0 commit comments