mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 12:15:52 +00:00
Graduate the JobSuccessPolicy to beta
Signed-off-by: Yuki Iwai <yuki.iwai.tz@gmail.com>
This commit is contained in:
parent
6e8dc2c250
commit
551931c6a8
2
api/openapi-spec/swagger.json
generated
2
api/openapi-spec/swagger.json
generated
@ -4845,7 +4845,7 @@
|
||||
},
|
||||
"successPolicy": {
|
||||
"$ref": "#/definitions/io.k8s.api.batch.v1.SuccessPolicy",
|
||||
"description": "successPolicy specifies the policy when the Job can be declared as succeeded. If empty, the default behavior applies - the Job is declared as succeeded only when the number of succeeded pods equals to the completions. When the field is specified, it must be immutable and works only for the Indexed Jobs. Once the Job meets the SuccessPolicy, the lingering pods are terminated.\n\nThis field is alpha-level. To use this field, you must enable the `JobSuccessPolicy` feature gate (disabled by default)."
|
||||
"description": "successPolicy specifies the policy when the Job can be declared as succeeded. If empty, the default behavior applies - the Job is declared as succeeded only when the number of succeeded pods equals to the completions. When the field is specified, it must be immutable and works only for the Indexed Jobs. Once the Job meets the SuccessPolicy, the lingering pods are terminated.\n\nThis field is beta-level. To use this field, you must enable the `JobSuccessPolicy` feature gate (enabled by default)."
|
||||
},
|
||||
"suspend": {
|
||||
"description": "suspend specifies whether the Job controller should create Pods or not. If a Job is created with suspend set to true, no Pods are created by the Job controller. If a Job is suspended after creation (i.e. the flag goes from false to true), the Job controller will delete all active Pods associated with this Job. Users must design their workload to gracefully handle this. Suspending a Job will reset the StartTime field of the Job, effectively resetting the ActiveDeadlineSeconds timer too. Defaults to false.",
|
||||
|
@ -388,7 +388,7 @@
|
||||
"$ref": "#/components/schemas/io.k8s.api.batch.v1.SuccessPolicy"
|
||||
}
|
||||
],
|
||||
"description": "successPolicy specifies the policy when the Job can be declared as succeeded. If empty, the default behavior applies - the Job is declared as succeeded only when the number of succeeded pods equals to the completions. When the field is specified, it must be immutable and works only for the Indexed Jobs. Once the Job meets the SuccessPolicy, the lingering pods are terminated.\n\nThis field is alpha-level. To use this field, you must enable the `JobSuccessPolicy` feature gate (disabled by default)."
|
||||
"description": "successPolicy specifies the policy when the Job can be declared as succeeded. If empty, the default behavior applies - the Job is declared as succeeded only when the number of succeeded pods equals to the completions. When the field is specified, it must be immutable and works only for the Indexed Jobs. Once the Job meets the SuccessPolicy, the lingering pods are terminated.\n\nThis field is beta-level. To use this field, you must enable the `JobSuccessPolicy` feature gate (enabled by default)."
|
||||
},
|
||||
"suspend": {
|
||||
"description": "suspend specifies whether the Job controller should create Pods or not. If a Job is created with suspend set to true, no Pods are created by the Job controller. If a Job is suspended after creation (i.e. the flag goes from false to true), the Job controller will delete all active Pods associated with this Job. Users must design their workload to gracefully handle this. Suspending a Job will reset the StartTime field of the Job, effectively resetting the ActiveDeadlineSeconds timer too. Defaults to false.",
|
||||
|
@ -339,8 +339,8 @@ type JobSpec struct {
|
||||
// When the field is specified, it must be immutable and works only for the Indexed Jobs.
|
||||
// Once the Job meets the SuccessPolicy, the lingering pods are terminated.
|
||||
//
|
||||
// This field is alpha-level. To use this field, you must enable the
|
||||
// `JobSuccessPolicy` feature gate (disabled by default).
|
||||
// This field is beta-level. To use this field, you must enable the
|
||||
// `JobSuccessPolicy` feature gate (enabled by default).
|
||||
// +optional
|
||||
SuccessPolicy *SuccessPolicy
|
||||
|
||||
|
@ -5171,12 +5171,16 @@ func TestSyncJobWithJobBackoffLimitPerIndex(t *testing.T) {
|
||||
UncountedTerminatedPods: &batch.UncountedTerminatedPods{},
|
||||
Conditions: []batch.JobCondition{
|
||||
{
|
||||
Type: batch.JobSuccessCriteriaMet,
|
||||
Status: v1.ConditionTrue,
|
||||
Type: batch.JobSuccessCriteriaMet,
|
||||
Status: v1.ConditionTrue,
|
||||
Reason: batch.JobReasonCompletionsReached,
|
||||
Message: "Reached expected number of succeeded pods",
|
||||
},
|
||||
{
|
||||
Type: batch.JobComplete,
|
||||
Status: v1.ConditionTrue,
|
||||
Type: batch.JobComplete,
|
||||
Status: v1.ConditionTrue,
|
||||
Reason: batch.JobReasonCompletionsReached,
|
||||
Message: "Reached expected number of succeeded pods",
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -7105,8 +7109,10 @@ func TestJobBackoffForOnFailure(t *testing.T) {
|
||||
expectedFailed: 0,
|
||||
expectedConditions: []batch.JobCondition{
|
||||
{
|
||||
Type: batch.JobComplete,
|
||||
Status: v1.ConditionTrue,
|
||||
Type: batch.JobComplete,
|
||||
Status: v1.ConditionTrue,
|
||||
Reason: batch.JobReasonCompletionsReached,
|
||||
Message: "Reached expected number of succeeded pods",
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -7124,12 +7130,16 @@ func TestJobBackoffForOnFailure(t *testing.T) {
|
||||
expectedFailed: 0,
|
||||
expectedConditions: []batch.JobCondition{
|
||||
{
|
||||
Type: batch.JobSuccessCriteriaMet,
|
||||
Status: v1.ConditionTrue,
|
||||
Type: batch.JobSuccessCriteriaMet,
|
||||
Status: v1.ConditionTrue,
|
||||
Reason: batch.JobReasonCompletionsReached,
|
||||
Message: "Reached expected number of succeeded pods",
|
||||
},
|
||||
{
|
||||
Type: batch.JobComplete,
|
||||
Status: v1.ConditionTrue,
|
||||
Type: batch.JobComplete,
|
||||
Status: v1.ConditionTrue,
|
||||
Reason: batch.JobReasonCompletionsReached,
|
||||
Message: "Reached expected number of succeeded pods",
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -7147,12 +7157,16 @@ func TestJobBackoffForOnFailure(t *testing.T) {
|
||||
expectedFailed: 0,
|
||||
expectedConditions: []batch.JobCondition{
|
||||
{
|
||||
Type: batch.JobSuccessCriteriaMet,
|
||||
Status: v1.ConditionTrue,
|
||||
Type: batch.JobSuccessCriteriaMet,
|
||||
Status: v1.ConditionTrue,
|
||||
Reason: batch.JobReasonCompletionsReached,
|
||||
Message: "Reached expected number of succeeded pods",
|
||||
},
|
||||
{
|
||||
Type: batch.JobComplete,
|
||||
Status: v1.ConditionTrue,
|
||||
Type: batch.JobComplete,
|
||||
Status: v1.ConditionTrue,
|
||||
Reason: batch.JobReasonCompletionsReached,
|
||||
Message: "Reached expected number of succeeded pods",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -369,6 +369,7 @@ const (
|
||||
// owner: @tenzen-y
|
||||
// kep: https://kep.k8s.io/3998
|
||||
// alpha: v1.30
|
||||
// beta: v1.31
|
||||
//
|
||||
// Allow users to specify when a Job can be declared as succeeded
|
||||
// based on the set of succeeded pods.
|
||||
@ -1094,7 +1095,7 @@ var defaultKubernetesFeatureGates = map[featuregate.Feature]featuregate.FeatureS
|
||||
|
||||
JobPodReplacementPolicy: {Default: true, PreRelease: featuregate.Beta},
|
||||
|
||||
JobSuccessPolicy: {Default: false, PreRelease: featuregate.Alpha},
|
||||
JobSuccessPolicy: {Default: true, PreRelease: featuregate.Beta},
|
||||
|
||||
KubeletCgroupDriverFromCRI: {Default: true, PreRelease: featuregate.Beta},
|
||||
|
||||
|
2
pkg/generated/openapi/zz_generated.openapi.go
generated
2
pkg/generated/openapi/zz_generated.openapi.go
generated
@ -17224,7 +17224,7 @@ func schema_k8sio_api_batch_v1_JobSpec(ref common.ReferenceCallback) common.Open
|
||||
},
|
||||
"successPolicy": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "successPolicy specifies the policy when the Job can be declared as succeeded. If empty, the default behavior applies - the Job is declared as succeeded only when the number of succeeded pods equals to the completions. When the field is specified, it must be immutable and works only for the Indexed Jobs. Once the Job meets the SuccessPolicy, the lingering pods are terminated.\n\nThis field is alpha-level. To use this field, you must enable the `JobSuccessPolicy` feature gate (disabled by default).",
|
||||
Description: "successPolicy specifies the policy when the Job can be declared as succeeded. If empty, the default behavior applies - the Job is declared as succeeded only when the number of succeeded pods equals to the completions. When the field is specified, it must be immutable and works only for the Indexed Jobs. Once the Job meets the SuccessPolicy, the lingering pods are terminated.\n\nThis field is beta-level. To use this field, you must enable the `JobSuccessPolicy` feature gate (enabled by default).",
|
||||
Ref: ref("k8s.io/api/batch/v1.SuccessPolicy"),
|
||||
},
|
||||
},
|
||||
|
@ -222,8 +222,8 @@ message JobSpec {
|
||||
// When the field is specified, it must be immutable and works only for the Indexed Jobs.
|
||||
// Once the Job meets the SuccessPolicy, the lingering pods are terminated.
|
||||
//
|
||||
// This field is alpha-level. To use this field, you must enable the
|
||||
// `JobSuccessPolicy` feature gate (disabled by default).
|
||||
// This field is beta-level. To use this field, you must enable the
|
||||
// `JobSuccessPolicy` feature gate (enabled by default).
|
||||
// +optional
|
||||
optional SuccessPolicy successPolicy = 16;
|
||||
|
||||
|
@ -347,8 +347,8 @@ type JobSpec struct {
|
||||
// When the field is specified, it must be immutable and works only for the Indexed Jobs.
|
||||
// Once the Job meets the SuccessPolicy, the lingering pods are terminated.
|
||||
//
|
||||
// This field is alpha-level. To use this field, you must enable the
|
||||
// `JobSuccessPolicy` feature gate (disabled by default).
|
||||
// This field is beta-level. To use this field, you must enable the
|
||||
// `JobSuccessPolicy` feature gate (enabled by default).
|
||||
// +optional
|
||||
SuccessPolicy *SuccessPolicy `json:"successPolicy,omitempty" protobuf:"bytes,16,opt,name=successPolicy"`
|
||||
|
||||
@ -649,7 +649,7 @@ const (
|
||||
// JobReasonSuccessPolicy reason indicates a SuccessCriteriaMet condition is added due to
|
||||
// a Job met successPolicy.
|
||||
// https://kep.k8s.io/3998
|
||||
// This is currently an alpha field.
|
||||
// This is currently a beta field.
|
||||
JobReasonSuccessPolicy string = "SuccessPolicy"
|
||||
// JobReasonCompletionsReached reason indicates a SuccessCriteriaMet condition is added due to
|
||||
// a number of succeeded Job pods met completions.
|
||||
|
@ -116,7 +116,7 @@ var map_JobSpec = map[string]string{
|
||||
"completions": "Specifies the desired number of successfully finished pods the job should be run with. Setting to null means that the success of any pod signals the success of all pods, and allows parallelism to have any positive value. Setting to 1 means that parallelism is limited to 1 and the success of that pod signals the success of the job. More info: https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/",
|
||||
"activeDeadlineSeconds": "Specifies the duration in seconds relative to the startTime that the job may be continuously active before the system tries to terminate it; value must be positive integer. If a Job is suspended (at creation or through an update), this timer will effectively be stopped and reset when the Job is resumed again.",
|
||||
"podFailurePolicy": "Specifies the policy of handling failed pods. In particular, it allows to specify the set of actions and conditions which need to be satisfied to take the associated action. If empty, the default behaviour applies - the counter of failed pods, represented by the jobs's .status.failed field, is incremented and it is checked against the backoffLimit. This field cannot be used in combination with restartPolicy=OnFailure.",
|
||||
"successPolicy": "successPolicy specifies the policy when the Job can be declared as succeeded. If empty, the default behavior applies - the Job is declared as succeeded only when the number of succeeded pods equals to the completions. When the field is specified, it must be immutable and works only for the Indexed Jobs. Once the Job meets the SuccessPolicy, the lingering pods are terminated.\n\nThis field is alpha-level. To use this field, you must enable the `JobSuccessPolicy` feature gate (disabled by default).",
|
||||
"successPolicy": "successPolicy specifies the policy when the Job can be declared as succeeded. If empty, the default behavior applies - the Job is declared as succeeded only when the number of succeeded pods equals to the completions. When the field is specified, it must be immutable and works only for the Indexed Jobs. Once the Job meets the SuccessPolicy, the lingering pods are terminated.\n\nThis field is beta-level. To use this field, you must enable the `JobSuccessPolicy` feature gate (enabled by default).",
|
||||
"backoffLimit": "Specifies the number of retries before marking this job failed. Defaults to 6",
|
||||
"backoffLimitPerIndex": "Specifies the limit for the number of retries within an index before marking this index as failed. When enabled the number of failures per index is kept in the pod's batch.kubernetes.io/job-index-failure-count annotation. It can only be set when Job's completionMode=Indexed, and the Pod's restart policy is Never. The field is immutable. This field is beta-level. It can be used when the `JobBackoffLimitPerIndex` feature gate is enabled (enabled by default).",
|
||||
"maxFailedIndexes": "Specifies the maximal number of failed indexes before marking the Job as failed, when backoffLimitPerIndex is set. Once the number of failed indexes exceeds this number the entire Job is marked as Failed and its execution is terminated. When left as null the job continues execution of all of its indexes and is marked with the `Complete` Job condition. It can only be specified when backoffLimitPerIndex is set. It can be null or up to completions. It is required and must be less than or equal to 10^4 when is completions greater than 10^5. This field is beta-level. It can be used when the `JobBackoffLimitPerIndex` feature gate is enabled (enabled by default).",
|
||||
|
@ -389,7 +389,7 @@ func TestJobPodFailurePolicy(t *testing.T) {
|
||||
Value: 1,
|
||||
},
|
||||
wantJobFinishedMetric: metricLabelsWithValue{
|
||||
Labels: []string{"NonIndexed", "succeeded", ""},
|
||||
Labels: []string{"NonIndexed", "succeeded", "CompletionsReached"},
|
||||
Value: 1,
|
||||
},
|
||||
},
|
||||
@ -400,7 +400,7 @@ func TestJobPodFailurePolicy(t *testing.T) {
|
||||
wantFailed: 1,
|
||||
wantJobConditionType: batchv1.JobComplete,
|
||||
wantJobFinishedMetric: metricLabelsWithValue{
|
||||
Labels: []string{"NonIndexed", "succeeded", ""},
|
||||
Labels: []string{"NonIndexed", "succeeded", "CompletionsReached"},
|
||||
Value: 1,
|
||||
},
|
||||
wantPodFailuresHandledByPolicyRuleMetric: &metricLabelsWithValue{
|
||||
@ -415,7 +415,7 @@ func TestJobPodFailurePolicy(t *testing.T) {
|
||||
wantFailed: 1,
|
||||
wantJobConditionType: batchv1.JobComplete,
|
||||
wantJobFinishedMetric: metricLabelsWithValue{
|
||||
Labels: []string{"NonIndexed", "succeeded", ""},
|
||||
Labels: []string{"NonIndexed", "succeeded", "CompletionsReached"},
|
||||
Value: 1,
|
||||
},
|
||||
wantPodFailuresHandledByPolicyRuleMetric: &metricLabelsWithValue{
|
||||
@ -2474,7 +2474,7 @@ func TestNonParallelJob(t *testing.T) {
|
||||
})
|
||||
validateFinishedPodsNoFinalizer(ctx, t, clientSet, jobObj)
|
||||
validateCounterMetric(ctx, t, metrics.JobFinishedNum, metricLabelsWithValue{
|
||||
Labels: []string{"NonIndexed", "succeeded", ""},
|
||||
Labels: []string{"NonIndexed", "succeeded", "CompletionsReached"},
|
||||
Value: 1,
|
||||
})
|
||||
validateCounterMetric(ctx, t, metrics.JobPodsFinished, metricLabelsWithValue{
|
||||
@ -2562,7 +2562,7 @@ func TestParallelJob(t *testing.T) {
|
||||
validateFinishedPodsNoFinalizer(ctx, t, clientSet, jobObj)
|
||||
validateTerminatedPodsTrackingFinalizerMetric(ctx, t, 7)
|
||||
validateCounterMetric(ctx, t, metrics.JobFinishedNum, metricLabelsWithValue{
|
||||
Labels: []string{"NonIndexed", "succeeded", ""},
|
||||
Labels: []string{"NonIndexed", "succeeded", "CompletionsReached"},
|
||||
Value: 1,
|
||||
})
|
||||
validateCounterMetric(ctx, t, metrics.JobPodsFinished, metricLabelsWithValue{
|
||||
@ -2704,7 +2704,7 @@ func TestParallelJobWithCompletions(t *testing.T) {
|
||||
validateJobPodsStatus(ctx, t, clientSet, jobObj, want)
|
||||
validateFinishedPodsNoFinalizer(ctx, t, clientSet, jobObj)
|
||||
validateCounterMetric(ctx, t, metrics.JobFinishedNum, metricLabelsWithValue{
|
||||
Labels: []string{"NonIndexed", "succeeded", ""},
|
||||
Labels: []string{"NonIndexed", "succeeded", "CompletionsReached"},
|
||||
Value: 1,
|
||||
})
|
||||
validateCounterMetric(ctx, t, metrics.JobPodsFinished, metricLabelsWithValue{
|
||||
@ -2800,7 +2800,7 @@ func TestIndexedJob(t *testing.T) {
|
||||
Value: 4,
|
||||
})
|
||||
validateCounterMetric(ctx, t, metrics.JobFinishedNum, metricLabelsWithValue{
|
||||
Labels: []string{"Indexed", "succeeded", ""},
|
||||
Labels: []string{"Indexed", "succeeded", "CompletionsReached"},
|
||||
Value: 1,
|
||||
})
|
||||
validateCounterMetric(ctx, t, metrics.JobPodsFinished, metricLabelsWithValue{
|
||||
|
Loading…
Reference in New Issue
Block a user