@@ -25,6 +25,7 @@ import (
25
25
"github.com/kgateway-dev/kgateway/v2/internal/kgateway/extensions2"
26
26
"github.com/kgateway-dev/kgateway/v2/internal/kgateway/extensions2/common"
27
27
extensionsplug "github.com/kgateway-dev/kgateway/v2/internal/kgateway/extensions2/plugin"
28
+ "github.com/kgateway-dev/kgateway/v2/internal/kgateway/extensions2/plugins/inferenceextension/endpointpicker"
28
29
"github.com/kgateway-dev/kgateway/v2/internal/kgateway/extensions2/registry"
29
30
"github.com/kgateway-dev/kgateway/v2/internal/kgateway/extensions2/settings"
30
31
"github.com/kgateway-dev/kgateway/v2/internal/kgateway/ir"
@@ -105,11 +106,6 @@ func NewControllerBuilder(ctx context.Context, cfg StartConfig) (*ControllerBuil
105
106
return nil , err
106
107
}
107
108
108
- // Extend the scheme if the InferencePool CRD exists.
109
- if _ , err := glooschemes .AddInferExtV1A1Scheme (cfg .RestConfig , scheme ); err != nil {
110
- return nil , err
111
- }
112
-
113
109
mgrOpts := ctrl.Options {
114
110
BaseContext : func () context.Context { return ctx },
115
111
Scheme : scheme ,
@@ -148,6 +144,16 @@ func NewControllerBuilder(ctx context.Context, cfg StartConfig) (*ControllerBuil
148
144
setupLog ,
149
145
* cfg .SetupOpts .GlobalSettings ,
150
146
)
147
+
148
+ // Extend the scheme and add the EPP plugin if the InferencePool CRD exists.
149
+ exists , err := glooschemes .AddInferExtV1A1Scheme (cfg .RestConfig , scheme )
150
+ switch {
151
+ case err != nil :
152
+ return nil , err
153
+ case exists :
154
+ cfg .ExtraPlugins = append (cfg .ExtraPlugins , endpointpicker .NewPlugin (ctx , commoncol ))
155
+ }
156
+
151
157
gwClasses := sets .New (append (cfg .SetupOpts .ExtraGatewayClasses , wellknown .GatewayClassName )... )
152
158
isOurGw := func (gw * apiv1.Gateway ) bool {
153
159
return gwClasses .Has (string (gw .Spec .GatewayClassName ))
0 commit comments