Skip to content

Commit 4761c71

Browse files
authored
move inf model IsCritial func out of datastore (kubernetes-sigs#670)
* move inf model IsCritial func out of datastore Signed-off-by: Nir Rozenbaum <nirro@il.ibm.com> * remove IsCritical function helper function Signed-off-by: Nir Rozenbaum <nirro@il.ibm.com> --------- Signed-off-by: Nir Rozenbaum <nirro@il.ibm.com>
1 parent 42eb5ff commit 4761c71

File tree

3 files changed

+4
-11
lines changed

3 files changed

+4
-11
lines changed

pkg/epp/datastore/datastore.go

+1-8
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ type Datastore interface {
6969
Clear()
7070
}
7171

72-
func NewDatastore(parentCtx context.Context, pmf *backendmetrics.PodMetricsFactory) *datastore {
72+
func NewDatastore(parentCtx context.Context, pmf *backendmetrics.PodMetricsFactory) Datastore {
7373
store := &datastore{
7474
parentCtx: parentCtx,
7575
poolAndModelsMu: sync.RWMutex{},
@@ -302,10 +302,3 @@ func stripLabelKeyAliasFromLabelMap(labels map[v1alpha2.LabelKey]v1alpha2.LabelV
302302
}
303303
return outMap
304304
}
305-
306-
func IsCritical(model *v1alpha2.InferenceModel) bool {
307-
if model.Spec.Criticality != nil && *model.Spec.Criticality == v1alpha2.Critical {
308-
return true
309-
}
310-
return false
311-
}

pkg/epp/handlers/request.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import (
2626
extProcPb "github.com/envoyproxy/go-control-plane/envoy/service/ext_proc/v3"
2727
"google.golang.org/protobuf/types/known/structpb"
2828
"sigs.k8s.io/controller-runtime/pkg/log"
29-
"sigs.k8s.io/gateway-api-inference-extension/pkg/epp/datastore"
29+
"sigs.k8s.io/gateway-api-inference-extension/api/v1alpha2"
3030
schedulingtypes "sigs.k8s.io/gateway-api-inference-extension/pkg/epp/scheduling/types"
3131
errutil "sigs.k8s.io/gateway-api-inference-extension/pkg/epp/util/error"
3232
logutil "sigs.k8s.io/gateway-api-inference-extension/pkg/epp/util/logging"
@@ -77,7 +77,7 @@ func (s *Server) HandleRequestBody(
7777
llmReq := &schedulingtypes.LLMRequest{
7878
Model: model,
7979
ResolvedTargetModel: modelName,
80-
Critical: datastore.IsCritical(modelObj),
80+
Critical: modelObj.Spec.Criticality != nil && *modelObj.Spec.Criticality == v1alpha2.Critical,
8181
}
8282
loggerVerbose.Info("LLM request assembled", "request", llmReq)
8383

pkg/epp/handlers/streamingserver.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ func (s *StreamingServer) HandleRequestBody(
348348
llmReq := &schedulingtypes.LLMRequest{
349349
Model: model,
350350
ResolvedTargetModel: modelName,
351-
Critical: datastore.IsCritical(modelObj),
351+
Critical: modelObj.Spec.Criticality != nil && *modelObj.Spec.Criticality == v1alpha2.Critical,
352352
}
353353
logger.V(logutil.DEBUG).Info("LLM request assembled", "model", llmReq.Model, "targetModel", llmReq.ResolvedTargetModel, "critical", llmReq.Critical)
354354

0 commit comments

Comments
 (0)