@@ -22,7 +22,7 @@ import (
22
22
23
23
"github.com/pkg/errors"
24
24
"github.com/robfig/cron/v3"
25
- batchv1beta1 "k8s.io/api/batch/v1beta1 "
25
+ batchv1 "k8s.io/api/batch/v1 "
26
26
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
27
27
"k8s.io/apimachinery/pkg/runtime"
28
28
"k8s.io/apimachinery/pkg/watch"
@@ -48,7 +48,7 @@ func cronJobMetricFamilies(allowAnnotationsList, allowLabelsList []string) []gen
48
48
descCronJobAnnotationsHelp ,
49
49
metric .Gauge ,
50
50
"" ,
51
- wrapCronJobFunc (func (j * batchv1beta1 .CronJob ) * metric.Family {
51
+ wrapCronJobFunc (func (j * batchv1 .CronJob ) * metric.Family {
52
52
annotationKeys , annotationValues := createPrometheusLabelKeysValues ("annotation" , j .Annotations , allowAnnotationsList )
53
53
return & metric.Family {
54
54
Metrics : []* metric.Metric {
@@ -66,7 +66,7 @@ func cronJobMetricFamilies(allowAnnotationsList, allowLabelsList []string) []gen
66
66
descCronJobLabelsHelp ,
67
67
metric .Gauge ,
68
68
"" ,
69
- wrapCronJobFunc (func (j * batchv1beta1 .CronJob ) * metric.Family {
69
+ wrapCronJobFunc (func (j * batchv1 .CronJob ) * metric.Family {
70
70
labelKeys , labelValues := createPrometheusLabelKeysValues ("label" , j .Labels , allowLabelsList )
71
71
return & metric.Family {
72
72
Metrics : []* metric.Metric {
@@ -84,7 +84,7 @@ func cronJobMetricFamilies(allowAnnotationsList, allowLabelsList []string) []gen
84
84
"Info about cronjob." ,
85
85
metric .Gauge ,
86
86
"" ,
87
- wrapCronJobFunc (func (j * batchv1beta1 .CronJob ) * metric.Family {
87
+ wrapCronJobFunc (func (j * batchv1 .CronJob ) * metric.Family {
88
88
return & metric.Family {
89
89
Metrics : []* metric.Metric {
90
90
{
@@ -101,7 +101,7 @@ func cronJobMetricFamilies(allowAnnotationsList, allowLabelsList []string) []gen
101
101
"Unix creation timestamp" ,
102
102
metric .Gauge ,
103
103
"" ,
104
- wrapCronJobFunc (func (j * batchv1beta1 .CronJob ) * metric.Family {
104
+ wrapCronJobFunc (func (j * batchv1 .CronJob ) * metric.Family {
105
105
ms := []* metric.Metric {}
106
106
if ! j .CreationTimestamp .IsZero () {
107
107
ms = append (ms , & metric.Metric {
@@ -121,7 +121,7 @@ func cronJobMetricFamilies(allowAnnotationsList, allowLabelsList []string) []gen
121
121
"Active holds pointers to currently running jobs." ,
122
122
metric .Gauge ,
123
123
"" ,
124
- wrapCronJobFunc (func (j * batchv1beta1 .CronJob ) * metric.Family {
124
+ wrapCronJobFunc (func (j * batchv1 .CronJob ) * metric.Family {
125
125
return & metric.Family {
126
126
Metrics : []* metric.Metric {
127
127
{
@@ -138,7 +138,7 @@ func cronJobMetricFamilies(allowAnnotationsList, allowLabelsList []string) []gen
138
138
"LastScheduleTime keeps information of when was the last time the job was successfully scheduled." ,
139
139
metric .Gauge ,
140
140
"" ,
141
- wrapCronJobFunc (func (j * batchv1beta1 .CronJob ) * metric.Family {
141
+ wrapCronJobFunc (func (j * batchv1 .CronJob ) * metric.Family {
142
142
ms := []* metric.Metric {}
143
143
144
144
if j .Status .LastScheduleTime != nil {
@@ -159,7 +159,7 @@ func cronJobMetricFamilies(allowAnnotationsList, allowLabelsList []string) []gen
159
159
"Suspend flag tells the controller to suspend subsequent executions." ,
160
160
metric .Gauge ,
161
161
"" ,
162
- wrapCronJobFunc (func (j * batchv1beta1 .CronJob ) * metric.Family {
162
+ wrapCronJobFunc (func (j * batchv1 .CronJob ) * metric.Family {
163
163
ms := []* metric.Metric {}
164
164
165
165
if j .Spec .Suspend != nil {
@@ -180,7 +180,7 @@ func cronJobMetricFamilies(allowAnnotationsList, allowLabelsList []string) []gen
180
180
"Deadline in seconds for starting the job if it misses scheduled time for any reason." ,
181
181
metric .Gauge ,
182
182
"" ,
183
- wrapCronJobFunc (func (j * batchv1beta1 .CronJob ) * metric.Family {
183
+ wrapCronJobFunc (func (j * batchv1 .CronJob ) * metric.Family {
184
184
ms := []* metric.Metric {}
185
185
186
186
if j .Spec .StartingDeadlineSeconds != nil {
@@ -202,7 +202,7 @@ func cronJobMetricFamilies(allowAnnotationsList, allowLabelsList []string) []gen
202
202
"Next time the cronjob should be scheduled. The time after lastScheduleTime, or after the cron job's creation time if it's never been scheduled. Use this to determine if the job is delayed." ,
203
203
metric .Gauge ,
204
204
"" ,
205
- wrapCronJobFunc (func (j * batchv1beta1 .CronJob ) * metric.Family {
205
+ wrapCronJobFunc (func (j * batchv1 .CronJob ) * metric.Family {
206
206
ms := []* metric.Metric {}
207
207
208
208
// If the cron job is suspended, don't track the next scheduled time
@@ -227,7 +227,7 @@ func cronJobMetricFamilies(allowAnnotationsList, allowLabelsList []string) []gen
227
227
"Resource version representing a specific version of the cronjob." ,
228
228
metric .Gauge ,
229
229
"" ,
230
- wrapCronJobFunc (func (j * batchv1beta1 .CronJob ) * metric.Family {
230
+ wrapCronJobFunc (func (j * batchv1 .CronJob ) * metric.Family {
231
231
return & metric.Family {
232
232
Metrics : resourceVersionMetric (j .ObjectMeta .ResourceVersion ),
233
233
}
@@ -238,7 +238,7 @@ func cronJobMetricFamilies(allowAnnotationsList, allowLabelsList []string) []gen
238
238
"Successful job history limit tells the controller how many completed jobs should be preserved." ,
239
239
metric .Gauge ,
240
240
"" ,
241
- wrapCronJobFunc (func (j * batchv1beta1 .CronJob ) * metric.Family {
241
+ wrapCronJobFunc (func (j * batchv1 .CronJob ) * metric.Family {
242
242
ms := []* metric.Metric {}
243
243
244
244
if j .Spec .SuccessfulJobsHistoryLimit != nil {
@@ -259,7 +259,7 @@ func cronJobMetricFamilies(allowAnnotationsList, allowLabelsList []string) []gen
259
259
"Failed job history limit tells the controller how many failed jobs should be preserved." ,
260
260
metric .Gauge ,
261
261
"" ,
262
- wrapCronJobFunc (func (j * batchv1beta1 .CronJob ) * metric.Family {
262
+ wrapCronJobFunc (func (j * batchv1 .CronJob ) * metric.Family {
263
263
ms := []* metric.Metric {}
264
264
265
265
if j .Spec .FailedJobsHistoryLimit != nil {
@@ -278,9 +278,9 @@ func cronJobMetricFamilies(allowAnnotationsList, allowLabelsList []string) []gen
278
278
}
279
279
}
280
280
281
- func wrapCronJobFunc (f func (* batchv1beta1 .CronJob ) * metric.Family ) func (interface {}) * metric.Family {
281
+ func wrapCronJobFunc (f func (* batchv1 .CronJob ) * metric.Family ) func (interface {}) * metric.Family {
282
282
return func (obj interface {}) * metric.Family {
283
- cronJob := obj .(* batchv1beta1 .CronJob )
283
+ cronJob := obj .(* batchv1 .CronJob )
284
284
285
285
metricFamily := f (cronJob )
286
286
@@ -297,11 +297,11 @@ func createCronJobListWatch(kubeClient clientset.Interface, ns string, fieldSele
297
297
return & cache.ListWatch {
298
298
ListFunc : func (opts metav1.ListOptions ) (runtime.Object , error ) {
299
299
opts .FieldSelector = fieldSelector
300
- return kubeClient .BatchV1beta1 ().CronJobs (ns ).List (context .TODO (), opts )
300
+ return kubeClient .BatchV1 ().CronJobs (ns ).List (context .TODO (), opts )
301
301
},
302
302
WatchFunc : func (opts metav1.ListOptions ) (watch.Interface , error ) {
303
303
opts .FieldSelector = fieldSelector
304
- return kubeClient .BatchV1beta1 ().CronJobs (ns ).Watch (context .TODO (), opts )
304
+ return kubeClient .BatchV1 ().CronJobs (ns ).Watch (context .TODO (), opts )
305
305
},
306
306
}
307
307
}
0 commit comments