mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-08 03:33:56 +00:00
Remove dashboard ui from apiserver & point /ui at kube-ui
This commit is contained in:
parent
b6b2d6df42
commit
78609986b9
@ -15,6 +15,6 @@ You should now be able to access it by visiting [localhost:8001](http://localhos
|
|||||||
You can also use other web servers to serve the contents of the www/app directory, as described [here](../www/README.md#serving-the-app-during-development).
|
You can also use other web servers to serve the contents of the www/app directory, as described [here](../www/README.md#serving-the-app-during-development).
|
||||||
|
|
||||||
### Running remotely
|
### Running remotely
|
||||||
When Kubernetes is deployed remotely, the api server deploys the UI. To access it, visit `/ui`, which redirects to `/api/v1/proxy/namespaces/default/services/kube-ui/#/dashboard/`, on your master server.
|
When Kubernetes is deployed remotely, the UI is deployed as a cluster addon. To access it, visit `/ui`, which redirects to `/api/v1/proxy/namespaces/default/services/kube-ui/#/dashboard/`, on your master server.
|
||||||
|
|
||||||
[]()
|
[]()
|
||||||
|
@ -20,13 +20,12 @@ import (
|
|||||||
"mime"
|
"mime"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/ui/data/dashboard"
|
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/ui/data/swagger"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/ui/data/swagger"
|
||||||
|
|
||||||
assetfs "github.com/elazarl/go-bindata-assetfs"
|
assetfs "github.com/elazarl/go-bindata-assetfs"
|
||||||
)
|
)
|
||||||
|
|
||||||
const dashboardPath = "/static/app/#/dashboard/"
|
const dashboardPath = "/api/v1/proxy/namespaces/default/services/kube-ui/#/dashboard/"
|
||||||
|
|
||||||
type MuxInterface interface {
|
type MuxInterface interface {
|
||||||
Handle(pattern string, handler http.Handler)
|
Handle(pattern string, handler http.Handler)
|
||||||
@ -40,22 +39,15 @@ func InstallSupport(mux MuxInterface, enableSwaggerSupport bool) {
|
|||||||
// makes it into all of our supported go versions.
|
// makes it into all of our supported go versions.
|
||||||
mime.AddExtensionType(".svg", "image/svg+xml")
|
mime.AddExtensionType(".svg", "image/svg+xml")
|
||||||
|
|
||||||
// Expose files in www/ on <host>/static/
|
// Redirect /ui to the kube-ui proxy path
|
||||||
fileServer := http.FileServer(&assetfs.AssetFS{
|
prefix := "/ui/"
|
||||||
Asset: dashboard.Asset,
|
|
||||||
AssetDir: dashboard.AssetDir,
|
|
||||||
Prefix: "www",
|
|
||||||
})
|
|
||||||
prefix := "/static/"
|
|
||||||
mux.Handle(prefix, http.StripPrefix(prefix, fileServer))
|
|
||||||
prefix = "/ui/"
|
|
||||||
mux.HandleFunc(prefix, func(w http.ResponseWriter, r *http.Request) {
|
mux.HandleFunc(prefix, func(w http.ResponseWriter, r *http.Request) {
|
||||||
http.Redirect(w, r, dashboardPath, http.StatusTemporaryRedirect)
|
http.Redirect(w, r, dashboardPath, http.StatusTemporaryRedirect)
|
||||||
})
|
})
|
||||||
|
|
||||||
if enableSwaggerSupport {
|
if enableSwaggerSupport {
|
||||||
// Expose files in third_party/swagger-ui/ on <host>/swagger-ui
|
// Expose files in third_party/swagger-ui/ on <host>/swagger-ui
|
||||||
fileServer = http.FileServer(&assetfs.AssetFS{
|
fileServer := http.FileServer(&assetfs.AssetFS{
|
||||||
Asset: swagger.Asset,
|
Asset: swagger.Asset,
|
||||||
AssetDir: swagger.AssetDir,
|
AssetDir: swagger.AssetDir,
|
||||||
Prefix: "third_party/swagger-ui",
|
Prefix: "third_party/swagger-ui",
|
||||||
|
Loading…
Reference in New Issue
Block a user