Remove dashboard ui from apiserver & point /ui at kube-ui
This commit is contained in:
parent
b6b2d6df42
commit
78609986b9
@ -12,9 +12,9 @@ kubectl proxy --www=www/app --www-prefix=/
|
||||
|
||||
You should now be able to access it by visiting [localhost:8001](http://localhost:8001/).
|
||||
|
||||
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
|
||||
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"
|
||||
"net/http"
|
||||
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/ui/data/dashboard"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/ui/data/swagger"
|
||||
|
||||
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 {
|
||||
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.
|
||||
mime.AddExtensionType(".svg", "image/svg+xml")
|
||||
|
||||
// Expose files in www/ on <host>/static/
|
||||
fileServer := http.FileServer(&assetfs.AssetFS{
|
||||
Asset: dashboard.Asset,
|
||||
AssetDir: dashboard.AssetDir,
|
||||
Prefix: "www",
|
||||
})
|
||||
prefix := "/static/"
|
||||
mux.Handle(prefix, http.StripPrefix(prefix, fileServer))
|
||||
prefix = "/ui/"
|
||||
// Redirect /ui to the kube-ui proxy path
|
||||
prefix := "/ui/"
|
||||
mux.HandleFunc(prefix, func(w http.ResponseWriter, r *http.Request) {
|
||||
http.Redirect(w, r, dashboardPath, http.StatusTemporaryRedirect)
|
||||
})
|
||||
|
||||
if enableSwaggerSupport {
|
||||
// Expose files in third_party/swagger-ui/ on <host>/swagger-ui
|
||||
fileServer = http.FileServer(&assetfs.AssetFS{
|
||||
fileServer := http.FileServer(&assetfs.AssetFS{
|
||||
Asset: swagger.Asset,
|
||||
AssetDir: swagger.AssetDir,
|
||||
Prefix: "third_party/swagger-ui",
|
||||
|
Loading…
Reference in New Issue
Block a user