Skip to content

Commit 4e370e7

Browse files
committed
Addressed first round of comments
1 parent 7aabfd2 commit 4e370e7

File tree

6 files changed

+16
-13
lines changed

6 files changed

+16
-13
lines changed

pkg/ext-proc/backend/datastore.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ type Datastore interface {
2626

2727
// InferenceModel operations
2828
ModelSet(infModel *v1alpha1.InferenceModel)
29-
ModelGet(modelName string) (returnModel *v1alpha1.InferenceModel)
29+
ModelGet(modelName string) (*v1alpha1.InferenceModel, bool)
3030
ModelDelete(modelName string)
3131

3232
// PodMetrics operations
3333
PodUpdateOrAddIfNotExist(pod *corev1.Pod) bool
34-
PodUpdateMetricsIfExist(pm *PodMetrics)
34+
PodUpdateMetricsIfExist(pm *PodMetrics) bool
3535
PodGet(namespacedName types.NamespacedName) (*PodMetrics, bool)
3636
PodDelete(namespacedName types.NamespacedName)
3737
PodResyncAll(ctx context.Context, ctrlClient client.Client)
@@ -102,24 +102,26 @@ func (ds *datastore) ModelSet(infModel *v1alpha1.InferenceModel) {
102102
ds.models.Store(infModel.Spec.ModelName, infModel)
103103
}
104104

105-
func (ds *datastore) ModelGet(modelName string) (returnModel *v1alpha1.InferenceModel) {
105+
func (ds *datastore) ModelGet(modelName string) (*v1alpha1.InferenceModel, bool) {
106106
infModel, ok := ds.models.Load(modelName)
107107
if ok {
108-
returnModel = infModel.(*v1alpha1.InferenceModel)
108+
return infModel.(*v1alpha1.InferenceModel), true
109109
}
110-
return
110+
return nil, false
111111
}
112112

113113
func (ds *datastore) ModelDelete(modelName string) {
114114
ds.models.Delete(modelName)
115115
}
116116

117117
// /// Pods/endpoints APIs ///
118-
func (ds *datastore) PodUpdateMetricsIfExist(pm *PodMetrics) {
118+
func (ds *datastore) PodUpdateMetricsIfExist(pm *PodMetrics) bool {
119119
if val, ok := ds.pods.Load(pm.NamespacedName); ok {
120120
existing := val.(*PodMetrics)
121121
existing.Metrics = pm.Metrics
122+
return true
122123
}
124+
return false
123125
}
124126

125127
func (ds *datastore) PodGet(namespacedName types.NamespacedName) (*PodMetrics, bool) {

pkg/ext-proc/backend/inferencemodel_reconciler_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ func TestReconcile_ModelMarkedForDeletion(t *testing.T) {
242242
}
243243

244244
// Verify that the datastore was not updated.
245-
if infModel := datastore.ModelGet(existingModel.Spec.ModelName); infModel != nil {
245+
if _, exist := datastore.ModelGet(existingModel.Spec.ModelName); exist {
246246
t.Errorf("expected datastore to not contain model %q", existingModel.Spec.ModelName)
247247
}
248248
}
@@ -299,7 +299,7 @@ func TestReconcile_ResourceExists(t *testing.T) {
299299
}
300300

301301
// Verify that the datastore was updated.
302-
if infModel := datastore.ModelGet(existingModel.Spec.ModelName); infModel == nil {
302+
if _, exist := datastore.ModelGet(existingModel.Spec.ModelName); !exist {
303303
t.Errorf("expected datastore to contain model %q", existingModel.Spec.ModelName)
304304
}
305305
}

pkg/ext-proc/handlers/request.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ func (s *Server) HandleRequestBody(
4848
// NOTE: The nil checking for the modelObject means that we DO allow passthrough currently.
4949
// This might be a security risk in the future where adapters not registered in the InferenceModel
5050
// are able to be requested by using their distinct name.
51-
modelObj := s.datastore.ModelGet(model)
52-
if modelObj == nil {
51+
modelObj, exist := s.datastore.ModelGet(model)
52+
if !exist {
5353
return nil, fmt.Errorf("error finding a model object in InferenceModel for input %v", model)
5454
}
5555
if len(modelObj.Spec.TargetModels) > 0 {

pkg/manifests/ext_proc.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ spec:
7171
spec:
7272
containers:
7373
- name: inference-gateway-ext-proc
74-
image: us-central1-docker.pkg.dev/ahg-gke-dev/jobset2/epp:dfee85a
74+
image: us-central1-docker.pkg.dev/k8s-staging-images/gateway-api-inference-extension/epp:main
7575
imagePullPolicy: Always
7676
args:
7777
- -poolName

pkg/manifests/vllm/deployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ spec:
3939
- "8000"
4040
- "--enable-lora"
4141
- "--max-loras"
42-
- "2"
42+
- "4"
4343
- "--max-cpu-loras"
4444
- "12"
4545
- "--lora-modules"

test/integration/hermetic_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,8 @@ func BeforeSuit(t *testing.T) func() {
490490
}
491491

492492
assert.EventuallyWithT(t, func(t *assert.CollectT) {
493-
synced := serverRunner.Datastore.PoolHasSynced() && serverRunner.Datastore.ModelGet("my-model") != nil
493+
_, modelExist := serverRunner.Datastore.ModelGet("my-model")
494+
synced := serverRunner.Datastore.PoolHasSynced() && modelExist
494495
assert.True(t, synced, "Timeout waiting for the pool and models to sync")
495496
}, 10*time.Second, 10*time.Millisecond)
496497

0 commit comments

Comments
 (0)