Skip to content

Commit

Permalink
Update to use resource v1beta1 API
Browse files Browse the repository at this point in the history
Signed-off-by: Christopher Desiniotis <[email protected]>
  • Loading branch information
cdesiniotis committed Dec 16, 2024
1 parent 821d4fe commit 6bbbd94
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion assets/state-imex-dra-driver/0400_deviceclass-imex.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: resource.k8s.io/v1alpha3
apiVersion: resource.k8s.io/v1beta1
kind: DeviceClass
metadata:
name: imex.nvidia.com
Expand Down
6 changes: 3 additions & 3 deletions controllers/object_controls.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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()
Expand All @@ -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...")
Expand Down
6 changes: 3 additions & 3 deletions controllers/resource_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 6bbbd94

Please sign in to comment.