Commit graph

228 commits

Author SHA1 Message Date
Kevin Hannon
37629e3c21
batch/job: Fix scheduling directives mutation for not-yet-started suspended Jobs
When MutableSchedulingDirectivesForSuspendedJobs feature gate is
enabled, it overwrites the notStarted check with a stricter condition
requiring the JobSuspended=True condition. This rejects mutations on
suspended Jobs that have never started but whose JobSuspended condition
has not yet been set by the job controller, breaking external
controllers like MultiKueue that inject scheduling directives
immediately after creating a suspended Job.

Preserve the notStarted path as an OR condition alongside the
JobSuspended condition check, restoring pre-1.36 behavior for
not-yet-started Jobs while maintaining the new relaxation for
previously-started Jobs.

Kubernetes-issue: https://github.com/kubernetes/kubernetes/issues/139281
2026-05-27 09:38:44 -04:00
Joe Betz
10685fb246
Migrate all storage tests to use request info 2026-05-19 16:37:03 -04:00
Yongrui Lin
a791288d81 test/declarative_validation: migrate DV equivalence tests to new tree
Move the existing declarative_validation_test.go files out of
pkg/registry/ into a top-level tree at
test/declarative_validation/<group>/<kind>/. The new location pairs
each hand-written test with the per-Kind TestMain and version-init
files emitted by validation-gen, so the coverage gate runs alongside
the equivalence checks and apiVersions no longer needs to be
hand-maintained.
2026-05-09 19:11:01 +00:00
Kubernetes Prow Robot
af6d86c7cc
Merge pull request #138759 from soltysh/drop_job_features
Drop job features
2026-05-07 20:09:26 +05:30
Maciej Szulik
c35fd21a6b
Drop JobPodReplacementPolicy after the feature GA-ed in 1.34
Signed-off-by: Maciej Szulik <soltysh@gmail.com>
2026-05-07 12:05:44 +02:00
Patrick Ohly
163211ee45 apiserver: pass context with ReqInfo to AllowUnconditionalUpdate and AllowCreateOnUpdate
This enables implementing different behavior for AllowUnconditionalUpdate and
AllowCreateOnUpdate depending on the API version, which can be found in
ReqInfo.APIVersion. The specific need for this is to switch from
AllowUnconditionalUpdate=true (not recommended!) to false in v1 of
resource.k8s.io DeviceTaintRule.

This is done by adding the missing context parameter to the existing methods
instead of adding a new optional interface because a) the resulting
implementation is simpler and gets checked by the compiler and b) the Go API
guarantees of k8s.io/apiserver are more relaxed than in other modules because
it's less used downstream.

Example implementation:

    func (*deviceTaintRuleStrategy) AllowUnconditionalUpdate(ctx context.Context) bool {
           reqInfo, _ := request.RequestInfoFrom(ctx)
           if reqInfo != nil && reqInfo.APIVersion == "v1" {
                   // Should have done that already earlier. Better late than never...
                   return false
           }
           // Historic behavior for v1beta2 and older, cannot change that anymore.
           return true
    }
2026-05-05 12:48:19 +02:00
Maciej Szulik
57a80ebae8
Drop JobSuccessPolicy after the feature GA-ed in 1.33
Signed-off-by: Maciej Szulik <soltysh@gmail.com>
2026-05-05 11:09:40 +02:00
Maciej Szulik
432a3477cc
Drop JobBackoffLimitPerIndex after the feature GA-ed in 1.33
Signed-off-by: Maciej Szulik <soltysh@gmail.com>
2026-05-05 11:09:35 +02:00
Joe Betz
a0095b5379
Migrate all strategies to DV 2026-04-24 12:01:39 -04:00
Kubernetes Prow Robot
5edd1a9741
Merge pull request #136585 from zhzhuang-zju/job-validation
Improve error message for immutable job.status.startTime
2026-03-06 22:22:19 +05:30
zhzhuang-zju
8cd55303b1 fix the misleading error msg when updating job.status.startTime
Signed-off-by: zhzhuang-zju <m17799853869@163.com>
2026-03-04 10:52:59 +08:00
Your Name
701db6b6a6 validation-gen: Fix all stable api violations by prefixing +k8s:alpha(since:"1.36") and exclude output_tests from linting 2026-02-25 00:50:31 +00:00
Dan Roach
5b5cc2d498 Adding declarative validations to CronJob 2026-01-15 14:05:15 -07:00
Kevin Hannon
986020d6bd sync check in batch stategy to match AllowMutableSchedulingDirectives and AllowMutablePodResources 2026-01-12 15:40:34 -05:00
Michał Woźniak
5a7c90fb76 Allow mutable scheduling directives for suspended Jobs 2025-11-05 19:37:33 +00:00
Kubernetes Prow Robot
36622966a8
Merge pull request #132441 from kannon92/poc-job-relax-pod-template
[KEP-5440]: MutablePodResourcesForSuspendedJobs
2025-11-05 11:26:50 -08:00
Kevin Hannon
7db5311952 feat: Add MutablePodResourcesForSuspendedJobs feature gate
- Add feature gate to control mutable pod resources for suspended jobs
- Implement validatePodResourceUpdatesOnly function to allow only container resource updates
- Allow resource updates for suspended jobs regardless of whether they have started
- Add comprehensive unit and integration tests for all scenarios including started-then-suspended
- Ensure backward compatibility when feature gate is disabled

