Merge pull request #10077 from timstclair/ui-server

Move dashboard UI out of the apiserver to a separate pod
This commit is contained in:
Zach Loafman
2015-07-01 15:56:33 -07:00
15 changed files with 22303 additions and 21817 deletions

9
pkg/ui/data/README.md Normal file
View File

@@ -0,0 +1,9 @@
The datafiles contained in these directories were generated by the script
```sh
hack/build-ui.sh
```
Do not edit by hand.
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/pkg/ui/data/README.md?pixel)]()

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -14,5 +14,6 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
// package ui contains static data files compiled to go, and utilities for accessing them.
// package ui contains utilities for accessing the static data files compiled in
// the data/* subdirectories.
package ui

View File

@@ -20,10 +20,12 @@ import (
"mime"
"net/http"
"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)
@@ -37,18 +39,19 @@ 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: Asset, AssetDir: 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{Asset: Asset, AssetDir: AssetDir, Prefix: "third_party/swagger-ui"})
fileServer := http.FileServer(&assetfs.AssetFS{
Asset: swagger.Asset,
AssetDir: swagger.AssetDir,
Prefix: "third_party/swagger-ui",
})
prefix = "/swagger-ui/"
mux.Handle(prefix, http.StripPrefix(prefix, fileServer))
}