Skip to content

Commit f137264

Browse files
committedJan 7, 2025
Update to use resource v1beta1 API
Signed-off-by: Christopher Desiniotis <cdesiniotis@nvidia.com>
1 parent 04751ec commit f137264

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed
 

‎assets/state-dra-driver/0400_deviceclass-imex.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
apiVersion: resource.k8s.io/v1alpha3
1+
apiVersion: resource.k8s.io/v1beta1
22
kind: DeviceClass
33
metadata:
44
name: imex.nvidia.com

‎controllers/object_controls.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ import (
4141
corev1 "k8s.io/api/core/v1"
4242
nodev1 "k8s.io/api/node/v1"
4343
nodev1beta1 "k8s.io/api/node/v1beta1"
44-
drav1 "k8s.io/api/resource/v1alpha3"
44+
resourceapi "k8s.io/api/resource/v1beta1"
4545
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
4646
apierrors "k8s.io/apimachinery/pkg/api/errors"
4747
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -4953,7 +4953,7 @@ func PrometheusRule(n ClusterPolicyController) (gpuv1.State, error) {
49534953
return gpuv1.Ready, nil
49544954
}
49554955

4956-
func createDeviceClass(n ClusterPolicyController, spec drav1.DeviceClass) (gpuv1.State, error) {
4956+
func createDeviceClass(n ClusterPolicyController, spec resourceapi.DeviceClass) (gpuv1.State, error) {
49574957
ctx := n.ctx
49584958
state := n.idx
49594959
obj := spec.DeepCopy()
@@ -4974,7 +4974,7 @@ func createDeviceClass(n ClusterPolicyController, spec drav1.DeviceClass) (gpuv1
49744974
return gpuv1.NotReady, err
49754975
}
49764976

4977-
found := &drav1.DeviceClass{}
4977+
found := &resourceapi.DeviceClass{}
49784978
err := n.client.Get(ctx, types.NamespacedName{Namespace: "", Name: obj.Name}, found)
49794979
if err != nil && apierrors.IsNotFound(err) {
49804980
logger.Info("Not found, creating...")

‎controllers/resource_manager.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import (
2929
corev1 "k8s.io/api/core/v1"
3030
nodev1 "k8s.io/api/node/v1"
3131
rbacv1 "k8s.io/api/rbac/v1"
32-
drav1 "k8s.io/api/resource/v1alpha3"
32+
resourceapi "k8s.io/api/resource/v1beta1"
3333
schedv1 "k8s.io/api/scheduling/v1beta1"
3434

3535
"k8s.io/apimachinery/pkg/runtime/serializer/json"
@@ -61,7 +61,7 @@ type Resources struct {
6161
SecurityContextConstraints secv1.SecurityContextConstraints
6262
RuntimeClasses []nodev1.RuntimeClass
6363
PrometheusRule promv1.PrometheusRule
64-
DeviceClasses []drav1.DeviceClass
64+
DeviceClasses []resourceapi.DeviceClass
6565
}
6666

6767
func filePathWalkDir(n *ClusterPolicyController, root string) ([]string, error) {
@@ -182,7 +182,7 @@ func addResourcesControls(n *ClusterPolicyController, path string) (Resources, c
182182
panicIfError(err)
183183
ctrl = append(ctrl, PrometheusRule)
184184
case "DeviceClass":
185-
deviceClass := drav1.DeviceClass{}
185+
deviceClass := resourceapi.DeviceClass{}
186186
_, _, err := s.Decode(m, nil, &deviceClass)
187187
panicIfError(err)
188188
res.DeviceClasses = append(res.DeviceClasses, deviceClass)

0 commit comments

Comments
 (0)