Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions pkg/epp/config/loader/configloader.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import (
"sigs.k8s.io/gateway-api-inference-extension/pkg/epp/plugins"
"sigs.k8s.io/gateway-api-inference-extension/pkg/epp/scheduling"
"sigs.k8s.io/gateway-api-inference-extension/pkg/epp/scheduling/framework"
"sigs.k8s.io/gateway-api-inference-extension/pkg/epp/scheduling/framework/plugins/profile"
)

var scheme = runtime.NewScheme()
Expand Down Expand Up @@ -113,6 +114,10 @@ func loadSchedulerConfig(configProfiles []configapi.SchedulingProfile, handle pl
return nil, errors.New("no profile handler was specified")
}

if profileHandler.TypedName().Type == profile.SingleProfileHandlerType && len(profiles) > 1 {
return nil, errors.New("single profile handler is intended to be used with a single profile, but multiple profiles were specified")
}

return scheduling.NewSchedulerConfig(profileHandler, profiles), nil
}

Expand Down
27 changes: 27 additions & 0 deletions pkg/epp/config/loader/configloader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,11 @@ func TestLoadConfig(t *testing.T) {
configText: errorNoProfileHandlersText,
wantErr: true,
},
{
name: "errorMultiProfilesUseSingleProfileHandler",
configText: errorMultiProfilesUseSingleProfileHandlerText,
wantErr: true,
},
}

registerNeededPlgugins()
Expand Down Expand Up @@ -890,3 +895,25 @@ schedulingProfiles:
plugins:
- pluginRef: maxScore
`

// multiple profiles using SingleProfileHandler
//
//nolint:dupword
const errorMultiProfilesUseSingleProfileHandlerText = `
apiVersion: inference.networking.x-k8s.io/v1alpha1
kind: EndpointPickerConfig
plugins:
- name: profileHandler
type: single-profile-handler
- name: maxScore
type: max-score-picker
schedulingProfiles:
- name: default
plugins:
- pluginRef: maxScore
- pluginRef: profileHandler
- name: prof2
plugins:
- pluginRef: maxScore
- pluginRef: profileHandler
`