mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-29 21:29:24 +00:00
Merge pull request #10077 from timstclair/ui-server
Move dashboard UI out of the apiserver to a separate pod
This commit is contained in:
9
pkg/ui/data/README.md
Normal file
9
pkg/ui/data/README.md
Normal 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.
|
||||
|
||||
|
||||
[]()
|
||||
5004
pkg/ui/data/dashboard/datafile.go
Normal file
5004
pkg/ui/data/dashboard/datafile.go
Normal file
File diff suppressed because one or more lines are too long
17091
pkg/ui/data/swagger/datafile.go
Normal file
17091
pkg/ui/data/swagger/datafile.go
Normal file
File diff suppressed because one or more lines are too long
21793
pkg/ui/datafile.go
21793
pkg/ui/datafile.go
File diff suppressed because one or more lines are too long
@@ -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
|
||||
|
||||
@@ -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))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user