Skip to content

Commit 6763816

Browse files
authored
fix config load error when picker is set before the scoerer w/o weight. (#1958)
1 parent 78ffe61 commit 6763816

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

pkg/epp/config/loader/configloader_test.go

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,11 @@ func TestLoadConfig(t *testing.T) {
419419
configText: successWithNoProfileHandlersText,
420420
wantErr: false,
421421
},
422+
{
423+
name: "successPickerWeightUnsetScorerText",
424+
configText: successPickerWeightUnsetScorerText,
425+
wantErr: false,
426+
},
422427
{
423428
name: "errorBadYaml",
424429
configText: errorBadYamlText,
@@ -472,7 +477,7 @@ func TestLoadConfig(t *testing.T) {
472477
t.Errorf("LoadConfigPhaseOne returned an unexpected error. error %v", err)
473478
}
474479
t.Logf("error was %s", err)
475-
} else if test.wantErr {
480+
} else {
476481
handle := utils.NewTestHandle(context.Background())
477482
_, err = LoadConfigPhaseTwo(rawConfig, handle, logger)
478483
if err != nil {
@@ -945,6 +950,22 @@ schedulingProfiles:
945950
- pluginRef: maxScore
946951
`
947952

953+
// success with picker and unset weight scorer
954+
//
955+
//nolint:dupword
956+
const successPickerWeightUnsetScorerText = `
957+
apiVersion: inference.networking.x-k8s.io/v1alpha1
958+
kind: EndpointPickerConfig
959+
plugins:
960+
- type: random-picker
961+
- type: prefix-cache-scorer
962+
schedulingProfiles:
963+
- name: default
964+
plugins:
965+
- pluginRef: random-picker
966+
- pluginRef: prefix-cache-scorer
967+
`
968+
948969
// invalid parameter configuration for plugin (string passed, in expected)
949970
//
950971
//nolint:dupword

pkg/epp/config/loader/defaults.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,6 @@ func setDefaultsPhaseTwo(cfg *configapi.EndpointPickerConfig, handle plugins.Han
145145
cfg.SchedulingProfiles[idx] = theProfile
146146
} else if _, ok := referencedPlugin.(framework.Picker); ok {
147147
hasPicker = true
148-
break
149148
}
150149
}
151150
if !hasPicker {

0 commit comments

Comments
 (0)