mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-11 06:02:18 +00:00
Replace custom proxy with httputil.ReverseProxy for kubecfg/kubectl.
Fixes #1149 - kubecfg proxy "411 Length Required" error on POST/PUT.
This commit is contained in:
@@ -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
|
||||
@@ -183,6 +183,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")
|
||||
|
||||
|
@@ -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())
|
||||
},
|
||||
}
|
||||
|
Reference in New Issue
Block a user