@@ -153,7 +153,8 @@ type JobStatus struct {
153
153
154
154
// UncountedTerminatedPods holds UIDs of Pods that have finished but
155
155
// haven't been accounted in the counters.
156
- // If nil, Job tracking doesn't make use of this structure.
156
+ // Old jobs might not be tracked using this field, in which case this
157
+ // field remains null.
157
158
// +optional
158
159
UncountedTerminatedPods *UncountedTerminatedPods
159
160
}
@@ -179,8 +180,8 @@ could be stopped at any point and executed again from the first step without
179
180
losing information. Generally, all the steps happen in a single Job sync
180
181
cycle.
181
182
182
- 0 . The Job controller adds a the ` batch.kubernetes.io/job-completion ` finalizer
183
- to the Job .
183
+ 0 . kube-apiserver adds the ` batch.kubernetes.io/job-completion ` finalizer
184
+ to newly created Jobs .
184
185
1 . The Job controller calculates the number of succeeded Pods as the sum of:
185
186
- ` .status.succeeded ` ,
186
187
- the size of ` job.status.uncountedTerminatedPods.succeeded ` and
@@ -329,19 +330,22 @@ time, the cluster can have Jobs whose Pods don't have the
329
330
` batch.kubernetes.io/job-completion ` finalizer. It would be hard to add the
330
331
finalizer to all Pods while preventing race conditions.
331
332
332
- We use ` .status.uncountedTerminatedPods != nil ` to indicate whether the Job
333
- was created after the feature was enabled. If this field is nil, the Job
334
- controller tracks Pods using the legacy tracking.
333
+ The job controller uses the existence of the finalizer
334
+ ` 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,
336
+ the job controllers tracks Pods using the legacy tracking (with lingering Pods).
335
337
336
- The kube-apiserver sets ` .status.uncountedTerminatedPods ` to an empty struct
337
- when the feature gate ` JobTrackingWithFinalizers ` is enabled, at Job
338
- creation.
338
+ The kube-apiserver sets the ` batch.kubernetes.io/job-completion ` finalizer to
339
+ newly created Jobs when the feature gate ` JobTrackingWithFinalizers ` is enabled.
339
340
340
341
When the feature is disabled after being enabled for some time, the next time
341
342
the Job controller syncs a Job:
342
- 1 . It removes finalizers from all Pods owned by the Job .
343
+ 1 . It removes finalizers from the Job and all the Pods owned by it .
343
344
2 . Sets ` .status.uncountedTerminatedPods ` to nil.
344
345
346
+ After this point, the Job will no longer be tracked using finalizers, even if
347
+ the feature gate is re-enabled.
348
+
345
349
### Version Skew Strategy
346
350
347
351
No implications to node runtime.
@@ -476,8 +480,8 @@ previous answers based on experience in the field._
476
480
- estimated throughput: one per Pod created by the Job controller, when Pod
477
481
finishes or is removed.
478
482
- originating component: kube-controller-manager
479
- - PATCH Jobs, to add and remove finalizers.
480
- - estimated throughput: two calls for each Job created.
483
+ - PATCH Jobs, to remove finalizers.
484
+ - estimated throughput: one call for each Job created.
481
485
- originating component: kube-controller-manager
482
486
- PUT Job status, to keep track of uncounted Pods.
483
487
- estimated throughput: at least one per Job sync. The job controller
0 commit comments