Remove dashboard ui from apiserver & point /ui at kube-ui

This commit is contained in:
Tim St. Clair 2015-06-18 18:13:39 -07:00
parent b6b2d6df42
commit 78609986b9
2 changed files with 6 additions and 14 deletions

View File

@ -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.
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/ui.md?pixel)]()

View File

@ -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",