Repository: aquasecurity/starboard
Pull request #1105 (2022-04-04 09:40:04)

fix: revert CronJobs to batch/v1beta1
Resolves: #1102

Signed-off-by: Daniel Pacak <pacak.daniel@gmail.com>

codecov[bot]: # [Codecov](https://codecov.io/gh/aquasecurity/starboard/pull/1105?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aquasecurity) Report
> Merging [#1105](https://codecov.io/gh/aquasecurity/starboard/pull/1105?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aquasecurity) (84da3bc) into [main](https://codecov.io/gh/aquasecurity/starboard/commit/1c26090ad7be0d141c2bc8367d8725f43ffbeaaa?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aquasecurity) (1c26090) will **decrease** coverage by `3.57%`.
> The diff coverage is `30.76%`.

```diff
@@            Coverage Diff             @@
##             main    #1105      +/-   ##
==========================================
- Coverage   45.24%   41.67%   -3.58%     
==========================================
  Files          54       53       -1     
  Lines        8144     7935     -209     
==========================================
- Hits         3685     3307     -378     
- Misses       4190     4429     +239     
+ Partials      269      199      -70     
```


| [Impacted Files](https://codecov.io/gh/aquasecurity/starboard/pull/1105?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aquasecurity) | Coverage Δ | |
|---|---|---|
| [pkg/configauditreport/controller.go](https://codecov.io/gh/aquasecurity/starboard/pull/1105/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aquasecurity#diff-cGtnL2NvbmZpZ2F1ZGl0cmVwb3J0L2NvbnRyb2xsZXIuZ28=) | `0.00% <0.00%> (ø)` | |
| [pkg/operator/controller/configauditreport.go](https://codecov.io/gh/aquasecurity/starboard/pull/1105/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aquasecurity#diff-cGtnL29wZXJhdG9yL2NvbnRyb2xsZXIvY29uZmlnYXVkaXRyZXBvcnQuZ28=) | `0.00% <0.00%> (-52.65%)` | :arrow_down: |
| [pkg/vulnerabilityreport/controller.go](https://codecov.io/gh/aquasecurity/starboard/pull/1105/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aquasecurity#diff-cGtnL3Z1bG5lcmFiaWxpdHlyZXBvcnQvY29udHJvbGxlci5nbw==) | `0.00% <0.00%> (ø)` | |
| [pkg/kube/object.go](https://codecov.io/gh/aquasecurity/starboard/pull/1105/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aquasecurity#diff-cGtnL2t1YmUvb2JqZWN0Lmdv) | `42.95% <33.33%> (ø)` | |
| [pkg/starboard/config.go](https://codecov.io/gh/aquasecurity/starboard/pull/1105/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aquasecurity#diff-cGtnL3N0YXJib2FyZC9jb25maWcuZ28=) | `72.51% <100.00%> (+0.13%)` | :arrow_up: |
| [pkg/plugin/factory.go](https://codecov.io/gh/aquasecurity/starboard/pull/1105/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aquasecurity#diff-cGtnL3BsdWdpbi9mYWN0b3J5Lmdv) | `0.00% <0.00%> (-53.71%)` | :arrow_down: |
| [pkg/operator/controller/plugins\_config.go](https://codecov.io/gh/aquasecurity/starboard/pull/1105/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aquasecurity#diff-cGtnL29wZXJhdG9yL2NvbnRyb2xsZXIvcGx1Z2luc19jb25maWcuZ28=) | `0.00% <0.00%> (-50.00%)` | :arrow_down: |
| [pkg/configauditreport/builder.go](https://codecov.io/gh/aquasecurity/starboard/pull/1105/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aquasecurity#diff-cGtnL2NvbmZpZ2F1ZGl0cmVwb3J0L2J1aWxkZXIuZ28=) | `67.39% <0.00%> (-11.42%)` | :arrow_down: |
| [pkg/operator/predicate/predicate.go](https://codecov.io/gh/aquasecurity/starboard/pull/1105/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aquasecurity#diff-cGtnL29wZXJhdG9yL3ByZWRpY2F0ZS9wcmVkaWNhdGUuZ28=) | `60.71% <0.00%> (-7.15%)` | :arrow_down: |
| ... and [3 more](https://codecov.io/gh/aquasecurity/starboard/pull/1105/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aquasecurity) | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/aquasecurity/starboard/pull/1105?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aquasecurity).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aquasecurity)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/aquasecurity/starboard/pull/1105?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aquasecurity). Last update [1c26090...84da3bc](https://codecov.io/gh/aquasecurity/starboard/pull/1105?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aquasecurity). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aquasecurity).


Patch:
diff --git a/pkg/configauditreport/controller.go b/pkg/configauditreport/controller.go
index 7c449a6..5fd392a 100644
--- a/pkg/configauditreport/controller.go
+++ b/pkg/configauditreport/controller.go
@@ -14,6 +14,7 @@ import (
 	"github.com/go-logr/logr"
 	appsv1 "k8s.io/api/apps/v1"
 	batchv1 "k8s.io/api/batch/v1"
+	batchv1beta1 "k8s.io/api/batch/v1beta1"
 	corev1 "k8s.io/api/core/v1"
 	networkingv1 "k8s.io/api/networking/v1"
 	policyv1beta1 "k8s.io/api/policy/v1beta1"
@@ -57,7 +58,7 @@ func (r *ResourceController) SetupWithManager(mgr ctrl.Manager) error {
 		{kind: kube.KindReplicationController, forObject: &corev1.ReplicationController{}, ownsObject: &v1alpha1.ConfigAuditReport{}},
 		{kind: kube.KindStatefulSet, forObject: &appsv1.StatefulSet{}, ownsObject: &v1alpha1.ConfigAuditReport{}},
 		{kind: kube.KindDaemonSet, forObject: &appsv1.DaemonSet{}, ownsObject: &v1alpha1.ConfigAuditReport{}},
-		{kind: kube.KindCronJob, forObject: &batchv1.CronJob{}, ownsObject: &v1alpha1.ConfigAuditReport{}},
+		{kind: kube.KindCronJob, forObject: &batchv1beta1.CronJob{}, ownsObject: &v1alpha1.ConfigAuditReport{}},
 		{kind: kube.KindJob, forObject: &batchv1.Job{}, ownsObject: &v1alpha1.ConfigAuditReport{}},
 		{kind: kube.KindService, forObject: &corev1.Service{}, ownsObject: &v1alpha1.ConfigAuditReport{}},
 		{kind: kube.KindConfigMap, forObject: &corev1.ConfigMap{}, ownsObject: &v1alpha1.ConfigAuditReport{}},
diff --git a/pkg/kube/object.go b/pkg/kube/object.go
index 2d4082d..5ec4e99 100644
--- a/pkg/kube/object.go
+++ b/pkg/kube/object.go
@@ -10,6 +10,7 @@ import (
 	"github.com/aquasecurity/starboard/pkg/starboard"
 	appsv1 "k8s.io/api/apps/v1"
 	batchv1 "k8s.io/api/batch/v1"
+	batchv1beta1 "k8s.io/api/batch/v1beta1"
 	corev1 "k8s.io/api/core/v1"
 	networkingv1 "k8s.io/api/networking/v1"
 	policyv1beta1 "k8s.io/api/policy/v1beta1"
@@ -227,7 +228,7 @@ func ObjectRefFromKindAndObjectKey(kind Kind, name client.ObjectKey) ObjectRef {
 // security report.
 func ComputeSpecHash(obj client.Object) (string, error) {
 	switch t := obj.(type) {
-	case *corev1.Pod, *appsv1.Deployment, *appsv1.ReplicaSet, *corev1.ReplicationController, *appsv1.StatefulSet, *appsv1.DaemonSet, *batchv1.CronJob, *batchv1.Job:
+	case *corev1.Pod, *appsv1.Deployment, *appsv1.ReplicaSet, *corev1.ReplicationController, *appsv1.StatefulSet, *appsv1.DaemonSet, *batchv1beta1.CronJob, *batchv1.Job:
 		spec, err := GetPodSpec(obj)
 		if err != nil {
 			return "", err
@@ -278,8 +279,8 @@ func GetPodSpec(obj client.Object) (corev1.PodSpec, error) {
 		return (obj.(*appsv1.StatefulSet)).Spec.Template.Spec, nil
 	case *appsv1.DaemonSet:
 		return (obj.(*appsv1.DaemonSet)).Spec.Template.Spec, nil
-	case *batchv1.CronJob:
-		return (obj.(*batchv1.CronJob)).Spec.JobTemplate.Spec.Template.Spec, nil
+	case *batchv1beta1.CronJob:
+		return (obj.(*batchv1beta1.CronJob)).Spec.JobTemplate.Spec.Template.Spec, nil
 	case *batchv1.Job:
 		return (obj.(*batchv1.Job)).Spec.Template.Spec, nil
 	default:
@@ -311,7 +312,7 @@ func (o *ObjectResolver) ObjectFromObjectRef(ctx context.Context, ref ObjectRef)
 	case KindDaemonSet:
 		obj = &appsv1.DaemonSet{}
 	case KindCronJob:
-		obj = &batchv1.CronJob{}
+		obj = &batchv1beta1.CronJob{}
 	case KindJob:
 		obj = &batchv1.Job{}
 	case KindService:
@@ -386,7 +387,7 @@ func (o *ObjectResolver) ReportOwner(ctx context.Context, obj client.Object) (cl
 		}
 		// Pod controlled by sth else (usually frameworks)
 		return obj, nil
-	case *appsv1.ReplicaSet, *corev1.ReplicationController, *appsv1.StatefulSet, *appsv1.DaemonSet, *batchv1.CronJob:
+	case *appsv1.ReplicaSet, *corev1.ReplicationController, *appsv1.StatefulSet, *appsv1.DaemonSet, *batchv1beta1.CronJob:
 		return obj, nil
 	default:
 		return obj, nil
@@ -475,7 +476,7 @@ func (o *ObjectResolver) ReplicaSetByPod(ctx context.Context, pod *corev1.Pod) (
 	return rsCopy, err
 }
 
-func (o *ObjectResolver) CronJobByJob(ctx context.Context, job *batchv1.Job) (*batchv1.CronJob, error) {
+func (o *ObjectResolver) CronJobByJob(ctx context.Context, job *batchv1.Job) (*batchv1beta1.CronJob, error) {
 	controller := metav1.GetControllerOf(job)
 	if controller == nil {
 		return nil, fmt.Errorf("did not find a controller for job %q", job.Name)
@@ -483,13 +484,13 @@ func (o *ObjectResolver) CronJobByJob(ctx context.Context, job *batchv1.Job) (*b
 	if controller.Kind != "CronJob" {
 		return nil, fmt.Errorf("pod %q is controlled by a %q, want CronJob", job.Name, controller.Kind)
 	}
-	cj := &batchv1.CronJob{}
+	cj := &batchv1beta1.CronJob{}
 	err := o.Client.Get(ctx, client.ObjectKey{Namespace: job.Namespace, Name: controller.Name}, cj)
 	if err != nil {
 		return nil, err
 	}
 	obj, err := o.ensureGVK(cj)
-	return obj.(*batchv1.CronJob), err
+	return obj.(*batchv1beta1.CronJob), err
 }
 
 func (o *ObjectResolver) JobByPod(ctx context.Context, pod *corev1.Pod) (*batchv1.Job, error) {
@@ -583,7 +584,7 @@ func (o *ObjectResolver) GetNodeName(ctx context.Context, obj client.Object) (st
 			return "", err
 		}
 		return pods[0].Spec.NodeName, nil
-	case *batchv1.CronJob:
+	case *batchv1beta1.CronJob:
 		return "", ErrUnSupportedKind
 	case *batchv1.Job:
 		pods, err := o.getActivePodsByLabelSelector(ctx, obj.GetNamespace(), obj.(*batchv1.Job).Spec.Selector.MatchLabels)
diff --git a/pkg/operator/controller/configauditreport.go b/pkg/operator/controller/configauditreport.go
index 8cc3364..8178f41 100644
--- a/pkg/operator/controller/configauditreport.go
+++ b/pkg/operator/controller/configauditreport.go
@@ -14,6 +14,7 @@ import (
 	"github.com/go-logr/logr"
 	appsv1 "k8s.io/api/apps/v1"
 	batchv1 "k8s.io/api/batch/v1"
+	batchv1beta1 "k8s.io/api/batch/v1beta1"
 	corev1 "k8s.io/api/core/v1"
 	rbacv1 "k8s.io/api/rbac/v1"
 	apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
@@ -55,7 +56,7 @@ func (r *ConfigAuditReportReconciler) SetupWithManager(mgr ctrl.Manager) error {
 		{kind: kube.KindReplicationController, forObject: &corev1.ReplicationController{}, ownsObject: &v1alpha1.ConfigAuditReport{}},
 		{kind: kube.KindStatefulSet, forObject: &appsv1.StatefulSet{}, ownsObject: &v1alpha1.ConfigAuditReport{}},
 		{kind: kube.KindDaemonSet, forObject: &appsv1.DaemonSet{}, ownsObject: &v1alpha1.ConfigAuditReport{}},
-		{kind: kube.KindCronJob, forObject: &batchv1.CronJob{}, ownsObject: &v1alpha1.ConfigAuditReport{}},
+		{kind: kube.KindCronJob, forObject: &batchv1beta1.CronJob{}, ownsObject: &v1alpha1.ConfigAuditReport{}},
 		{kind: kube.KindJob, forObject: &batchv1.Job{}, ownsObject: &v1alpha1.ConfigAuditReport{}},
 		{kind: kube.KindService, forObject: &corev1.Service{}, ownsObject: &v1alpha1.ConfigAuditReport{}},
 		{kind: kube.KindConfigMap, forObject: &corev1.ConfigMap{}, ownsObject: &v1alpha1.ConfigAuditReport{}},
diff --git a/pkg/starboard/config.go b/pkg/starboard/config.go
index fab5e53..a33aec4 100644
--- a/pkg/starboard/config.go
+++ b/pkg/starboard/config.go
@@ -11,6 +11,7 @@ import (
 	"github.com/google/go-containerregistry/pkg/name"
 	appsv1 "k8s.io/api/apps/v1"
 	batchv1 "k8s.io/api/batch/v1"
+	batchv1beta1 "k8s.io/api/batch/v1beta1"
 	coordinationv1 "k8s.io/api/coordination/v1"
 	corev1 "k8s.io/api/core/v1"
 	networkingv1 "k8s.io/api/networking/v1"
@@ -29,6 +30,7 @@ func NewScheme() *runtime.Scheme {
 	_ = corev1.AddToScheme(scheme)
 	_ = appsv1.AddToScheme(scheme)
 	_ = batchv1.AddToScheme(scheme)
+	_ = batchv1beta1.AddToScheme(scheme)
 	_ = rbacv1.AddToScheme(scheme)
 	_ = networkingv1.AddToScheme(scheme)
 	_ = policyv1beta1.AddToScheme(scheme)
diff --git a/pkg/vulnerabilityreport/controller.go b/pkg/vulnerabilityreport/controller.go
index 0d164ac..a725557 100644
--- a/pkg/vulnerabilityreport/controller.go
+++ b/pkg/vulnerabilityreport/controller.go
@@ -16,6 +16,7 @@ import (
 	"github.com/go-logr/logr"
 	appsv1 "k8s.io/api/apps/v1"
 	batchv1 "k8s.io/api/batch/v1"
+	batchv1beta1 "k8s.io/api/batch/v1beta1"
 	corev1 "k8s.io/api/core/v1"
 	k8sapierror "k8s.io/apimachinery/pkg/api/errors"
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -60,7 +61,7 @@ func (r *WorkloadController) SetupWithManager(mgr ctrl.Manager) error {
 		{kind: kube.KindReplicationController, forObject: &corev1.ReplicationController{}, ownsObject: &v1alpha1.VulnerabilityReport{}},
 		{kind: kube.KindStatefulSet, forObject: &appsv1.StatefulSet{}, ownsObject: &v1alpha1.VulnerabilityReport{}},
 		{kind: kube.KindDaemonSet, forObject: &appsv1.DaemonSet{}, ownsObject: &v1alpha1.VulnerabilityReport{}},
-		{kind: kube.KindCronJob, forObject: &batchv1.CronJob{}, ownsObject: &v1alpha1.VulnerabilityReport{}},
+		{kind: kube.KindCronJob, forObject: &batchv1beta1.CronJob{}, ownsObject: &v1alpha1.VulnerabilityReport{}},
 		{kind: kube.KindJob, forObject: &batchv1.Job{}, ownsObject: &v1alpha1.VulnerabilityReport{}},
 	}
 


Test patch:
diff --git a/itest/starboard-operator/behavior/behavior.go b/itest/starboard-operator/behavior/behavior.go
index 5c0d8e7..6f8649b 100644
--- a/itest/starboard-operator/behavior/behavior.go
+++ b/itest/starboard-operator/behavior/behavior.go
@@ -11,6 +11,7 @@ import (
 	"github.com/aquasecurity/starboard/pkg/plugin/conftest"
 	appsv1 "k8s.io/api/apps/v1"
 	batchv1 "k8s.io/api/batch/v1"
+	batchv1beta1 "k8s.io/api/batch/v1beta1"
 	corev1 "k8s.io/api/core/v1"
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 	"k8s.io/apimachinery/pkg/util/intstr"
@@ -148,18 +149,18 @@ func VulnerabilityScannerBehavior(inputs *Inputs) func() {
 		Context("When CronJob is created", func() {
 
 			var ctx context.Context
-			var cronJob *batchv1.CronJob
+			var cronJob *batchv1beta1.CronJob
 
 			BeforeEach(func() {
 				ctx = context.Background()
-				cronJob = &batchv1.CronJob{
+				cronJob = &batchv1beta1.CronJob{
 					ObjectMeta: metav1.ObjectMeta{
 						Namespace: inputs.PrimaryNamespace,
 						Name:      "hello-" + rand.String(5),
 					},
-					Spec: batchv1.CronJobSpec{
+					Spec: batchv1beta1.CronJobSpec{
 						Schedule: "*/1 * * * *",
-						JobTemplate: batchv1.JobTemplateSpec{
+						JobTemplate: batchv1beta1.JobTemplateSpec{
 							Spec: batchv1.JobSpec{
 								Template: corev1.PodTemplateSpec{
 									Spec: corev1.PodSpec{
@@ -324,18 +325,18 @@ func ConfigurationCheckerBehavior(inputs *Inputs) func() {
 		Context("When CronJob is created", func() {
 
 			var ctx context.Context
-			var cronJob *batchv1.CronJob
+			var cronJob *batchv1beta1.CronJob
 
 			BeforeEach(func() {
 				ctx = context.Background()
-				cronJob = &batchv1.CronJob{
+				cronJob = &batchv1beta1.CronJob{
 					ObjectMeta: metav1.ObjectMeta{
 						Namespace: inputs.PrimaryNamespace,
 						Name:      "hello-" + rand.String(5),
 					},
-					Spec: batchv1.CronJobSpec{
+					Spec: batchv1beta1.CronJobSpec{
 						Schedule: "*/1 * * * *",
-						JobTemplate: batchv1.JobTemplateSpec{
+						JobTemplate: batchv1beta1.JobTemplateSpec{
 							Spec: batchv1.JobSpec{
 								Template: corev1.PodTemplateSpec{
 									Spec: corev1.PodSpec{
diff --git a/itest/starboard/starboard_cli_test.go b/itest/starboard/starboard_cli_test.go
index fe6425a..a016b14 100644
--- a/itest/starboard/starboard_cli_test.go
+++ b/itest/starboard/starboard_cli_test.go
@@ -18,6 +18,7 @@ import (
 	"github.com/aquasecurity/starboard/pkg/vulnerabilityreport"
 	appsv1 "k8s.io/api/apps/v1"
 	batchv1 "k8s.io/api/batch/v1"
+	batchv1beta1 "k8s.io/api/batch/v1beta1"
 	corev1 "k8s.io/api/core/v1"
 	apiextensionsv1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1"
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -1163,14 +1164,14 @@ var _ = Describe("Starboard CLI", func() {
 
 			BeforeEach(func() {
 				ctx = context.TODO()
-				object = &batchv1.CronJob{
+				object = &batchv1beta1.CronJob{
 					ObjectMeta: metav1.ObjectMeta{
 						Name:      "hello" + "-" + rand.String(5),
 						Namespace: testNamespace.Name,
 					},
-					Spec: batchv1.CronJobSpec{
+					Spec: batchv1beta1.CronJobSpec{
 						Schedule: "*/1 * * * *",
-						JobTemplate: batchv1.JobTemplateSpec{
+						JobTemplate: batchv1beta1.JobTemplateSpec{
 							Spec: batchv1.JobSpec{
 								Template: corev1.PodTemplateSpec{
 									Spec: corev1.PodSpec{
diff --git a/pkg/kube/object_test.go b/pkg/kube/object_test.go
index b0df150..6e8d91c 100644
--- a/pkg/kube/object_test.go
+++ b/pkg/kube/object_test.go
@@ -11,6 +11,7 @@ import (
 	"github.com/stretchr/testify/require"
 	appsv1 "k8s.io/api/apps/v1"
 	batchv1 "k8s.io/api/batch/v1"
+	batchv1beta1 "k8s.io/api/batch/v1beta1"
 	corev1 "k8s.io/api/core/v1"
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 	"k8s.io/utils/pointer"
@@ -465,9 +466,9 @@ func TestGetPodSpec(t *testing.T) {
 		},
 		{
 			name: "Should return PodSpec for CronJob",
-			object: &batchv1.CronJob{
-				Spec: batchv1.CronJobSpec{
-					JobTemplate: batchv1.JobTemplateSpec{
+			object: &batchv1beta1.CronJob{
+				Spec: batchv1beta1.CronJobSpec{
+					JobTemplate: batchv1beta1.JobTemplateSpec{
 						Spec: batchv1.JobSpec{
 							Template: corev1.PodTemplateSpec{
 								Spec: corev1.PodSpec{