mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-20 09:33:52 +00:00
Graduate SuspendJob to GA
This commit is contained in:
@@ -208,9 +208,6 @@ type JobSpec struct {
|
||||
// Suspending a Job will reset the StartTime field of the Job, effectively
|
||||
// resetting the ActiveDeadlineSeconds timer too. Defaults to false.
|
||||
//
|
||||
// This field is beta-level, gated by SuspendJob feature flag (enabled by
|
||||
// default).
|
||||
//
|
||||
// +optional
|
||||
Suspend *bool
|
||||
}
|
||||
|
@@ -49,7 +49,7 @@ func SetDefaults_Job(obj *batchv1.Job) {
|
||||
mode := batchv1.NonIndexedCompletion
|
||||
obj.Spec.CompletionMode = &mode
|
||||
}
|
||||
if utilfeature.DefaultFeatureGate.Enabled(features.SuspendJob) && obj.Spec.Suspend == nil {
|
||||
if obj.Spec.Suspend == nil {
|
||||
obj.Spec.Suspend = utilpointer.BoolPtr(false)
|
||||
}
|
||||
}
|
||||
|
@@ -40,7 +40,6 @@ func TestSetDefaultJob(t *testing.T) {
|
||||
defaultLabels := map[string]string{"default": "default"}
|
||||
tests := map[string]struct {
|
||||
indexedJobEnabled bool
|
||||
suspendJobEnabled bool
|
||||
original *batchv1.Job
|
||||
expected *batchv1.Job
|
||||
expectLabels bool
|
||||
@@ -58,6 +57,7 @@ func TestSetDefaultJob(t *testing.T) {
|
||||
Completions: pointer.Int32Ptr(1),
|
||||
Parallelism: pointer.Int32Ptr(1),
|
||||
BackoffLimit: pointer.Int32Ptr(6),
|
||||
Suspend: pointer.BoolPtr(false),
|
||||
},
|
||||
},
|
||||
expectLabels: true,
|
||||
@@ -77,12 +77,12 @@ func TestSetDefaultJob(t *testing.T) {
|
||||
Parallelism: pointer.Int32Ptr(1),
|
||||
BackoffLimit: pointer.Int32Ptr(6),
|
||||
CompletionMode: completionModePtr(batchv1.NonIndexedCompletion),
|
||||
Suspend: pointer.BoolPtr(false),
|
||||
},
|
||||
},
|
||||
expectLabels: true,
|
||||
},
|
||||
"All unspecified, suspend job enabled -> sets all to default values": {
|
||||
suspendJobEnabled: true,
|
||||
original: &batchv1.Job{
|
||||
Spec: batchv1.JobSpec{
|
||||
Template: v1.PodTemplateSpec{
|
||||
@@ -101,7 +101,6 @@ func TestSetDefaultJob(t *testing.T) {
|
||||
expectLabels: true,
|
||||
},
|
||||
"suspend set, everything else is defaulted": {
|
||||
suspendJobEnabled: true,
|
||||
original: &batchv1.Job{
|
||||
Spec: batchv1.JobSpec{
|
||||
Suspend: pointer.BoolPtr(true),
|
||||
@@ -136,6 +135,7 @@ func TestSetDefaultJob(t *testing.T) {
|
||||
Completions: pointer.Int32Ptr(1),
|
||||
Parallelism: pointer.Int32Ptr(1),
|
||||
BackoffLimit: pointer.Int32Ptr(6),
|
||||
Suspend: pointer.BoolPtr(false),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -152,6 +152,7 @@ func TestSetDefaultJob(t *testing.T) {
|
||||
Spec: batchv1.JobSpec{
|
||||
Parallelism: pointer.Int32Ptr(0),
|
||||
BackoffLimit: pointer.Int32Ptr(6),
|
||||
Suspend: pointer.BoolPtr(false),
|
||||
},
|
||||
},
|
||||
expectLabels: true,
|
||||
@@ -169,6 +170,7 @@ func TestSetDefaultJob(t *testing.T) {
|
||||
Spec: batchv1.JobSpec{
|
||||
Parallelism: pointer.Int32Ptr(2),
|
||||
BackoffLimit: pointer.Int32Ptr(6),
|
||||
Suspend: pointer.BoolPtr(false),
|
||||
},
|
||||
},
|
||||
expectLabels: true,
|
||||
@@ -187,6 +189,7 @@ func TestSetDefaultJob(t *testing.T) {
|
||||
Completions: pointer.Int32Ptr(2),
|
||||
Parallelism: pointer.Int32Ptr(1),
|
||||
BackoffLimit: pointer.Int32Ptr(6),
|
||||
Suspend: pointer.BoolPtr(false),
|
||||
},
|
||||
},
|
||||
expectLabels: true,
|
||||
@@ -205,6 +208,7 @@ func TestSetDefaultJob(t *testing.T) {
|
||||
Completions: pointer.Int32Ptr(1),
|
||||
Parallelism: pointer.Int32Ptr(1),
|
||||
BackoffLimit: pointer.Int32Ptr(5),
|
||||
Suspend: pointer.BoolPtr(false),
|
||||
},
|
||||
},
|
||||
expectLabels: true,
|
||||
@@ -265,7 +269,6 @@ func TestSetDefaultJob(t *testing.T) {
|
||||
for name, test := range tests {
|
||||
t.Run(name, func(t *testing.T) {
|
||||
defer featuregatetesting.SetFeatureGateDuringTest(t, feature.DefaultFeatureGate, features.IndexedJob, test.indexedJobEnabled)()
|
||||
defer featuregatetesting.SetFeatureGateDuringTest(t, feature.DefaultFeatureGate, features.SuspendJob, test.suspendJobEnabled)()
|
||||
|
||||
original := test.original
|
||||
expected := test.expected
|
||||
|
Reference in New Issue
Block a user