@@ -36,6 +36,7 @@ import (
3636 "sigs.k8s.io/gateway-api-inference-extension/pkg/common"
3737 backendmetrics "sigs.k8s.io/gateway-api-inference-extension/pkg/epp/backend/metrics"
3838 "sigs.k8s.io/gateway-api-inference-extension/pkg/epp/datastore"
39+ poolutil "sigs.k8s.io/gateway-api-inference-extension/pkg/epp/util/pool"
3940 utiltest "sigs.k8s.io/gateway-api-inference-extension/pkg/epp/util/testing"
4041)
4142
4849 CreationTimestamp : metav1 .Unix (1000 , 0 ),
4950 },
5051 Spec : v1alpha2.InferenceModelRewriteSpec {
51- PoolRef : & v1alpha2.PoolObjectReference {Name : v1alpha2 .ObjectName (poolForRewrite .Name )},
52+ PoolRef : & v1alpha2.PoolObjectReference {
53+ Name : v1alpha2 .ObjectName (poolForRewrite .Name ),
54+ Group : v1alpha2 .Group (poolForRewrite .GroupVersionKind ().Group ),
55+ },
5256 },
5357 }
5458 rewrite1Pool2 = & v1alpha2.InferenceModelRewrite {
5862 CreationTimestamp : metav1 .Unix (1001 , 0 ),
5963 },
6064 Spec : v1alpha2.InferenceModelRewriteSpec {
61- PoolRef : & v1alpha2.PoolObjectReference {Name : "test-pool2" },
65+ PoolRef : & v1alpha2.PoolObjectReference {
66+ Name : "test-pool2" ,
67+ Group : v1alpha2 .Group (poolForRewrite .GroupVersionKind ().Group ),
68+ },
6269 },
6370 }
6471 rewrite1Updated = & v1alpha2.InferenceModelRewrite {
6875 CreationTimestamp : metav1 .Unix (1003 , 0 ),
6976 },
7077 Spec : v1alpha2.InferenceModelRewriteSpec {
71- PoolRef : & v1alpha2.PoolObjectReference {Name : v1alpha2 .ObjectName (poolForRewrite .Name )},
72- Rules : []v1alpha2.InferenceModelRewriteRule {{}},
78+ PoolRef : & v1alpha2.PoolObjectReference {
79+ Name : v1alpha2 .ObjectName (poolForRewrite .Name ),
80+ Group : v1alpha2 .Group (poolForRewrite .GroupVersionKind ().Group ),
81+ },
82+ Rules : []v1alpha2.InferenceModelRewriteRule {{}},
7383 },
7484 }
7585 rewrite1Deleted = & v1alpha2.InferenceModelRewrite {
7888 Namespace : rewrite1 .Namespace ,
7989 CreationTimestamp : metav1 .Unix (1004 , 0 ),
8090 DeletionTimestamp : & metav1.Time {Time : time .Now ()},
91+ Finalizers : []string {"deleted" },
8192 },
8293 Spec : v1alpha2.InferenceModelRewriteSpec {
83- PoolRef : & v1alpha2.PoolObjectReference {Name : v1alpha2 .ObjectName (poolForRewrite .Name )},
94+ PoolRef : & v1alpha2.PoolObjectReference {
95+ Name : v1alpha2 .ObjectName (poolForRewrite .Name ),
96+ Group : v1alpha2 .Group (poolForRewrite .GroupVersionKind ().Group ),
97+ },
8498 },
8599 }
86100 rewrite2 = & v1alpha2.InferenceModelRewrite {
@@ -90,7 +104,10 @@ var (
90104 CreationTimestamp : metav1 .Unix (1001 , 0 ),
91105 },
92106 Spec : v1alpha2.InferenceModelRewriteSpec {
93- PoolRef : & v1alpha2.PoolObjectReference {Name : v1alpha2 .ObjectName (poolForRewrite .Name )},
107+ PoolRef : & v1alpha2.PoolObjectReference {
108+ Name : v1alpha2 .ObjectName (poolForRewrite .Name ),
109+ Group : v1alpha2 .Group (poolForRewrite .GroupVersionKind ().Group ),
110+ },
94111 },
95112 }
96113)
@@ -155,7 +172,7 @@ func TestInferenceModelRewriteReconciler(t *testing.T) {
155172 _ = v1alpha2 .Install (scheme )
156173 _ = v1 .Install (scheme )
157174 initObjs := []client.Object {}
158- if test .rewrite != nil && test . rewrite . DeletionTimestamp . IsZero () {
175+ if test .rewrite != nil {
159176 initObjs = append (initObjs , test .rewrite )
160177 }
161178 for _ , r := range test .rewritesInAPIServer {
@@ -170,7 +187,8 @@ func TestInferenceModelRewriteReconciler(t *testing.T) {
170187 for _ , r := range test .rewritesInStore {
171188 ds .RewriteSet (r )
172189 }
173- _ = ds .PoolSet (context .Background (), fakeClient , poolForRewrite )
190+ endpointPool := poolutil .InferencePoolToEndpointPool (poolForRewrite )
191+ _ = ds .PoolSet (context .Background (), fakeClient , endpointPool )
174192 reconciler := & InferenceModelRewriteReconciler {
175193 Reader : fakeClient ,
176194 Datastore : ds ,
0 commit comments