@@ -50,11 +50,13 @@ import (
5050 ctrl "sigs.k8s.io/controller-runtime"
5151 "sigs.k8s.io/controller-runtime/pkg/cache"
5252 k8sclient "sigs.k8s.io/controller-runtime/pkg/client"
53- "sigs.k8s.io/controller-runtime/pkg/config"
53+ crconfig "sigs.k8s.io/controller-runtime/pkg/config"
5454 "sigs.k8s.io/controller-runtime/pkg/envtest"
5555 crmetrics "sigs.k8s.io/controller-runtime/pkg/metrics"
5656 "sigs.k8s.io/controller-runtime/pkg/metrics/filters"
5757 metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server"
58+ "sigs.k8s.io/yaml"
59+
5860 "sigs.k8s.io/gateway-api-inference-extension/api/v1alpha2"
5961 "sigs.k8s.io/gateway-api-inference-extension/pkg/epp/backend"
6062 backendmetrics "sigs.k8s.io/gateway-api-inference-extension/pkg/epp/backend/metrics"
@@ -63,11 +65,15 @@ import (
6365 "sigs.k8s.io/gateway-api-inference-extension/pkg/epp/requestcontrol"
6466 "sigs.k8s.io/gateway-api-inference-extension/pkg/epp/saturationdetector"
6567 "sigs.k8s.io/gateway-api-inference-extension/pkg/epp/scheduling"
68+ "sigs.k8s.io/gateway-api-inference-extension/pkg/epp/scheduling/config"
69+ "sigs.k8s.io/gateway-api-inference-extension/pkg/epp/scheduling/framework"
70+ "sigs.k8s.io/gateway-api-inference-extension/pkg/epp/scheduling/framework/plugins/filter"
71+ "sigs.k8s.io/gateway-api-inference-extension/pkg/epp/scheduling/framework/plugins/picker"
72+ "sigs.k8s.io/gateway-api-inference-extension/pkg/epp/scheduling/framework/plugins/profile"
6673 "sigs.k8s.io/gateway-api-inference-extension/pkg/epp/server"
6774 logutil "sigs.k8s.io/gateway-api-inference-extension/pkg/epp/util/logging"
6875 epptestutil "sigs.k8s.io/gateway-api-inference-extension/pkg/epp/util/testing"
6976 integrationutils "sigs.k8s.io/gateway-api-inference-extension/test/integration"
70- "sigs.k8s.io/yaml"
7177)
7278
7379const (
@@ -1018,7 +1024,41 @@ func BeforeSuite() func() {
10181024 // Adjust from defaults
10191025 serverRunner .PoolNamespacedName = types.NamespacedName {Name : testPoolName , Namespace : testNamespace }
10201026 serverRunner .Datastore = datastore .NewDatastore (context .Background (), pmf )
1021- scheduler := scheduling .NewScheduler ()
1027+
1028+ loraAffinityFilter := filter .NewLoraAffinityFilter (config .Conf .LoraAffinityThreshold )
1029+ leastQueueFilter := filter .NewLeastQueueFilter ()
1030+ leastKvCacheFilter := filter .NewLeastKVCacheFilter ()
1031+
1032+ lowLatencyFilter := & filter.DecisionTreeFilter {
1033+ Current : filter .NewLowQueueFilter (config .Conf .QueueingThresholdLoRA ),
1034+ NextOnSuccess : & filter.DecisionTreeFilter {
1035+ Current : loraAffinityFilter ,
1036+ NextOnSuccessOrFailure : & filter.DecisionTreeFilter {
1037+ Current : leastQueueFilter ,
1038+ NextOnSuccessOrFailure : & filter.DecisionTreeFilter {
1039+ Current : leastKvCacheFilter ,
1040+ },
1041+ },
1042+ },
1043+ NextOnFailure : & filter.DecisionTreeFilter {
1044+ Current : leastQueueFilter ,
1045+ NextOnSuccessOrFailure : & filter.DecisionTreeFilter {
1046+ Current : loraAffinityFilter ,
1047+ NextOnSuccessOrFailure : & filter.DecisionTreeFilter {
1048+ Current : leastKvCacheFilter ,
1049+ },
1050+ },
1051+ },
1052+ }
1053+
1054+ defaultProfile := framework .NewSchedulerProfile ().
1055+ WithFilters (lowLatencyFilter ).
1056+ WithPicker (picker .NewRandomPicker (picker .DefaultMaxNumOfEndpoints ))
1057+
1058+ profileHandler := profile .NewSingleProfileHandler ()
1059+
1060+ schedulerConfig := scheduling .NewSchedulerConfig (profileHandler , map [string ]* framework.SchedulerProfile {"default" : defaultProfile })
1061+ scheduler := scheduling .NewSchedulerWithConfig (schedulerConfig )
10221062
10231063 sdConfig := & saturationdetector.Config {
10241064 QueueDepthThreshold : saturationdetector .DefaultQueueDepthThreshold ,
@@ -1125,7 +1165,7 @@ func managerTestOptions(namespace, name string, metricsServerOptions metricsserv
11251165 },
11261166 },
11271167 },
1128- Controller : config .Controller {
1168+ Controller : crconfig .Controller {
11291169 SkipNameValidation : boolPointer (true ),
11301170 },
11311171 Metrics : metricsServerOptions ,
0 commit comments