This enables users to update container resources on suspended jobs, including jobs that
have previously started and been suspended, while maintaining immutability for all other
pod template fields.
2025-11-05 10:38:05 -05:00
Kubernetes Prow Robot
276c59af7c
Merge pull request #134769 from dejanzele/fix-job-starttime-validation-on-resume
fix: allow job startTime updates on resume from suspended state
2025-11-04 09:14:08 -08:00
Maciej Szulik
b1a8d8849e
Update OWNERS to sig-apps owned registry packages (batch & policy)
Signed-off-by: Maciej Szulik <soltysh@gmail.com>
2025-10-28 11:36:45 +01:00
Dejan Zele Pejchev
bbd44717c1
fix: allow job startTime updates on resume from suspended state
Signed-off-by: Dejan Zele Pejchev <pejcev.dejan@gmail.com>
2025-10-26 18:26:30 +01:00
Tim Allclair
4986abe0b8 Automated refactoring to use SetFeatureGatesDuringTest 2025-10-01 21:10:53 -07:00
Davanum Srinivas
ebc1ccc491
Bump k8s.io/kube-openapi to latest SHA (f3f2b991d03b)
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2025-07-14 07:24:48 -04:00
Michal Wozniak
6e5c99dd05 Review remarks 2025-06-30 13:18:53 +02:00
Michal Wozniak
ca314b9f56 Fix validation for Job with suspend=true,completions=0 to set Complete condition 2025-06-30 07:58:04 +02:00
Dejan Zele Pejchev
bccc9fe470
KEP-3939: Job Pod Replacement Policy; promote to GA
Signed-off-by: Dejan Zele Pejchev <pejcev.dejan@gmail.com>
2025-06-16 16:26:03 +02:00
Yuki Iwai
749f03a49f Gradeate Job SuccessPolicy to Stable
Signed-off-by: Yuki Iwai <yuki.iwai.tz@gmail.com>
2025-03-07 07:21:12 +09:00
Michal Wozniak
a91ed902fe Graduate Backoff Limit Per Index as stable
Reenable the JobBackoffLimitPerIndex_Reenabling integration test
2025-02-26 17:06:37 +01:00
Kubernetes Prow Robot
38fab70477
Merge pull request #128398 from tenzen-y/remaining-job-tracking-annotation-testing
Job: Remove JobTrackingFinalizer annotation specific testings
2025-01-07 06:26:28 +01:00
Patrick Ohly
8a908e0c0b remove import doc comments
The "// import <path>" comment has been superseded by Go modules.
We don't have to remove them, but doing so has some advantages:

- They are used inconsistently, which is confusing.
- We can then also remove the (currently broken) hack/update-vanity-imports.sh.
- Last but not least, it would be a first step towards avoiding the k8s.io domain.

This commit was generated with
   sed -i -e 's;^package \(.*\) // import.*;package \1;' $(git grep -l '^package.*// import' | grep -v 'vendor/')

Everything was included, except for
   package labels // import k8s.io/kubernetes/pkg/util/labels
because that package is marked as "read-only".
2024-12-02 16:59:34 +01:00
Yuki Iwai
e5fd9cfb18 Job: Remove JobTrackingFinalizer annotation specific testings
Signed-off-by: Yuki Iwai <yuki.iwai.tz@gmail.com>
2024-10-29 12:32:06 +09:00
carlory
dae05f3b88 cleanup after JobPodFailurePolicy is promoted to GA 2024-07-18 10:00:56 +08:00
Michal Wozniak
f1233ac5e0 JobPodFailurePolicy to GA
# Conflicts:
#	pkg/controller/job/job_controller_test.go
2024-07-12 17:21:32 +02:00
Michal Wozniak
70c4965270 Add more test cases for SuccessCriteriaMet
Cleanup error messages in the new code

