mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 12:18:16 +00:00 
			
		
		
		
	Update the UX, add documentation.
This commit is contained in:
		
							
								
								
									
										23
									
								
								Godeps/_workspace/src/github.com/elazarl/go-bindata-assetfs/LICENSE
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								Godeps/_workspace/src/github.com/elazarl/go-bindata-assetfs/LICENSE
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,23 @@
 | 
			
		||||
Copyright (c) 2014, Elazar Leibovich
 | 
			
		||||
All rights reserved.
 | 
			
		||||
 | 
			
		||||
Redistribution and use in source and binary forms, with or without
 | 
			
		||||
modification, are permitted provided that the following conditions are met:
 | 
			
		||||
 | 
			
		||||
* Redistributions of source code must retain the above copyright notice, this
 | 
			
		||||
  list of conditions and the following disclaimer.
 | 
			
		||||
 | 
			
		||||
* Redistributions in binary form must reproduce the above copyright notice,
 | 
			
		||||
  this list of conditions and the following disclaimer in the documentation
 | 
			
		||||
  and/or other materials provided with the distribution.
 | 
			
		||||
 | 
			
		||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 | 
			
		||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 | 
			
		||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 | 
			
		||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
 | 
			
		||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 | 
			
		||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 | 
			
		||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 | 
			
		||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 | 
			
		||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 | 
			
		||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
							
								
								
									
										18
									
								
								Godeps/_workspace/src/github.com/elazarl/go-bindata-assetfs/README.md
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								Godeps/_workspace/src/github.com/elazarl/go-bindata-assetfs/README.md
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,18 @@
 | 
			
		||||
go-bindata-http
 | 
			
		||||
===============
 | 
			
		||||
 | 
			
		||||
