Use batch/v1 instead of batch/v1beta1 (#5562)
This commit is contained in:
@@ -49,7 +49,7 @@ var supportedResources = map[string]schema.GroupVersionResource{
|
||||
persistentvolumeclaimsKey: {Group: "", Version: "v1", Resource: "persistentvolumeclaims"},
|
||||
ingressKey: {Group: "networking.k8s.io", Version: "v1", Resource: "ingresses"},
|
||||
jobsKey: {Group: "batch", Version: "v1", Resource: "jobs"},
|
||||
cronJobsKey: {Group: "batch", Version: "v1beta1", Resource: "cronjobs"},
|
||||
cronJobsKey: {Group: "batch", Version: "v1", Resource: "cronjobs"},
|
||||
s2iBuilders: {Group: "devops.kubesphere.io", Version: "v1alpha1", Resource: "s2ibuilders"},
|
||||
}
|
||||
|
||||
|
||||
@@ -19,13 +19,12 @@ package cronjob
|
||||
import (
|
||||
"sort"
|
||||
|
||||
"k8s.io/api/batch/v1beta1"
|
||||
v1 "k8s.io/api/batch/v1"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/client-go/informers"
|
||||
|
||||
"kubesphere.io/kubesphere/pkg/models/resources/v1alpha2"
|
||||
"kubesphere.io/kubesphere/pkg/server/params"
|
||||
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
)
|
||||
|
||||
type cronJobSearcher struct {
|
||||
@@ -37,17 +36,17 @@ func NewCronJobSearcher(informer informers.SharedInformerFactory) v1alpha2.Inter
|
||||
}
|
||||
|
||||
func (c *cronJobSearcher) Get(namespace, name string) (interface{}, error) {
|
||||
return c.informer.Batch().V1beta1().CronJobs().Lister().CronJobs(namespace).Get(name)
|
||||
return c.informer.Batch().V1().CronJobs().Lister().CronJobs(namespace).Get(name)
|
||||
}
|
||||
|
||||
func cronJobStatus(item *v1beta1.CronJob) string {
|
||||
func cronJobStatus(item *v1.CronJob) string {
|
||||
if item.Spec.Suspend != nil && *item.Spec.Suspend {
|
||||
return v1alpha2.StatusPaused
|
||||
}
|
||||
return v1alpha2.StatusRunning
|
||||
}
|
||||
|
||||
func (*cronJobSearcher) match(match map[string]string, item *v1beta1.CronJob) bool {
|
||||
func (*cronJobSearcher) match(match map[string]string, item *v1.CronJob) bool {
|
||||
for k, v := range match {
|
||||
switch k {
|
||||
case v1alpha2.Status:
|
||||
@@ -63,7 +62,7 @@ func (*cronJobSearcher) match(match map[string]string, item *v1beta1.CronJob) bo
|
||||
return true
|
||||
}
|
||||
|
||||
func (*cronJobSearcher) fuzzy(fuzzy map[string]string, item *v1beta1.CronJob) bool {
|
||||
func (*cronJobSearcher) fuzzy(fuzzy map[string]string, item *v1.CronJob) bool {
|
||||
|
||||
for k, v := range fuzzy {
|
||||
if !v1alpha2.ObjectMetaFuzzyMath(k, v, item.ObjectMeta) {
|
||||
@@ -74,7 +73,7 @@ func (*cronJobSearcher) fuzzy(fuzzy map[string]string, item *v1beta1.CronJob) bo
|
||||
return true
|
||||
}
|
||||
|
||||
func (*cronJobSearcher) compare(left, right *v1beta1.CronJob, orderBy string) bool {
|
||||
func (*cronJobSearcher) compare(left, right *v1.CronJob, orderBy string) bool {
|
||||
switch orderBy {
|
||||
case v1alpha2.LastScheduleTime:
|
||||
if left.Status.LastScheduleTime == nil {
|
||||
@@ -90,13 +89,13 @@ func (*cronJobSearcher) compare(left, right *v1beta1.CronJob, orderBy string) bo
|
||||
}
|
||||
|
||||
func (c *cronJobSearcher) Search(namespace string, conditions *params.Conditions, orderBy string, reverse bool) ([]interface{}, error) {
|
||||
cronJobs, err := c.informer.Batch().V1beta1().CronJobs().Lister().CronJobs(namespace).List(labels.Everything())
|
||||
cronJobs, err := c.informer.Batch().V1().CronJobs().Lister().CronJobs(namespace).List(labels.Everything())
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
result := make([]*v1beta1.CronJob, 0)
|
||||
result := make([]*v1.CronJob, 0)
|
||||
|
||||
if len(conditions.Match) == 0 && len(conditions.Fuzzy) == 0 {
|
||||
result = cronJobs
|
||||
|
||||
Reference in New Issue
Block a user