Commit graph

130 commits

Author SHA1 Message Date
Yongrui Lin
a9b594be6a Mark MaxFailedIndexes dependency error as covered by declarative
Adds .WithOrigin("dependentRequired").MarkCoveredByDeclarative() so the
parity matcher (ByType+ByOrigin) identifies the declarative counterpart.
2026-06-08 21:58:29 +00:00
Lalit Chauhan
0c84f84ec8 Fix wrong marking of errors 2026-06-03 19:33:53 +00:00
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
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
Dan Roach
5b5cc2d498 Adding declarative validations to CronJob 2026-01-15 14:05:15 -07: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
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
PersistentJZH
b738e8c3ca fix panic in cron.ParseStandard
Signed-off-by: PersistentJZH <zhihao.kan17@gmail.com>

fix

optimize logic

fix unit test
2025-10-10 23:51:05 +08:00
Tim Hockin
2d48dae391 Eliminate public ValidateReplicationControllerName
Everyone who referenced it now uses the underlying function.  Clearer
and frees me up to change objectMeta validation without impacting anyone
else.
2025-10-01 19:45:37 +00:00
xiaoweim
740e568468 address review comments 2025-07-14 18:13:00 +00:00
xiaoweim
61542e7a98 Cleanup: Remove field name from invalid field detail message 2025-07-14 18:13:00 +00:00
Tim Hockin
4ca91a0305
WIP: Fix tests
Notes:
* For types that define String() - should we prefer that or JSON?
* metav1.Time has a MarshalJSON() and inhereits a String() and they are
  different
* Since validation runs on internal types, we still get some GoNames
  instead of goNames.
2025-06-19 10:11:17 +09:00
Tim Hockin
c8111709e5
Add an error matcher, convert 2 tests
I fixed up the TestValidateEndpointsCreate path to show the matcher
instead of manual origin checking.

I picked TestValidateTopologySpreadConstraints because it was the last
failing test on my screen when I changed on of the commonly hard-coded
error strings. I fixed exactly those validation errors that were needed
to make this test pass.  Some of the Origin values can be debated.

The `field/testing.Matcher` interface allows tests to configure the
criteria by which they want to match expected and actual errors.  The
hope is that everyone will use Origin for Invalid errors.

There's some collateral impact for tests which use exact-comparisons and
don't expect origins.  These are all candidates for using the matcher.
2025-02-28 08:36:26 -08:00
Tim Hockin
c8eeb486f4
Call-site comments: the "" arg to TooLong is unused 2024-11-05 15:10:24 -08:00
Tim Hockin
8a7af90300
Clarify that value arg to field.TooLong is unused 2024-11-05 15:10:23 -08:00
Tim Hockin
4d0e1c8fd4
Kill TooLongMaxLength() in favor of TooLong() 2024-11-05 15:10:22 -08:00
Michal Wozniak
cad648035a Job Pod Failure policy - cover testing of negative exit codes 2024-10-28 07:24:26 +01:00
Kubernetes Prow Robot
c9525d3865
Merge pull request #120629 from Rei1010/pointerClean
Use ptr.Equal to compare the value
2024-10-23 01:17:07 +01:00
Stephen Kitt
ff3e9ea79f
pkg/api(s): 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.

Signed-off-by: Stephen Kitt <skitt@redhat.com>
2024-09-23 23:00:34 +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
wen.rui
af2a43f0ab Use ptr.Equal to compare the value 2024-05-08 09:21:22 +08: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
Kubernetes Prow Robot
1fceb815ac
Merge pull request #123437 from tenzen-y/fix-job-validatioin-test-name
Job: Fix test case names for the validations
2024-03-02 13:33:18 -08:00
Kubernetes Prow Robot
9fa043e769
Merge pull request #123181 from tenzen-y/job-avoid-casts-due-to-old-sets
Job: Use generic sets to avoid unnecessary string casts in valiations
2024-02-22 13:03:10 -08:00
Yuki Iwai
cc515bd8f1 Job: Fix test case names for the validations
Signed-off-by: Yuki Iwai <yuki.iwai.tz@gmail.com>
2024-02-22 15:13:38 +09:00
Yuki Iwai
1ef469343f Job: Use generic sets to avoid unnecessary string casts in valiations
Signed-off-by: Yuki Iwai <yuki.iwai.tz@gmail.com>
2024-02-08 08:02:00 +09:00
Yuki Iwai
71bf563034 Job: Stop unnecessary sting casts in validations
Signed-off-by: Yuki Iwai <yuki.iwai.tz@gmail.com>
2024-02-02 06:46:30 +09:00
Maciej Szulik
9a58f6c4fb
Forbid creating CronJob with TZ or CRON_TZ, but allow updates 2023-10-20 17:14:03 +02:00
kannon92
f73c253acc fix typos for pod replacement policy 2023-08-09 20:34:48 +00: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
Kubernetes Prow Robot
bc6cbdabbe
Merge pull request #117852 from tenzen-y/replace-deprecated-sets
Job: Use generic Set in validation
2023-05-24 14:47:00 -07:00
Yuki Iwai
2e2afc7fd2 Job: Use generic Set in validation
Signed-off-by: Yuki Iwai <yuki.iwai.tz@gmail.com>
2023-05-12 03:26:25 +09:00
Kubernetes Prow Robot
367180d781
Merge pull request #117933 from tenzen-y/replace-deprecated-Prt-utils
Job: Replace deprecated pointer utils with supported ones
2023-05-11 09:59:14 -07:00
Yuki Iwai
de882f5193 Job: Replace deprecated pointer utils with supported ones
Signed-off-by: Yuki Iwai <yuki.iwai.tz@gmail.com>
2023-05-11 19:29:14 +09:00
Tim Hockin
ec3379a717
Do hostNet Pod-ports -> hostPorts in Pod defaults
Rather than doing it in PodSpec defaulting, which triggers in
Deployments and DaemonSets, do it only when a Pod is actually in play.
2023-05-09 18:10:20 -07:00
Yuki Iwai
235c261196 Job: Fix a misspelling
Signed-off-by: Yuki Iwai <yuki.iwai.tz@gmail.com>
2023-05-09 00:25:45 +09:00
Kubernetes Prow Robot
7add692580
Merge pull request #117633 from kannon92/remove-job-tracking-finalizers
remove tracking annotation from validation and webhooks
2023-05-04 10:34:43 -07:00
Tim Hockin
d55b67b349
Clean up brace whitespace in **/validation_test.go
This was making my eyes bleed as I read over code.

I used the following in vim.  I made them up on the fly, but they seemed
to pass manual inspection.

:g/},\n\s*{$/s//}, {/
:w
:g/{$\n\s*{$/s//{{/
:w
:g/^\(\s*\)},\n\1},$/s//}},/
:w
:g/^\(\s*\)},$\n\1}$/s//}}/
:w
2023-05-02 00:48:42 -07:00
kannon92
6a4cf352b8 remove tracking annotation from validation and webhooks 2023-04-26 17:16:05 +00:00
kannon92
aef8cbab89 Add batch.kubernetes.io to labels created in the Job controller. 2023-03-11 12:27:38 +00:00
Kubernetes Prow Robot
48e4052fc0
Merge pull request #114902 from TommyStarK/pkg-apis/replace-deprecated-pointer-function
pkg/apis: Replace deprecated pointer function
2023-03-09 21:34:15 -08:00