Skip to content

Commit

Permalink
Remove dashboard ui from apiserver & point /ui at kube-ui
Browse files Browse the repository at this point in the history
  • Loading branch information
tallclair committed Jul 1, 2015
1 parent b6b2d6d commit 7860998
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
4 changes: 2 additions & 2 deletions docs/ui.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)]()
16 changes: 4 additions & 12 deletions pkg/ui/installsupport.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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",
Expand Down

0 comments on commit 7860998

Please sign in to comment.