@@ -21,7 +21,7 @@ import (
21
21
"fmt"
22
22
"testing"
23
23
24
- "k8s.io/api/resource/v1alpha3 "
24
+ "k8s.io/api/resource/v1beta1 "
25
25
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
26
26
"k8s.io/apimachinery/pkg/runtime"
27
27
clientset "k8s.io/client-go/kubernetes"
@@ -53,38 +53,38 @@ func TestEnableDisableDRAResourceClaimDeviceStatus(t *testing.T) {
53
53
ns := framework .CreateNamespaceOrDie (client1 , "test-enable-dra-resourceclaim-device-status" , t )
54
54
55
55
rcDisabledName := "test-enable-dra-resourceclaim-device-status-rc-disabled"
56
- rcDisabled := & v1alpha3 .ResourceClaim {
56
+ rcDisabled := & v1beta1 .ResourceClaim {
57
57
ObjectMeta : metav1.ObjectMeta {
58
58
Name : rcDisabledName ,
59
59
},
60
- Spec : v1alpha3 .ResourceClaimSpec {
61
- Devices : v1alpha3 .DeviceClaim {
62
- Requests : []v1alpha3 .DeviceRequest {
60
+ Spec : v1beta1 .ResourceClaimSpec {
61
+ Devices : v1beta1 .DeviceClaim {
62
+ Requests : []v1beta1 .DeviceRequest {
63
63
{
64
64
Name : "foo" ,
65
65
DeviceClassName : "foo" ,
66
66
Count : 1 ,
67
- AllocationMode : v1alpha3 .DeviceAllocationModeExactCount ,
67
+ AllocationMode : v1beta1 .DeviceAllocationModeExactCount ,
68
68
},
69
69
},
70
70
},
71
71
},
72
72
}
73
73
74
- if _ , err := client1 .ResourceV1alpha3 ().ResourceClaims (ns .Name ).Create (context .TODO (), rcDisabled , metav1.CreateOptions {}); err != nil {
74
+ if _ , err := client1 .ResourceV1beta1 ().ResourceClaims (ns .Name ).Create (context .TODO (), rcDisabled , metav1.CreateOptions {}); err != nil {
75
75
t .Fatal (err )
76
76
}
77
77
78
- rcDisabled .Status = v1alpha3 .ResourceClaimStatus {
79
- Devices : []v1alpha3 .AllocatedDeviceStatus {
78
+ rcDisabled .Status = v1beta1 .ResourceClaimStatus {
79
+ Devices : []v1beta1 .AllocatedDeviceStatus {
80
80
{
81
81
Driver : "foo" ,
82
82
Pool : "foo" ,
83
83
Device : "foo" ,
84
84
Data : runtime.RawExtension {
85
85
Raw : []byte (`{"kind": "foo", "apiVersion": "dra.example.com/v1"}` ),
86
86
},
87
- NetworkData : & v1alpha3 .NetworkDeviceData {
87
+ NetworkData : & v1beta1 .NetworkDeviceData {
88
88
InterfaceName : "net-1" ,
89
89
IPs : []string {
90
90
"10.9.8.0/24" ,
@@ -95,11 +95,11 @@ func TestEnableDisableDRAResourceClaimDeviceStatus(t *testing.T) {
95
95
},
96
96
},
97
97
}
98
- if _ , err := client1 .ResourceV1alpha3 ().ResourceClaims (ns .Name ).UpdateStatus (context .TODO (), rcDisabled , metav1.UpdateOptions {}); err != nil {
98
+ if _ , err := client1 .ResourceV1beta1 ().ResourceClaims (ns .Name ).UpdateStatus (context .TODO (), rcDisabled , metav1.UpdateOptions {}); err != nil {
99
99
t .Fatal (err )
100
100
}
101
101
102
- rcDisabled , err = client1 .ResourceV1alpha3 ().ResourceClaims (ns .Name ).Get (context .TODO (), rcDisabledName , metav1.GetOptions {})
102
+ rcDisabled , err = client1 .ResourceV1beta1 ().ResourceClaims (ns .Name ).Get (context .TODO (), rcDisabledName , metav1.GetOptions {})
103
103
if err != nil {
104
104
t .Fatal (err )
105
105
}
@@ -123,40 +123,40 @@ func TestEnableDisableDRAResourceClaimDeviceStatus(t *testing.T) {
123
123
}
124
124
125
125
rcEnabledName := "test-enable-dra-resourceclaim-device-status-rc-enabled"
126
- rcEnabled := & v1alpha3 .ResourceClaim {
126
+ rcEnabled := & v1beta1 .ResourceClaim {
127
127
ObjectMeta : metav1.ObjectMeta {
128
128
Name : rcEnabledName ,
129
129
},
130
- Spec : v1alpha3 .ResourceClaimSpec {
131
- Devices : v1alpha3 .DeviceClaim {
132
- Requests : []v1alpha3 .DeviceRequest {
130
+ Spec : v1beta1 .ResourceClaimSpec {
131
+ Devices : v1beta1 .DeviceClaim {
132
+ Requests : []v1beta1 .DeviceRequest {
133
133
{
134
134
Name : "bar" ,
135
135
DeviceClassName : "bar" ,
136
136
Count : 1 ,
137
- AllocationMode : v1alpha3 .DeviceAllocationModeExactCount ,
137
+ AllocationMode : v1beta1 .DeviceAllocationModeExactCount ,
138
138
},
139
139
},
140
140
},
141
141
},
142
142
}
143
143
144
- if _ , err := client2 .ResourceV1alpha3 ().ResourceClaims (ns .Name ).Create (context .TODO (), rcEnabled , metav1.CreateOptions {}); err != nil {
144
+ if _ , err := client2 .ResourceV1beta1 ().ResourceClaims (ns .Name ).Create (context .TODO (), rcEnabled , metav1.CreateOptions {}); err != nil {
145
145
t .Fatal (err )
146
146
}
147
147
148
148
// Tests the validation is enabled.
149
149
// validation will refuse this update as the device is not allocated.
150
- rcEnabled .Status = v1alpha3 .ResourceClaimStatus {
151
- Devices : []v1alpha3 .AllocatedDeviceStatus {
150
+ rcEnabled .Status = v1beta1 .ResourceClaimStatus {
151
+ Devices : []v1beta1 .AllocatedDeviceStatus {
152
152
{
153
153
Driver : "bar" ,
154
154
Pool : "bar" ,
155
155
Device : "bar" ,
156
156
Data : runtime.RawExtension {
157
157
Raw : []byte (`{"kind": "foo", "apiVersion": "dra.example.com/v1"}` ),
158
158
},
159
- NetworkData : & v1alpha3 .NetworkDeviceData {
159
+ NetworkData : & v1beta1 .NetworkDeviceData {
160
160
InterfaceName : "net-1" ,
161
161
IPs : []string {
162
162
"10.9.8.0/24" ,
@@ -167,14 +167,14 @@ func TestEnableDisableDRAResourceClaimDeviceStatus(t *testing.T) {
167
167
},
168
168
},
169
169
}
170
- if _ , err := client2 .ResourceV1alpha3 ().ResourceClaims (ns .Name ).UpdateStatus (context .TODO (), rcEnabled , metav1.UpdateOptions {}); err == nil {
170
+ if _ , err := client2 .ResourceV1beta1 ().ResourceClaims (ns .Name ).UpdateStatus (context .TODO (), rcEnabled , metav1.UpdateOptions {}); err == nil {
171
171
t .Fatalf ("Expected error (must be an allocated device in the claim)" )
172
172
}
173
173
174
- rcEnabled .Status = v1alpha3 .ResourceClaimStatus {
175
- Allocation : & v1alpha3 .AllocationResult {
176
- Devices : v1alpha3 .DeviceAllocationResult {
177
- Results : []v1alpha3 .DeviceRequestAllocationResult {
174
+ rcEnabled .Status = v1beta1 .ResourceClaimStatus {
175
+ Allocation : & v1beta1 .AllocationResult {
176
+ Devices : v1beta1 .DeviceAllocationResult {
177
+ Results : []v1beta1 .DeviceRequestAllocationResult {
178
178
{
179
179
Request : "bar" ,
180
180
Driver : "bar" ,
@@ -184,15 +184,15 @@ func TestEnableDisableDRAResourceClaimDeviceStatus(t *testing.T) {
184
184
},
185
185
},
186
186
},
187
- Devices : []v1alpha3 .AllocatedDeviceStatus {
187
+ Devices : []v1beta1 .AllocatedDeviceStatus {
188
188
{
189
189
Driver : "bar" ,
190
190
Pool : "bar" ,
191
191
Device : "bar" ,
192
192
Data : runtime.RawExtension {
193
193
Raw : []byte (`{"kind": "foo", "apiVersion": "dra.example.com/v1"}` ),
194
194
},
195
- NetworkData : & v1alpha3 .NetworkDeviceData {
195
+ NetworkData : & v1beta1 .NetworkDeviceData {
196
196
InterfaceName : "net-1" ,
197
197
IPs : []string {
198
198
"10.9.8.0/24" ,
@@ -203,12 +203,12 @@ func TestEnableDisableDRAResourceClaimDeviceStatus(t *testing.T) {
203
203
},
204
204
},
205
205
}
206
- if _ , err := client2 .ResourceV1alpha3 ().ResourceClaims (ns .Name ).UpdateStatus (context .TODO (), rcEnabled , metav1.UpdateOptions {}); err != nil {
206
+ if _ , err := client2 .ResourceV1beta1 ().ResourceClaims (ns .Name ).UpdateStatus (context .TODO (), rcEnabled , metav1.UpdateOptions {}); err != nil {
207
207
t .Fatal (err )
208
208
}
209
209
210
210
// Tests the field is enabled.
211
- rcEnabled , err = client2 .ResourceV1alpha3 ().ResourceClaims (ns .Name ).Get (context .TODO (), rcEnabledName , metav1.GetOptions {})
211
+ rcEnabled , err = client2 .ResourceV1beta1 ().ResourceClaims (ns .Name ).Get (context .TODO (), rcEnabledName , metav1.GetOptions {})
212
212
if err != nil {
213
213
t .Fatal (err )
214
214
}
0 commit comments