add utility for binding flags and building api server clients

This commit is contained in:
deads2k
2014-11-17 13:29:45 -05:00
parent ff1e9f4c19
commit 2dbfb80349
16 changed files with 764 additions and 190 deletions

View File

@@ -24,7 +24,7 @@ import (
"github.com/spf13/cobra"
)
func NewCmdProxy(out io.Writer) *cobra.Command {
func (f *Factory) NewCmdProxy(out io.Writer) *cobra.Command {
cmd := &cobra.Command{
Use: "proxy",
Short: "Run a proxy to the Kubernetes API server",
@@ -32,7 +32,11 @@ func NewCmdProxy(out io.Writer) *cobra.Command {
Run: func(cmd *cobra.Command, args []string) {
port := GetFlagInt(cmd, "port")
glog.Infof("Starting to serve on localhost:%d", port)
server, err := kubectl.NewProxyServer(GetFlagString(cmd, "www"), GetKubeConfig(cmd), port)
clientConfig, err := f.ClientBuilder.Config()
checkErr(err)
server, err := kubectl.NewProxyServer(GetFlagString(cmd, "www"), clientConfig, port)
checkErr(err)
glog.Fatal(server.Serve())
},