File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed
Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -22,15 +22,16 @@ func NewMux(config MuxConfig) (*http.ServeMux, error) {
2222 if proxy .Transport , err = rest .TransportFor (config .KubernetesConfig ); err != nil { // rest.TransportFor provides the auth to the K8s API server.
2323 return nil , err
2424 }
25- if config .Middleware == nil {
26- config .Middleware = func (handler http.Handler ) http.Handler { return handler }
25+ var handler http.Handler = proxy
26+ if config .Middleware != nil {
27+ handler = config .Middleware (proxy )
2728 }
2829 mux := http .NewServeMux ()
2930 // TODO: add template features to specify routes.
30- mux .Handle ("/apis/ray.io/v1/" , config . Middleware ( proxy ) ) // forward KubeRay CR requests.
31+ mux .Handle ("/apis/ray.io/v1/" , handler ) // forward KubeRay CR requests.
3132 // TODO: add query filters to make sure only KubeRay events are queried.
32- mux .Handle ("/api/v1/namespaces/{namespace}/events" , config . Middleware ( proxy ) ) // allow querying KubeRay CR events.
33+ mux .Handle ("/api/v1/namespaces/{namespace}/events" , handler ) // allow querying KubeRay CR events.
3334 // TODO: check whether the service belongs to KubeRay first.
34- mux .Handle ("/api/v1/namespaces/{namespace}/services/{service}/proxy" , config . Middleware ( proxy ) ) // allow accessing KubeRay dashboards and job submissions.
35+ mux .Handle ("/api/v1/namespaces/{namespace}/services/{service}/proxy" , handler ) // allow accessing KubeRay dashboards and job submissions.
3536 return mux , nil
3637}
You can’t perform that action at this time.
0 commit comments