diff --git a/pkg/server/server.go b/pkg/server/server.go index 2ca3bcba4..7e7cffaa1 100644 --- a/pkg/server/server.go +++ b/pkg/server/server.go @@ -228,6 +228,10 @@ func NewServer(ctx *options.ControllerContext, requestHeaderCaFile, clientCaFile }) } + for _, handler := range ctx.ExtraHandlers { + h = handler(h) + } + serverhelper.HandleRoute(s.handler, "/", h) return s, nil diff --git a/pkg/setup/options/controller_context.go b/pkg/setup/options/controller_context.go index 3da90294f..cabf1455e 100644 --- a/pkg/setup/options/controller_context.go +++ b/pkg/setup/options/controller_context.go @@ -2,6 +2,7 @@ package options import ( "context" + "net/http" servertypes "github.com/loft-sh/vcluster/pkg/server/types" "k8s.io/apimachinery/pkg/util/sets" @@ -26,4 +27,7 @@ type ControllerContext struct { AdditionalServerFilters []servertypes.Filter Options *VirtualClusterOptions StopChan <-chan struct{} + + //set of extra services that should handle the traffic or pass it along + ExtraHandlers []func(http.Handler) http.Handler }