Serve embedded files from [jteeuwen/go-bindata](https://github.com/jteeuwen/go-bindata) with `net/http`.
 | 
			
		||||
 | 
			
		||||
[GoDoc](http://godoc.org/github.com/elazarl/go-bindata-assetfs)
 | 
			
		||||
 | 
			
		||||
After running
 | 
			
		||||
 | 
			
		||||
    $ go-bindata data/...
 | 
			
		||||
 | 
			
		||||
Use
 | 
			
		||||
 | 
			
		||||
     http.Handle("/",
 | 
			
		||||
        http.FileServer(
 | 
			
		||||
        &assetfs.AssetFS{Asset: Asset, AssetDir: AssetDir, Prefix: "data"}))
 | 
			
		||||
 | 
			
		||||
to serve files embedded from the `data` directory.
 | 
			
		||||
							
								
								
									
										141
									
								
								Godeps/_workspace/src/github.com/elazarl/go-bindata-assetfs/assetfs.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										141
									
								
								Godeps/_workspace/src/github.com/elazarl/go-bindata-assetfs/assetfs.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,141 @@
 | 
			
		||||
package assetfs
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"bytes"
 | 
			
		||||
	"errors"
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"io"
 | 
			
		||||
	"io/ioutil"
 | 
			
		||||
	"net/http"
 | 
			
		||||
	"os"
 | 
			
		||||
	"path"
 | 
			
		||||
	"path/filepath"
 | 
			
		||||
	"time"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// FakeFile implements os.FileInfo interface for a given path and size
 | 
			
		||||
type FakeFile struct {
 | 
			
		||||
	// Path is the path of this file
 | 
			
		||||
	Path string
 | 
			
		||||
	// Dir marks of the path is a directory
 | 
			
		||||
	Dir bool
 | 
			
		||||
	// Len is the length of the fake file, zero if it is a directory
 | 
			
		||||
	Len int64
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (f *FakeFile) Name() string {
 | 
			
		||||
	_, name := filepath.Split(f.Path)
 | 
			
		||||
	return name
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (f *FakeFile) Mode() os.FileMode {
 | 
			
		||||
	mode := os.FileMode(0644)
 | 
			
		||||
	if f.Dir {
 | 
			
		||||
		return mode | os.ModeDir
 | 
			
		||||
	}
 | 
			
		||||
	return mode
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (f *FakeFile) ModTime() time.Time {
 | 
			
		||||
	return time.Unix(0, 0)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (f *FakeFile) Size() int64 {
 | 
			
		||||
	return f.Len
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (f *FakeFile) IsDir() bool {
 | 
			
		||||
	return f.Mode().IsDir()
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (f *FakeFile) Sys() interface{} {
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// AssetFile implements http.File interface for a no-directory file with content
 | 
			
		||||
type AssetFile struct {
 | 
			
		||||
	*bytes.Reader
 | 
			
		||||
	io.Closer
 | 
			
		||||
	FakeFile
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func NewAssetFile(name string, content []byte) *AssetFile {
 | 
			
		||||
	return &AssetFile{
 | 
			
		||||
		bytes.NewReader(content),
 | 
			
		||||
		ioutil.NopCloser(nil),
 | 
			
		||||
		FakeFile{name, false, int64(len(content))}}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (f *AssetFile) Readdir(count int) ([]os.FileInfo, error) {
 | 
			
		||||
	return nil, errors.New("not a directory")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (f *AssetFile) Stat() (os.FileInfo, error) {
 | 
			
		||||
	return f, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// AssetDirectory implements http.File interface for a directory
 | 
			
		||||
type AssetDirectory struct {
 | 
			
		||||
	AssetFile
 | 
			
		||||
	ChildrenRead int
 | 
			
		||||
	Children     []os.FileInfo
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func NewAssetDirectory(name string, children []string, fs *AssetFS) *AssetDirectory {
 | 
			
		||||
	fileinfos := make([]os.FileInfo, 0, len(children))
 | 
			
		||||
	for _, child := range children {
 | 
			
		||||
		_, err := fs.AssetDir(filepath.Join(name, child))
 | 
			
		||||
		fileinfos = append(fileinfos, &FakeFile{child, err == nil, 0})
 | 
			
		||||
	}
 | 
			
		||||
	return &AssetDirectory{
 | 
			
		||||
		AssetFile{
 | 
			
		||||
			bytes.NewReader(nil),
 | 
			
		||||
			ioutil.NopCloser(nil),
 | 
			
		||||
			FakeFile{name, true, 0},
 | 
			
		||||
		},
 | 
			
		||||
		0,
 | 
			
		||||
		fileinfos}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (f *AssetDirectory) Readdir(count int) ([]os.FileInfo, error) {
 | 
			
		||||
	fmt.Println(f, count)
 | 
			
		||||
	if count <= 0 {
 | 
			
		||||
		return f.Children, nil
 | 
			
		||||
	}
 | 
			
		||||
	if f.ChildrenRead+count > len(f.Children) {
 | 
			
		||||
		count = len(f.Children) - f.ChildrenRead
 | 
			
		||||
	}
 | 
			
		||||
	rv := f.Children[f.ChildrenRead : f.ChildrenRead+count]
 | 
			
		||||
	f.ChildrenRead += count
 | 
			
		||||
	return rv, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (f *AssetDirectory) Stat() (os.FileInfo, error) {
 | 
			
		||||
	return f, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// AssetFS implements http.FileSystem, allowing
 | 
			
		||||
// embedded files to be served from net/http package.
 | 
			
		||||
type AssetFS struct {
 | 
			
		||||
	// Asset should return content of file in path if exists
 | 
			
		||||
	Asset func(path string) ([]byte, error)
 | 
			
		||||
	// AssetDir should return list of files in the path
 | 
			
		||||
	AssetDir func(path string) ([]string, error)
 | 
			
		||||
	// Prefix would be prepended to http requests
 | 
			
		||||
	Prefix string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (fs *AssetFS) Open(name string) (http.File, error) {
 | 
			
		||||
	name = path.Join(fs.Prefix, name)
 | 
			
		||||
	if len(name) > 0 && name[0] == '/' {
 | 
			
		||||
		name = name[1:]
 | 
			
		||||
	}
 | 
			
		||||
	if children, err := fs.AssetDir(name); err == nil {
 | 
			
		||||
		return NewAssetDirectory(name, children, fs), nil
 | 
			
		||||
	}
 | 
			
		||||
	b, err := fs.Asset(name)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
	return NewAssetFile(name, b), nil
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										13
									
								
								Godeps/_workspace/src/github.com/elazarl/go-bindata-assetfs/doc.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								Godeps/_workspace/src/github.com/elazarl/go-bindata-assetfs/doc.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,13 @@
 | 
			
		||||
// assetfs allows packages to serve static content embedded
 | 
			
		||||
// with the go-bindata tool with the standard net/http package.
 | 
			
		||||
//
 | 
			
		||||
// See https://github.com/jteeuwen/go-bindata for more information
 | 
			
		||||
// about embedding binary data with go-bindata.
 | 
			
		||||
//
 | 
			
		||||
// Usage example, after running
 | 
			
		||||
//    $ go-bindata data/...
 | 
			
		||||
// use:
 | 
			
		||||
//     http.Handle("/",
 | 
			
		||||
//        http.FileServer(
 | 
			
		||||
//        &assetfs.AssetFS{Asset: Asset, AssetDir: AssetDir, Prefix: "data"}))
 | 
			
		||||
package assetfs
 | 
			
		||||
@@ -32,6 +32,7 @@ While the concepts and architecture in Kubernetes represent years of experience
 | 
			
		||||
* [Discussion and Community Support](#community-discussion-and-support)
 | 
			
		||||
* [Hacking on Kubernetes](#development)
 | 
			
		||||
* [Hacking on Kubernetes Salt configuration](docs/salt.md)
 | 
			
		||||
* [Kubernetes User Interface](docs/ux.md)
 | 
			
		||||
 | 
			
		||||
## Where to go next?
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -34,6 +34,7 @@ import (
 | 
			
		||||
	"github.com/GoogleCloudPlatform/kubernetes/pkg/cloudprovider"
 | 
			
		||||
	"github.com/GoogleCloudPlatform/kubernetes/pkg/master"
 | 
			
		||||
	"github.com/GoogleCloudPlatform/kubernetes/pkg/resources"
 | 
			
		||||
	"github.com/GoogleCloudPlatform/kubernetes/pkg/ui"
 | 
			
		||||
	"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
 | 
			
		||||
	"github.com/GoogleCloudPlatform/kubernetes/pkg/version/verflag"
 | 
			
		||||
	"github.com/golang/glog"
 | 
			
		||||
@@ -167,6 +168,7 @@ func main() {
 | 
			
		||||
	apiserver.NewAPIGroup(m.API_v1beta1()).InstallREST(mux, *apiPrefix+"/v1beta1")
 | 
			
		||||
	apiserver.NewAPIGroup(m.API_v1beta2()).InstallREST(mux, *apiPrefix+"/v1beta2")
 | 
			
		||||
	apiserver.InstallSupport(mux)
 | 
			
		||||
	ui.InstallSupport(mux)
 | 
			
		||||
 | 
			
		||||
	handler := http.Handler(mux)
 | 
			
		||||
	if len(corsAllowedOriginList) > 0 {
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2711
									
								
								pkg/ui/datafile.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2711
									
								
								pkg/ui/datafile.go
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										18
									
								
								pkg/ui/doc.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								pkg/ui/doc.go
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,18 @@
 | 
			
		||||
/*
 | 
			
		||||
Copyright 2014 Google Inc. All rights reserved.
 | 
			
		||||
 | 
			
		||||
Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
you may not use this file except in compliance with the License.
 | 
			
		||||
You may obtain a copy of the License at
 | 
			
		||||
 | 
			
		||||
    http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
 | 
			
		||||
Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
distributed under the License is distributed on an "AS IS" BASIS,
 | 
			
		||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
			
		||||
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
 | 
			
		||||
							
								
								
									
										34
									
								
								pkg/ui/www.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								pkg/ui/www.go
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,34 @@
 | 
			
		||||
/*
 | 
			
		||||
Copyright 2014 Google Inc. All rights reserved.
 | 
			
		||||
 | 
			
		||||
Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
you may not use this file except in compliance with the License.
 | 
			
		||||
You may obtain a copy of the License at
 | 
			
		||||
 | 
			
		||||
    http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
 | 
			
		||||
Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
distributed under the License is distributed on an "AS IS" BASIS,
 | 
			
		||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
			
		||||
See the License for the specific language governing permissions and
 | 
			
		||||
limitations under the License.
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
package ui
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"net/http"
 | 
			
		||||
 | 
			
		||||
	assetfs "github.com/elazarl/go-bindata-assetfs"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
const prefix = "/static/"
 | 
			
		||||
 | 
			
		||||
type MuxInterface interface {
 | 
			
		||||
	Handle(pattern string, handler http.Handler)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func InstallSupport(mux MuxInterface) {
 | 
			
		||||
	fileServer := http.FileServer(&assetfs.AssetFS{Asset: Asset, AssetDir: AssetDir, Prefix: "www"})
 | 
			
		||||
	mux.Handle(prefix, http.StripPrefix(prefix, fileServer))
 | 
			
		||||
}
 | 
			
		||||
@@ -16,7 +16,6 @@ limitations under the License.
 | 
			
		||||
<html ng-app="k8s">
 | 
			
		||||
  <head>
 | 
			
		||||
    <title>Kubernetes</title>
 | 
			
		||||
    <link rel="stylesheet" href="bootstrap.min.css">
 | 
			
		||||
    <link href='https://fonts.googleapis.com/css?family=Ubuntu%20Mono' rel='stylesheet' type='text/css'>
 | 
			
		||||
    <link href='https://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
 | 
			
		||||
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.25/angular.min.js"></script>
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user