From 54e1b5959cb6769c4c8bf725ba367523fbb1ed71 Mon Sep 17 00:00:00 2001 From: Christopher Desiniotis Date: Mon, 16 Dec 2024 12:05:43 -0800 Subject: [PATCH] Update to use resource v1beta1 API Signed-off-by: Christopher Desiniotis --- assets/state-imex-dra-driver/0400_deviceclass-imex.yaml | 2 +- controllers/object_controls.go | 6 +++--- controllers/resource_manager.go | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/assets/state-imex-dra-driver/0400_deviceclass-imex.yaml b/assets/state-imex-dra-driver/0400_deviceclass-imex.yaml index 759476c85..77660085d 100644 --- a/assets/state-imex-dra-driver/0400_deviceclass-imex.yaml +++ b/assets/state-imex-dra-driver/0400_deviceclass-imex.yaml @@ -1,4 +1,4 @@ -apiVersion: resource.k8s.io/v1alpha3 +apiVersion: resource.k8s.io/v1beta1 kind: DeviceClass metadata: name: imex.nvidia.com diff --git a/controllers/object_controls.go b/controllers/object_controls.go index 57e6e569f..8756e4259 100644 --- a/controllers/object_controls.go +++ b/controllers/object_controls.go @@ -41,7 +41,7 @@ import ( corev1 "k8s.io/api/core/v1" nodev1 "k8s.io/api/node/v1" nodev1beta1 "k8s.io/api/node/v1beta1" - drav1 "k8s.io/api/resource/v1alpha3" + resourceapi "k8s.io/api/resource/v1beta1" apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -4970,7 +4970,7 @@ func PrometheusRule(n ClusterPolicyController) (gpuv1.State, error) { return gpuv1.Ready, nil } -func createDeviceClass(n ClusterPolicyController, spec drav1.DeviceClass) (gpuv1.State, error) { +func createDeviceClass(n ClusterPolicyController, spec resourceapi.DeviceClass) (gpuv1.State, error) { ctx := n.ctx state := n.idx obj := spec.DeepCopy() @@ -4991,7 +4991,7 @@ func createDeviceClass(n ClusterPolicyController, spec drav1.DeviceClass) (gpuv1 return gpuv1.NotReady, err } - found := &drav1.DeviceClass{} + found := &resourceapi.DeviceClass{} err := n.client.Get(ctx, types.NamespacedName{Namespace: "", Name: obj.Name}, found) if err != nil && apierrors.IsNotFound(err) { logger.Info("Not found, creating...") diff --git a/controllers/resource_manager.go b/controllers/resource_manager.go index 26610300d..111de7dc2 100644 --- a/controllers/resource_manager.go +++ b/controllers/resource_manager.go @@ -29,7 +29,7 @@ import ( corev1 "k8s.io/api/core/v1" nodev1 "k8s.io/api/node/v1" rbacv1 "k8s.io/api/rbac/v1" - drav1 "k8s.io/api/resource/v1alpha3" + resourceapi "k8s.io/api/resource/v1beta1" schedv1 "k8s.io/api/scheduling/v1beta1" "k8s.io/apimachinery/pkg/runtime/serializer/json" @@ -61,7 +61,7 @@ type Resources struct { SecurityContextConstraints secv1.SecurityContextConstraints RuntimeClasses []nodev1.RuntimeClass PrometheusRule promv1.PrometheusRule - DeviceClasses []drav1.DeviceClass + DeviceClasses []resourceapi.DeviceClass } func filePathWalkDir(n *ClusterPolicyController, root string) ([]string, error) { @@ -182,7 +182,7 @@ func addResourcesControls(n *ClusterPolicyController, path string) (Resources, c panicIfError(err) ctrl = append(ctrl, PrometheusRule) case "DeviceClass": - deviceClass := drav1.DeviceClass{} + deviceClass := resourceapi.DeviceClass{} _, _, err := s.Decode(m, nil, &deviceClass) panicIfError(err) res.DeviceClasses = append(res.DeviceClasses, deviceClass)