@@ -126,6 +126,74 @@ func TestInferencePoolConvertTo(t *testing.T) {
126
126
},
127
127
wantErr : false ,
128
128
},
129
+ {
130
+ name : "conversion from v1alpha2 to v1 with nil extensionRef" ,
131
+ src : & InferencePool {
132
+ TypeMeta : metav1.TypeMeta {
133
+ Kind : "InferencePool" ,
134
+ APIVersion : "inference.networking.x-k8s.io/v1alpha2" ,
135
+ },
136
+ ObjectMeta : metav1.ObjectMeta {
137
+ Name : "test-pool" ,
138
+ Namespace : "test-ns" ,
139
+ },
140
+ Spec : InferencePoolSpec {
141
+ Selector : map [LabelKey ]LabelValue {
142
+ "app" : "my-model-server" ,
143
+ },
144
+ TargetPortNumber : 8080 ,
145
+ },
146
+ Status : InferencePoolStatus {
147
+ Parents : []PoolStatus {
148
+ {
149
+ GatewayRef : ParentGatewayReference {Name : "my-gateway" },
150
+ Conditions : []metav1.Condition {
151
+ {
152
+ Type : string (InferencePoolConditionAccepted ),
153
+ Status : metav1 .ConditionTrue ,
154
+ Reason : string (InferencePoolReasonAccepted ),
155
+ LastTransitionTime : timestamp ,
156
+ },
157
+ },
158
+ },
159
+ },
160
+ },
161
+ },
162
+ want : & v1.InferencePool {
163
+ TypeMeta : metav1.TypeMeta {
164
+ Kind : "InferencePool" ,
165
+ APIVersion : "inference.networking.x-k8s.io/v1alpha2" ,
166
+ },
167
+ ObjectMeta : metav1.ObjectMeta {
168
+ Name : "test-pool" ,
169
+ Namespace : "test-ns" ,
170
+ },
171
+ Spec : v1.InferencePoolSpec {
172
+ Selector : v1.LabelSelector {
173
+ MatchLabels : map [v1.LabelKey ]v1.LabelValue {
174
+ "app" : "my-model-server" ,
175
+ },
176
+ },
177
+ TargetPortNumber : 8080 ,
178
+ },
179
+ Status : v1.InferencePoolStatus {
180
+ Parents : []v1.PoolStatus {
181
+ {
182
+ GatewayRef : v1.ParentGatewayReference {Name : "my-gateway" },
183
+ Conditions : []metav1.Condition {
184
+ {
185
+ Type : string (v1 .InferencePoolConditionAccepted ),
186
+ Status : metav1 .ConditionTrue ,
187
+ Reason : string (v1 .InferencePoolReasonAccepted ),
188
+ LastTransitionTime : timestamp ,
189
+ },
190
+ },
191
+ },
192
+ },
193
+ },
194
+ },
195
+ wantErr : false ,
196
+ },
129
197
}
130
198
131
199
for _ , tt := range tests {
@@ -231,6 +299,74 @@ func TestInferencePoolConvertFrom(t *testing.T) {
231
299
},
232
300
wantErr : false ,
233
301
},
302
+ {
303
+ name : "conversion from v1 to v1alpha2 with nil extensionRef" ,
304
+ src : & v1.InferencePool {
305
+ TypeMeta : metav1.TypeMeta {
306
+ Kind : "InferencePool" ,
307
+ APIVersion : "inference.networking.k8s.io/v1" ,
308
+ },
309
+ ObjectMeta : metav1.ObjectMeta {
310
+ Name : "test-pool" ,
311
+ Namespace : "test-ns" ,
312
+ },
313
+ Spec : v1.InferencePoolSpec {
314
+ Selector : v1.LabelSelector {
315
+ MatchLabels : map [v1.LabelKey ]v1.LabelValue {
316
+ "app" : "my-model-server" ,
317
+ },
318
+ },
319
+ TargetPortNumber : 8080 ,
320
+ },
321
+ Status : v1.InferencePoolStatus {
322
+ Parents : []v1.PoolStatus {
323
+ {
324
+ GatewayRef : v1.ParentGatewayReference {Name : "my-gateway" },
325
+ Conditions : []metav1.Condition {
326
+ {
327
+ Type : string (v1 .InferencePoolConditionAccepted ),
328
+ Status : metav1 .ConditionTrue ,
329
+ Reason : string (v1 .InferencePoolReasonAccepted ),
330
+ LastTransitionTime : timestamp ,
331
+ },
332
+ },
333
+ },
334
+ },
335
+ },
336
+ },
337
+ want : & InferencePool {
338
+ TypeMeta : metav1.TypeMeta {
339
+ Kind : "InferencePool" ,
340
+ APIVersion : "inference.networking.k8s.io/v1" ,
341
+ },
342
+ ObjectMeta : metav1.ObjectMeta {
343
+ Name : "test-pool" ,
344
+ Namespace : "test-ns" ,
345
+ },
346
+ Spec : InferencePoolSpec {
347
+ Selector : map [LabelKey ]LabelValue {
348
+ "app" : "my-model-server" ,
349
+ },
350
+ TargetPortNumber : 8080 ,
351
+ },
352
+ Status : InferencePoolStatus {
353
+ Parents : []PoolStatus {
354
+ {
355
+ GatewayRef : ParentGatewayReference {Name : "my-gateway" },
356
+ Conditions : []metav1.Condition {
357
+ {
358
+ Type : string (InferencePoolConditionAccepted ),
359
+ Status : metav1 .ConditionTrue ,
360
+ Reason : string (InferencePoolReasonAccepted ),
361
+ LastTransitionTime : timestamp ,
362
+ },
363
+ },
364
+ },
365
+ },
366
+ },
367
+ },
368
+ wantErr : false ,
369
+ },
234
370
{
235
371
name : "nil source" ,
236
372
src : nil ,
0 commit comments