chore: update to batch/v1 instead of the deprecated batch/v1beta1

This commit is contained in:
2022-09-23 18:38:02 +02:00
parent 54722aafd9
commit 715939d794
2 changed files with 68 additions and 62 deletions
+11 -10
View File
@@ -3,19 +3,20 @@ package main
import (
"context"
"fmt"
"github.com/multiplay/go-slack/chat"
"github.com/multiplay/go-slack/webhook"
"github.com/robfig/cron"
"gopkg.in/alecthomas/kingpin.v2"
"io"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/kubernetes/typed/batch/v1beta1"
"k8s.io/client-go/rest"
"os"
"os/signal"
"syscall"
"time"
"github.com/multiplay/go-slack/chat"
"github.com/multiplay/go-slack/webhook"
"github.com/robfig/cron"
"gopkg.in/alecthomas/kingpin.v2"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
batchv1 "k8s.io/client-go/kubernetes/typed/batch/v1"
"k8s.io/client-go/rest"
)
var checkFunc = doCheck
@@ -56,7 +57,7 @@ func doCheck(client Client, slackUrl string, ic chan os.Signal, sleepTime time.D
_, _ = fmt.Fprintf(out, "Got SIGTERM signal, exiting\n")
return nil
default:
cronJobs, err := client.BatchV1beta1().CronJobs("").List(context.Background(), v1.ListOptions{})
cronJobs, err := client.BatchV1().CronJobs("").List(context.Background(), v1.ListOptions{})
if err != nil {
return fmt.Errorf("error getting cronjobs: %w", err)
}
@@ -92,7 +93,7 @@ func doCheck(client Client, slackUrl string, ic chan os.Signal, sleepTime time.D
}
type Client interface {
BatchV1beta1() v1beta1.BatchV1beta1Interface
BatchV1() batchv1.BatchV1Interface
}
type ClientProvider interface {