mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-04 23:17:50 +00:00
Revert "Enable batch/v1beta1.CronJobs by default"
This commit is contained in:
@@ -24,7 +24,7 @@ import (
|
||||
"time"
|
||||
|
||||
batchv1 "k8s.io/api/batch/v1"
|
||||
batchV1beta1 "k8s.io/api/batch/v1beta1"
|
||||
batchv2alpha1 "k8s.io/api/batch/v2alpha1"
|
||||
"k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
@@ -96,19 +96,19 @@ func startTimeStringToTime(startTime string) time.Time {
|
||||
}
|
||||
|
||||
// returns a cronJob with some fields filled in.
|
||||
func cronJob() batchV1beta1.CronJob {
|
||||
return batchV1beta1.CronJob{
|
||||
func cronJob() batchv2alpha1.CronJob {
|
||||
return batchv2alpha1.CronJob{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "mycronjob",
|
||||
Namespace: "snazzycats",
|
||||
UID: types.UID("1a2b3c"),
|
||||
SelfLink: "/apis/batch/v1beta1/namespaces/snazzycats/cronjobs/mycronjob",
|
||||
SelfLink: "/apis/batch/v2alpha1/namespaces/snazzycats/cronjobs/mycronjob",
|
||||
CreationTimestamp: metav1.Time{Time: justBeforeTheHour()},
|
||||
},
|
||||
Spec: batchV1beta1.CronJobSpec{
|
||||
Spec: batchv2alpha1.CronJobSpec{
|
||||
Schedule: "* * * * ?",
|
||||
ConcurrencyPolicy: batchV1beta1.AllowConcurrent,
|
||||
JobTemplate: batchV1beta1.JobTemplateSpec{
|
||||
ConcurrencyPolicy: batchv2alpha1.AllowConcurrent,
|
||||
JobTemplate: batchv2alpha1.JobTemplateSpec{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Labels: map[string]string{"a": "b"},
|
||||
Annotations: map[string]string{"x": "y"},
|
||||
@@ -152,15 +152,15 @@ func newJob(UID string) batchv1.Job {
|
||||
}
|
||||
|
||||
var (
|
||||
shortDead int64 = 10
|
||||
mediumDead int64 = 2 * 60 * 60
|
||||
longDead int64 = 1000000
|
||||
noDead int64 = -12345
|
||||
A batchV1beta1.ConcurrencyPolicy = batchV1beta1.AllowConcurrent
|
||||
f batchV1beta1.ConcurrencyPolicy = batchV1beta1.ForbidConcurrent
|
||||
R batchV1beta1.ConcurrencyPolicy = batchV1beta1.ReplaceConcurrent
|
||||
T bool = true
|
||||
F bool = false
|
||||
shortDead int64 = 10
|
||||
mediumDead int64 = 2 * 60 * 60
|
||||
longDead int64 = 1000000
|
||||
noDead int64 = -12345
|
||||
A batchv2alpha1.ConcurrencyPolicy = batchv2alpha1.AllowConcurrent
|
||||
f batchv2alpha1.ConcurrencyPolicy = batchv2alpha1.ForbidConcurrent
|
||||
R batchv2alpha1.ConcurrencyPolicy = batchv2alpha1.ReplaceConcurrent
|
||||
T bool = true
|
||||
F bool = false
|
||||
)
|
||||
|
||||
func TestSyncOne_RunOrNot(t *testing.T) {
|
||||
@@ -179,7 +179,7 @@ func TestSyncOne_RunOrNot(t *testing.T) {
|
||||
|
||||
testCases := map[string]struct {
|
||||
// sj spec
|
||||
concurrencyPolicy batchV1beta1.ConcurrencyPolicy
|
||||
concurrencyPolicy batchv2alpha1.ConcurrencyPolicy
|
||||
suspend bool
|
||||
schedule string
|
||||
deadline int64
|
||||
@@ -298,7 +298,7 @@ func TestSyncOne_RunOrNot(t *testing.T) {
|
||||
if controllerRef == nil {
|
||||
t.Errorf("%s: expected job to have ControllerRef: %#v", name, job)
|
||||
} else {
|
||||
if got, want := controllerRef.APIVersion, "batch/v1beta1"; got != want {
|
||||
if got, want := controllerRef.APIVersion, "batch/v2alpha1"; got != want {
|
||||
t.Errorf("%s: controllerRef.APIVersion = %q, want %q", name, got, want)
|
||||
}
|
||||
if got, want := controllerRef.Kind, "CronJob"; got != want {
|
||||
@@ -596,7 +596,7 @@ func TestSyncOne_Status(t *testing.T) {
|
||||
|
||||
testCases := map[string]struct {
|
||||
// sj spec
|
||||
concurrencyPolicy batchV1beta1.ConcurrencyPolicy
|
||||
concurrencyPolicy batchv2alpha1.ConcurrencyPolicy
|
||||
suspend bool
|
||||
schedule string
|
||||
deadline int64
|
||||
|
||||
Reference in New Issue
Block a user