Skip to content

Commit 94b39bf

Browse files
committed
If a picker is missing, always add a MaxScorePicker
Signed-off-by: Shmuel Kallner <kallner@il.ibm.com>
1 parent 3483f05 commit 94b39bf

File tree

3 files changed

+3
-34
lines changed

3 files changed

+3
-34
lines changed

pkg/epp/common/config/loader/configloader.go

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ func LoadSchedulerConfig(configProfiles []configapi.SchedulingProfile, handle pl
6868
for _, namedProfile := range configProfiles {
6969
profile := framework.NewSchedulerProfile()
7070
pickerAdded := false
71-
scorerAdded := false
7271
for _, plugin := range namedProfile.Plugins {
7372
referencedPlugin := handle.Plugin(plugin.PluginRef)
7473
if scorer, ok := referencedPlugin.(framework.Scorer); ok {
@@ -78,7 +77,6 @@ func LoadSchedulerConfig(configProfiles []configapi.SchedulingProfile, handle pl
7877
weight = *plugin.Weight
7978
}
8079
referencedPlugin = framework.NewWeightedScorer(scorer, weight)
81-
scorerAdded = true
8280
}
8381
if _, ok := referencedPlugin.(framework.Picker); ok {
8482
pickerAdded = true
@@ -89,13 +87,7 @@ func LoadSchedulerConfig(configProfiles []configapi.SchedulingProfile, handle pl
8987
}
9088
if !pickerAdded {
9189
// There isn't a picker in this profile, add one
92-
var thePicker framework.Picker
93-
if scorerAdded {
94-
thePicker = picker.NewMaxScorePicker(picker.DefaultMaxNumOfEndpoints)
95-
} else {
96-
thePicker = picker.NewRandomPicker(picker.DefaultMaxNumOfEndpoints)
97-
}
98-
90+
thePicker := picker.NewMaxScorePicker(picker.DefaultMaxNumOfEndpoints)
9991
if err := profile.AddPlugins(thePicker); err != nil {
10092
return nil, fmt.Errorf("failed to load scheduler config - %w", err)
10193
}

pkg/epp/common/config/loader/configloader_test.go

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -265,11 +265,6 @@ func TestLoadSchedulerConfig(t *testing.T) {
265265
configText: successWithNoProfileHandlersText,
266266
wantErr: false,
267267
},
268-
{
269-
name: "successWithNoPicker",
270-
configText: successWithNoPickerText,
271-
wantErr: false,
272-
},
273268
{
274269
name: "errorBadPluginJson",
275270
configText: errorBadPluginJsonText,
@@ -717,23 +712,6 @@ schedulingProfiles:
717712
- pluginRef: maxScore
718713
`
719714

720-
// valid configuration using default profile handler
721-
//
722-
//nolint:dupword
723-
const successWithNoPickerText = `
724-
apiVersion: inference.networking.x-k8s.io/v1alpha1
725-
kind: EndpointPickerConfig
726-
plugins:
727-
- name: lowQueueFilter
728-
type: low-queue-filter
729-
parameters:
730-
threshold: 10
731-
schedulingProfiles:
732-
- name: default
733-
plugins:
734-
- pluginRef: lowQueueFilter
735-
`
736-
737715
// invalid parameter configuration for plugin (string passed, in expected)
738716
//
739717
//nolint:dupword

site-src/guides/epp-configuration/config-text.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,8 @@ will be used for a particular request. A Profile Handler must be specified, unle
1919
contains one profile, in which case the `SingleProfileHandler` will be used.
2020

2121
In addition, the set of instantiated plugins can also include a picker, which chooses the actual pod to which
22-
the request is scheduled after filtering and scoring. If one is not referenced in a SchedulingProfile, one
23-
will be added. The picker added depends on whether or not scorers were referenced in the SchedulingProfile
24-
in question.
22+
the request is scheduled after filtering and scoring. If one is not referenced in a SchedulingProfile, an
23+
instance of `MaxScorePicker` will be added to the SchedulingProfile in question.
2524

2625
It should be noted that while the configuration text looks like a Kubernetes Custom Resource, it is
2726
**NOT** a Kubernetes Custom Resource. Kubernetes infrastructure is used to load the configuration

0 commit comments

Comments
 (0)