Add validation for the Job controller fields
2024-07-12 11:22:26 +02:00
Michal Wozniak
fb7704ba03 Delay setting terminal Job conditions until all pods are terminal
Fix the integration test typecheck

Fix after rebase

# Conflicts:
#	pkg/controller/job/job_controller_test.go
2024-07-11 20:54:09 +02:00
Kubernetes Prow Robot
cdcaea687c
Merge pull request #125751 from ahg-g/elastic-job
Graduate ElasticIndexedJob to GA
2024-07-11 11:08:24 -07:00
Michael Fraenkel
cd949bafa4
use MakePodSpec consistently (#125805)
cleaning up some tests after MakePod/MakePodSpec were introduced
2024-06-30 10:28:36 -07:00
Michael Fraenkel
a7264f95ff
pod terminationGracePeriodSeconds is always valid (#124461)
* Pod terminationGracePeriodSeconds is always valid

Validation of a pod spec will always use the pod's
TerminationGracePeriodSeconds value.

A set of pod test-helpers have been created to help construct Pods.

* remove unused func

* reduction

* reduce 2

* simplify test

* report invalid grace period

* update SupplementalGroupPolicy tests
2024-06-29 18:09:29 -07:00
ahg-g
be410c0dae Graduate ElasticIndexedJob to GA 2024-06-28 17:00:29 +00:00
Marek Siarkowicz
3ee8178768 Cleanup defer from SetFeatureGateDuringTest function call 2024-04-24 20:25:29 +02:00
Lan Liang
9236425df6 pkg/registry: drop pointer wrapper functions.
The new k8s.io/utils/ptr package provides generic wrapper functions,
which can be used instead of type-specific pointer wrapper functions.
This replaces the latter with the former, and migrates other uses of
the deprecated pointer package to ptr in affacted files.

See kubernetes/utils#283 for details.

Signed-off-by: Lan Liang <gcslyp@gmail.com>
2024-04-15 14:34:53 +00:00
Michal Wozniak
79fe37537c Adjust the validation to the current state 2024-03-08 17:43:24 +01:00
Yuki Iwai
e216742672 Job: Support for the JobSuccessPolicy (alpha)
Signed-off-by: Yuki Iwai <yuki.iwai.tz@gmail.com>
2024-03-08 05:49:09 +09:00
Michał Woźniak
e568a77a93
Support for the Job managedBy field (alpha) (#123273)
* support for the managed-by label in Job

* Use managedBy field instead of managed-by label

* Additional review remarks

* Review remarks 2

* review remarks 3

* Skip cleanup of finalizers for job with custom managedBy

* Drop the performance optimization

* imrpove logs
2024-03-05 09:25:15 -08:00
Maciej Szulik
9a58f6c4fb
Forbid creating CronJob with TZ or CRON_TZ, but allow updates 2023-10-20 17:14:03 +02:00
Dejan Pejchev
de5dcdc79b
cleanup: fix missing manual selectors in strategy test 2023-10-12 17:35:11 +02:00
Dejan Pejchev
761cb18a68
cleanup: refactor job strategy tests; add test for generating selectors in PrepareForCreate test 2023-10-12 17:32:35 +02:00
Dejan Pejchev
b9b436a018
cleanup: extract generateSelector from Validate method in job strategy 2023-10-12 17:32:32 +02:00
Dejan Zele Pejchev
921c0d0180
cleanup: add defaulting for job manual selector (#120206)
* cleanup: add defaulting for job manual selector

* cleanup: add assert in job defaults test for manual selector

* cleanup: fix failing job storage test

* cleanup: fix batch fuzzer to handle manual selector default

* cleanup: fix lint issue on checking bool condition in job strategy

* cleanup: remove TODO in generateSelectors in job strategy Validate; inline job manual selector assignment in fuzzer
2023-10-11 22:51:40 +02:00
kannon92
ce92952037 add podReplacementPolicy and terminating field to job api 2023-07-19 16:34:38 +00:00
Michal Wozniak
fcbfdc1710 Extend the Job API for BackoffLimitPerIndex 2023-07-18 11:28:15 +02:00