Commit Graph

323 Commits

Author SHA1 Message Date
kannon92
32ac4a9581 left over uncounted from tracking cleanup 2023-02-22 16:45:53 +00:00
Daniel Vega-Myhre
2a81337e7c update prev succeeded indexes for indexed jobs unconditionally 2023-01-31 19:15:53 +00:00
Kubernetes Prow Robot
5550064bc2
Merge pull request #115063 from kannon92/tracking-remove-comments
tracking with finalizers is the default way for the job controller so comments are not needed that say we are tracking with finalizers
2023-01-17 07:56:44 -08:00
Kubernetes Prow Robot
9af5ae0365
Merge pull request #115030 from kannon92/remove-pod-error-job-tracking
Update SyncJob with PodControllerError updates in job unit tests
2023-01-13 12:08:14 -08:00
Kubernetes Prow Robot
70217a4083
Merge pull request #114944 from mimowo/fix-active-deadline-test
Fix the job controller unit test for enforcing ActiveDeadlineSeconds
2023-01-13 10:46:26 -08:00
kannon92
4890928b78 tracking with finalizers is the default way for the job controller 2023-01-13 16:48:35 +00:00
kannon92
3a838033f8 Update SyncJob with PodControllerError updates in job unit tests 2023-01-13 16:39:18 +00:00
Michal Wozniak
7065b42bb2 Fix the job controller unit test for enforcing ActiveDeadlineSeconds 2023-01-13 16:48:15 +01:00
Nikhita Raghunath
fd8d92a29d pkg/controller/job: re-honor exponential backoff
This commit makes the job controller re-honor exponential backoff for
failed pods. Before this commit, the controller created pods without any
backoff. This is a regression because the controller used to
create pods with an exponential backoff delay before (10s, 20s, 40s ...).

The issue occurs only when the JobTrackingWithFinalizers feature is
enabled (which is enabled by default right now). With this feature, we
get an extra pod update event when the finalizer of a failed pod is
removed.

Note that the pod failure detection and new pod creation happen in the
same reconcile loop so the 2nd pod is created immediately after the 1st
pod fails. The backoff is only applied on 2nd pod failure, which means
that the 3rd pod created 10s after the 2nd pod, 4th pod is created 20s
after the 3rd pod and so on.

This commit fixes a few bugs:

1. Right now, each time `uncounted != nil` and the job does not see a
_new_ failure, `forget` is set to true and the job is removed from the
queue. Which means that this condition is also triggered each time the
finalizer for a failed pod is removed and `NumRequeues` is reset, which
results in a backoff of 0s.

2. Updates `updatePod` to only apply backoff when we see a particular
pod failed for the first time. This is necessary to ensure that the
controller does not apply backoff when it sees a pod update event
for finalizer removal of a failed pod.

3. If `JobsReadyPods` feature is enabled and backoff is 0s, the job is
now enqueued after `podUpdateBatchPeriod` seconds, instead of 0s. The
unit test for this check also had a few bugs:
    - `DefaultJobBackOff` is overwritten to 0 in certain unit tests,
    which meant that `DefaultJobBackOff` was considered to be 0,
    effectively not running any meaningful checks.
    - `JobsReadyPods` was not enabled for test cases that ran tests
    which required the feature gate to be enabled.
    - The check for expected and actual backoff had incorrect
    calculations.
2023-01-12 20:34:10 +05:30
kannon92
6dfaeff33c Remove Legacy Job Tracking 2023-01-10 14:52:54 +00:00
Kubernetes Prow Robot
e7549eae87
Merge pull request #114905 from kannon92/sync-job-test-fix
Fix SyncPastDeadlineJobFinished for enabling finalizer path
2023-01-09 12:47:28 -08:00
kannon92
0362c67859 Fix SyncPastDeadlineJobFinished for enabling finalizer path 2023-01-09 17:12:52 +00:00
Aldo Culquicondor
4c1b95ddfa
Ensure job is up to date in informer cache in test
The fake client doesn't guarantee that the informer cache is updated.
If it's not up-to-date, the controller always tries to set the
StartTime, leading to a broken test.

