Merge pull request #1893 from crhym3/fix-1149-req-body

Replace custom ProxyServer (kubecfg/kubectl -proxy) with httputil.ReverseProxy
This commit is contained in:
Daniel Smith
2014-10-22 15:29:59 -07:00
8 changed files with 254 additions and 128 deletions

View File

@@ -138,7 +138,7 @@ func getFlagInt(cmd *cobra.Command, flag string) int {
return v
}
func getKubeClient(cmd *cobra.Command) *client.Client {
func getKubeConfig(cmd *cobra.Command) *client.Config {
config := &client.Config{}
var host string
@@ -184,6 +184,12 @@ func getKubeClient(cmd *cobra.Command) *client.Client {
// The API version (e.g. v1beta1), not the binary version.
config.Version = getFlagString(cmd, "api-version")
return config
}
func getKubeClient(cmd *cobra.Command) *client.Client {
config := getKubeConfig(cmd)
// The binary version.
matchVersion := getFlagBool(cmd, "match-server-version")

View File

@@ -32,7 +32,8 @@ 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 := kubectl.NewProxyServer(getFlagString(cmd, "www"), getKubeClient(cmd), port)
server, err := kubectl.NewProxyServer(getFlagString(cmd, "www"), getKubeConfig(cmd), port)
checkErr(err)
glog.Fatal(server.Serve())
},
}