@@ -27,7 +27,6 @@ import (
2727 "github.com/pkg/errors"
2828 appsv1 "k8s.io/api/apps/v1"
2929 batchv1 "k8s.io/api/batch/v1"
30- batchv1beta1 "k8s.io/api/batch/v1beta1"
3130 corev1 "k8s.io/api/core/v1"
3231 rbacv1 "k8s.io/api/rbac/v1"
3332 apierrors "k8s.io/apimachinery/pkg/api/errors"
@@ -118,7 +117,7 @@ var regexRepoIndex = regexp.MustCompile(`\d+`)
118117// RepoResources is used to store various resources for pgBackRest repositories and
119118// repository hosts
120119type RepoResources struct {
121- cronjobs []* batchv1beta1 .CronJob
120+ cronjobs []* batchv1 .CronJob
122121 manualBackupJobs []* batchv1.Job
123122 replicaCreateBackupJobs []* batchv1.Job
124123 hosts []* appsv1.StatefulSet
@@ -202,8 +201,8 @@ func (r *Reconciler) getPGBackRestResources(ctx context.Context,
202201 Version : appsv1 .SchemeGroupVersion .Version ,
203202 Kind : "StatefulSetList" ,
204203 }, {
205- Group : batchv1beta1 .SchemeGroupVersion .Group ,
206- Version : batchv1beta1 .SchemeGroupVersion .Version ,
204+ Group : batchv1 .SchemeGroupVersion .Group ,
205+ Version : batchv1 .SchemeGroupVersion .Version ,
207206 Kind : "CronJobList" ,
208207 }}
209208
@@ -400,7 +399,7 @@ func unstructuredToRepoResources(kind string, repoResources *RepoResources,
400399 repoResources .hosts = append (repoResources .hosts , & stsList .Items [i ])
401400 }
402401 case "CronJobList" :
403- var cronList batchv1beta1 .CronJobList
402+ var cronList batchv1 .CronJobList
404403 if err := runtime .DefaultUnstructuredConverter .
405404 FromUnstructured (uList .UnstructuredContent (), & cronList ); err != nil {
406405 return errors .WithStack (err )
@@ -2739,7 +2738,7 @@ func getRepoVolumeStatus(repoStatus []v1beta1.RepoStatus, repoVolumes []*corev1.
27392738// schedules configured in the cluster definition
27402739func (r * Reconciler ) reconcileScheduledBackups (
27412740 ctx context.Context , cluster * v1beta1.PostgresCluster , sa * corev1.ServiceAccount ,
2742- cronjobs []* batchv1beta1 .CronJob ,
2741+ cronjobs []* batchv1 .CronJob ,
27432742) bool {
27442743 log := logging .FromContext (ctx ).WithValues ("reconcileResource" , "repoCronJob" )
27452744 // requeue if there is an error during creation
@@ -2783,7 +2782,7 @@ func (r *Reconciler) reconcileScheduledBackups(
27832782func (r * Reconciler ) reconcilePGBackRestCronJob (
27842783 ctx context.Context , cluster * v1beta1.PostgresCluster , repo v1beta1.PGBackRestRepo ,
27852784 backupType string , schedule * string , serviceAccount * corev1.ServiceAccount ,
2786- cronjobs []* batchv1beta1 .CronJob ,
2785+ cronjobs []* batchv1 .CronJob ,
27872786) error {
27882787
27892788 log := logging .FromContext (ctx ).WithValues ("reconcileResource" , "repoCronJob" )
@@ -2871,12 +2870,12 @@ func (r *Reconciler) reconcilePGBackRestCronJob(
28712870 suspend := (cluster .Spec .Shutdown != nil && * cluster .Spec .Shutdown ) ||
28722871 (cluster .Spec .Standby != nil && cluster .Spec .Standby .Enabled )
28732872
2874- pgBackRestCronJob := & batchv1beta1 .CronJob {
2873+ pgBackRestCronJob := & batchv1 .CronJob {
28752874 ObjectMeta : objectmeta ,
2876- Spec : batchv1beta1 .CronJobSpec {
2875+ Spec : batchv1 .CronJobSpec {
28772876 Schedule : * schedule ,
28782877 Suspend : & suspend ,
2879- JobTemplate : batchv1beta1 .JobTemplateSpec {
2878+ JobTemplate : batchv1 .JobTemplateSpec {
28802879 ObjectMeta : metav1.ObjectMeta {
28812880 Annotations : annotations ,
28822881 Labels : labels ,
@@ -2894,7 +2893,7 @@ func (r *Reconciler) reconcilePGBackRestCronJob(
28942893 cluster .Spec .ImagePullSecrets
28952894
28962895 // set metadata
2897- pgBackRestCronJob .SetGroupVersionKind (batchv1beta1 .SchemeGroupVersion .WithKind ("CronJob" ))
2896+ pgBackRestCronJob .SetGroupVersionKind (batchv1 .SchemeGroupVersion .WithKind ("CronJob" ))
28982897 err = errors .WithStack (r .setControllerReference (cluster , pgBackRestCronJob ))
28992898
29002899 if err == nil {
0 commit comments