File tree Expand file tree Collapse file tree 3 files changed +28
-3
lines changed Expand file tree Collapse file tree 3 files changed +28
-3
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,8 @@ limitations under the License.
1717package runner
1818
1919import (
20+ "context"
21+
2022 "sigs.k8s.io/gateway-api-inference-extension/pkg/epp/plugins"
2123 "sigs.k8s.io/gateway-api-inference-extension/pkg/epp/scheduling/framework/plugins/filter"
2224 "sigs.k8s.io/gateway-api-inference-extension/pkg/epp/scheduling/framework/plugins/multi/prefix"
@@ -42,9 +44,15 @@ func RegisterAllPlugins() {
4244
4345// eppHandle is an implementation of the interface plugins.Handle
4446type eppHandle struct {
47+ ctx context.Context
4548 plugins plugins.HandlePlugins
4649}
4750
51+ // Context returns a context the plugins can use, if they need one
52+ func (h * eppHandle ) Context () context.Context {
53+ return h .ctx
54+ }
55+
4856// Plugins returns the sub-handle for working with instantiated plugins
4957func (h * eppHandle ) Plugins () plugins.HandlePlugins {
5058 return h .plugins
@@ -79,8 +87,9 @@ func (h *eppHandlePlugins) GetAllPluginsWithNames() map[string]plugins.Plugin {
7987 return h .thePlugins
8088}
8189
82- func newEppHandle () * eppHandle {
90+ func newEppHandle (ctx context. Context ) * eppHandle {
8391 return & eppHandle {
92+ ctx : ctx ,
8493 plugins : & eppHandlePlugins {
8594 thePlugins : map [string ]plugins.Plugin {},
8695 },
Original file line number Diff line number Diff line change @@ -16,6 +16,8 @@ limitations under the License.
1616
1717package plugins
1818
19+ import "context"
20+
1921// Plugin defines the interface for a plugin.
2022// This interface should be embedded in all plugins across the code.
2123type Plugin interface {
@@ -27,6 +29,9 @@ type Plugin interface {
2729
2830// Handle provides plugins a set of standard data and tools to work with
2931type Handle interface {
32+ // Context returns a context the plugins can use, if they need one
33+ Context () context.Context
34+
3035 // Plugins returns the sub-handle for working with instantiated plugins
3136 Plugins () HandlePlugins
3237}
Original file line number Diff line number Diff line change @@ -16,13 +16,23 @@ limitations under the License.
1616
1717package utils
1818
19- import "sigs.k8s.io/gateway-api-inference-extension/pkg/epp/plugins"
19+ import (
20+ "context"
21+
22+ "sigs.k8s.io/gateway-api-inference-extension/pkg/epp/plugins"
23+ )
2024
2125// testHandle is an implmentation of plugins.Handle for test purposes
2226type testHandle struct {
27+ ctx context.Context
2328 plugins plugins.HandlePlugins
2429}
2530
31+ // Context returns a context the plugins can use, if they need one
32+ func (h * testHandle ) Context () context.Context {
33+ return h .ctx
34+ }
35+
2636func (h * testHandle ) Plugins () plugins.HandlePlugins {
2737 return h .plugins
2838}
@@ -51,8 +61,9 @@ func (h *testHandlePlugins) GetAllPluginsWithNames() map[string]plugins.Plugin {
5161 return h .thePlugins
5262}
5363
54- func NewTestHandle () plugins.Handle {
64+ func NewTestHandle (ctx context. Context ) plugins.Handle {
5565 return & testHandle {
66+ ctx : ctx ,
5667 plugins : & testHandlePlugins {
5768 thePlugins : map [string ]plugins.Plugin {},
5869 },
You can’t perform that action at this time.
0 commit comments