mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-05 23:47:50 +00:00
Make genericapiserver handler chain customizable
This commit is contained in:
committed by
deads2k
parent
7cfd0150e4
commit
68cee1d9ac
@@ -19,9 +19,7 @@ package routes
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/emicklei/go-restful"
|
||||
|
||||
"k8s.io/kubernetes/pkg/apiserver"
|
||||
"k8s.io/kubernetes/pkg/genericapiserver/mux"
|
||||
)
|
||||
|
||||
const dashboardPath = "/api/v1/proxy/namespaces/kube-system/services/kubernetes-dashboard"
|
||||
@@ -29,8 +27,8 @@ const dashboardPath = "/api/v1/proxy/namespaces/kube-system/services/kubernetes-
|
||||
// UIRediect redirects /ui to the kube-ui proxy path.
|
||||
type UIRedirect struct{}
|
||||
|
||||
func (r UIRedirect) Install(mux *apiserver.PathRecorderMux, c *restful.Container) {
|
||||
mux.HandleFunc("/ui/", func(w http.ResponseWriter, r *http.Request) {
|
||||
func (r UIRedirect) Install(c *mux.APIContainer) {
|
||||
c.NonSwaggerRoutes.HandleFunc("/ui/", func(w http.ResponseWriter, r *http.Request) {
|
||||
http.Redirect(w, r, dashboardPath, http.StatusTemporaryRedirect)
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user