Change-Id: I71f26d46ea44beff88f0d03517985348654aec95
2023-01-09 10:53:19 -05:00
Harsha Narayana
208c3868cf
job controller: refactored job controller to be able to inject FakeClock for Unit Test 2022-12-20 21:29:24 +05:30
Kubernetes Prow Robot
0cd13e573c
Merge pull request #113196 from mimowo/job-controller-reviewer
Self-nominate mimowo as a reviewer for pkg/controller/job & test/integration/job packages
2022-12-10 02:01:39 -08:00
ialidzhikov
aede3fbf40 pkg/controller: Replace deprecated func usage from the k8s.io/utils/pointer pkg 2022-11-23 17:40:23 +02:00
Aldo Culquicondor
7dc36bdf82
Wait for Pods to finish before considering Failed in Job (#113860)
* Wait for Pods to finish before considering Failed

Limit behavior to feature gates PodDisruptionConditions and
JobPodFailurePolicy and jobs with a podFailurePolicy.

Change-Id: I926391cc2521b389c8e52962afb0d4a6a845ab8f

* Remove check for unsheduled terminating pod

Change-Id: I3dc05bb4ea3738604f01bf8cb5fc8cc0f6ea54ec
2022-11-15 09:44:53 -08:00
Aldo Culquicondor
bc5afaf580
Fix match onExitCodes when Pod is not terminated
Change-Id: Id1f9c46f8b6a12115577a1fadb12adc580c9ba6a
2022-11-11 10:05:11 -05:00
Michal Wozniak
c803892bd8 Enable the feature into beta 2022-11-09 09:02:40 +01:00
Maciej Szulik
39d9981dc2
Promote job-related metrics to stable 2022-11-07 19:28:40 +01:00
Aldo Culquicondor
4948918155
Graduate JobTrackingWithFinalizers to stable
Change-Id: Ifc749a85b1270c0155ac511b91d4681d53236820
2022-11-04 17:05:53 -04:00
Aldo Culquicondor
5e03865f65
Add benchmark for large indexed job
Change-Id: I556f0cce5842699c98654cfb5a66e7c8d63b2e2e
2022-11-02 11:56:26 -04:00
Michał Woźniak
3628532311
Extend metrics with the new labels (#113324)
* Extend job metrics

* Refactor TestMetrics to extract its checks into dedicated tests per feature
2022-10-31 08:50:45 -07:00
Aldo Culquicondor
12d308f5c4 Add metric for terminated pods with tracking finalizer
Change-Id: I26f3169588c30ed82250cb7baff8e277f8d13bb7
2022-10-20 11:35:20 -04:00
Michal Wozniak
b1e575aaf7 Self-nominate mimowo as a reviewer for pkg/controller/job & test/integration/job
I think I'm ready to start review and LGTM code changes within this
package, but not necessarily for the entire sig-apps.

My PRs to the packages:
https://github.com/kubernetes/kubernetes/pull/110292
https://github.com/kubernetes/kubernetes/pull/111113
https://github.com/kubernetes/kubernetes/pull/112948

PRs to the packages I contributed reviews to:
https://github.com/kubernetes/kubernetes/pull/113166
https://github.com/kubernetes/kubernetes/pull/110294
2022-10-20 09:22:35 +02:00
Kubernetes Prow Robot
28ced69b76
Merge pull request #113054 from logicalhan/proxy-metric
remove rate limiter metric as it is not in use
2022-10-17 11:09:18 -07:00
Han Kang
2bbd445f50 remove rate limiter metric as it is not in use
Change-Id: I91157653e3860eeecc3f572aee88da6ffc65faed
2022-10-13 13:07:11 -07:00
Michal Wozniak
b64e5b2d15 Fix the occasional double-counting job_finished_total metric
The reason for the issue is that the metrics were bumped before the
final job status update. In case the update failed the path was
repeated by the next syncJob leading to double-counting of the metrics.

The solution is to delay recording metrics and broadcasting events
after the job status update succeeds.
2022-10-13 17:23:03 +02:00
Kubernetes Prow Robot
afebf498d7
Merge pull request #111314 from BinacsLee/binacs/cleanup-use-clone-to-avoid-interim-slice
cleanup: use sets.Clone() to avoid interim slice
2022-10-04 07:34:22 -07:00
Aldo Culquicondor
848eece7b7 Add alculquicondor to job OWNERS
Change-Id: If974f0890ef4accbd7d2111fb1a1aa38718dc74b
2022-08-26 11:29:37 -04:00
Aldo Culquicondor
c1e0dac461 Fix deleting UIDs tracking expectations
Change-Id: I5dad644cf5cb232ebed0950a14b35a781a38eeb0
2022-08-05 12:37:31 -04:00
Michal Wozniak
bf9ce70de3 Support handling of pod failures with respect to the specified rules 2022-08-04 18:39:08 +02:00
Aldo Culquicondor
ca8cebe5ba Fix JobTrackingWithFinalizers when a pod succeeds after the job fails
Change-Id: I3be351fb3b53216948a37b1d58224f8fbbf22b47
2022-08-02 19:33:06 -04:00
Davanum Srinivas
a9593d634c
Generate and format files
- Run hack/update-codegen.sh
- Run hack/update-generated-device-plugin.sh
- Run hack/update-generated-protobuf.sh
- Run hack/update-generated-runtime.sh
- Run hack/update-generated-swagger-docs.sh
- Run hack/update-openapi-spec.sh
- Run hack/update-gofmt.sh

Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2022-07-26 13:14:05 -04:00
BinacsLee
ae0c7b1ffb cleanup: use sets.Clone() to avoid interim slice 2022-07-21 20:21:01 +08:00
Aldo Culquicondor
b492f49c9f Do not skip job requeue in conflict error
Change-Id: Ie97977887a1cc3de58922d73dce92ae1965965bf
2022-07-08 16:14:32 +00:00
Aldo Culquicondor
62a25920e6 Wait for cache sync in TestSyncPastDeadlineJobFinished
Change-Id: I6f023ca6999108f4f86a0f57831d47704cdbb42b
2022-06-24 09:22:59 -04:00
Aldo Culquicondor
817c8bbf59 Increase timeout for TestSyncPastDeadlineJobFinished
To mitigate flakiness

Change-Id: I1d0286d16d2b7dd3a605690e9a2d4d2f954701ff
2022-06-21 14:49:10 -04:00
Harsha Narayana
eea7dca085
GIT-110239: fix activeDeadlineSeconds enforcement bug
GIT-110239: add additional tests with preset Status.StartTime

GIT-110239: add additional tests with preset Status.StartTime
2022-06-13 20:06:44 +05:30
Kubernetes Prow Robot
6cd258f9f5
Merge pull request #110292 from mimowo/109904-avoid-duplicate-conditions
Avoid duplicate Failed conditions in job status
2022-06-09 14:01:45 -07:00
Michal Wozniak
e298649b6c Avoid duplicate conditions by updating the pre-existing failed condition
in case its status is False or Unknown.

In case the status of the pre-existing condition is true we ignore the new
condition. If there is no pre-existing failed condition, then append
the new failed condition as before.

Also, make the condition comparisons less hacky by ignoring timestamp fields
in tests.
2022-06-01 19:32:53 +02:00
Wojciech Tyczyński
11b679c66a Fix event broadcaster shutdown in multiple controllers 2022-05-17 22:14:19 +02:00
Aldo Culquicondor
a5f5eab5fd Wait for cache to sync in job's TestWatchOrphanPods
Otherwise the event handler might not be called.

Change-Id: I23c93c2251b411430a0f2469686db6355d84af2f
2022-05-10 14:18:21 -04:00
Aldo Culquicondor
09caa36718 Fix removing finalizer from finished jobs
In some rare race conditions, the job controller might create new pods after the job is declared finished.

Change-Id: I8a00429c8845463259cd7f82bb3c241d0011583c
2022-04-20 16:39:10 -04:00
Aldo Culquicondor
53aa05df3a Don't mark job as failed until expectations are satisfied
Change-Id: I99206f35f6f145054c005ab362c792e71b9b15f4
2022-04-20 16:39:10 -04:00
Aldo Culquicondor
8c00f510ef Graduate JobReadyPods to beta
Set podUpdateBatchPeriod to 1s

Change-Id: I8a10fd8f8559adad9df179b664b8c82851607855
2022-03-29 10:07:41 -04:00
Aldo Culquicondor
8776931abb Remove finalizer when orphaned
Change-Id: Id88a28755660812a274dffab2693cb8a0ef4235c
2022-03-24 11:57:51 -04:00
Aldo Culquicondor
211e33d93f Fix: Clean job tracking finalizer from orphan pods
Change-Id: I04cd70725fd1830be8daf2dca53f67bc10a379b7
2022-03-24 11:57:51 -04:00
Aldo Culquicondor
2c5d0a273c Graduate IndexedJob to stable
- Lock feature gate to true and schedule for deletion in 1.26
- Remove checks on feature gate
- Graduate E2E test to Conformance

Change-Id: I6814819d318edaed5c86dae4055f4b050a4d39fd
2022-03-15 13:41:06 -04:00
Abdullah Gharaibeh
b2d2ec9e76 Graduate SuspendJob to GA 2022-02-15 10:46:13 -05:00