From 8cc8298f487a2eb929f09a898af5572e4de7cbf0 Mon Sep 17 00:00:00 2001 From: Aakcht Date: Wed, 1 Jun 2022 21:39:00 +0300 Subject: [PATCH] Fix: use V1 api for CRDs for volcano scheduler (#1540) --- charts/spark-operator-chart/Chart.yaml | 4 ++-- pkg/batchscheduler/volcano/volcano_scheduler.go | 11 +++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/charts/spark-operator-chart/Chart.yaml b/charts/spark-operator-chart/Chart.yaml index 789ef017a..fa39c88ea 100644 --- a/charts/spark-operator-chart/Chart.yaml +++ b/charts/spark-operator-chart/Chart.yaml @@ -1,8 +1,8 @@ apiVersion: v2 name: spark-operator description: A Helm chart for Spark on Kubernetes operator -version: 1.1.23 -appVersion: v1beta2-1.3.6-3.1.1 +version: 1.1.24 +appVersion: v1beta2-1.3.7-3.1.1 keywords: - spark home: https://github.com/GoogleCloudPlatform/spark-on-k8s-operator diff --git a/pkg/batchscheduler/volcano/volcano_scheduler.go b/pkg/batchscheduler/volcano/volcano_scheduler.go index a204a49f0..1e1495335 100644 --- a/pkg/batchscheduler/volcano/volcano_scheduler.go +++ b/pkg/batchscheduler/volcano/volcano_scheduler.go @@ -180,12 +180,19 @@ func New(config *rest.Config) (schedulerinterface.BatchScheduler, error) { return nil, fmt.Errorf("failed to initialize k8s extension client with error %v", err) } - if _, err := extClient.ApiextensionsV1beta1().CustomResourceDefinitions().Get( + if _, err := extClient.ApiextensionsV1().CustomResourceDefinitions().Get( context.TODO(), PodGroupName, metav1.GetOptions{}, ); err != nil { - return nil, fmt.Errorf("podGroup CRD is required to exists in current cluster error: %s", err) + //For backward compatibility check v1beta1 API version of CustomResourceDefinitions + if _, err := extClient.ApiextensionsV1beta1().CustomResourceDefinitions().Get( + context.TODO(), + PodGroupName, + metav1.GetOptions{}, + ); err != nil { + return nil, fmt.Errorf("podGroup CRD is required to exists in current cluster error: %s", err) + } } return &VolcanoBatchScheduler{ extensionClient: extClient,