Merge pull request #3319 from yuswift/remove_http1.1_support_code

remove http1.1 support code
This commit is contained in:
KubeSphere CI Bot
2021-02-04 22:07:46 +08:00
committed by GitHub
2 changed files with 4 additions and 52 deletions

View File

@@ -26,7 +26,6 @@ import (
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/util/httpstream"
"k8s.io/apimachinery/pkg/util/net"
"k8s.io/apimachinery/pkg/util/proxy"
"k8s.io/apiserver/pkg/endpoints/handlers/responsewriters"
"k8s.io/client-go/rest"
@@ -201,21 +200,6 @@ func (c *clusterDispatch) getInnerCluster(name string) *innerCluster {
return nil
}
// copy from https://github.com/kubernetes/apimachinery/blob/master/pkg/util/proxy/dial.go
func supportsHTTP11(nextProtos []string) bool {
if len(nextProtos) == 0 {
return true
}
for _, proto := range nextProtos {
if proto == "http/1.1" {
return true
}
}
return false
}
func (c *clusterDispatch) updateInnerClusters(obj interface{}) {
cluster := obj.(*clusterv1alpha1.Cluster)
@@ -250,14 +234,6 @@ func (c *clusterDispatch) updateInnerClusters(obj interface{}) {
return
}
tlsConfig, err := net.TLSClientConfig(transport)
if err == nil {
// since http2 doesn't support websocket, we need to disable http2 when using websocket
if supportsHTTP11(tlsConfig.NextProtos) {
tlsConfig.NextProtos = []string{"http/1.1"}
}
}
c.mutex.Lock()
c.innerClusters[cluster.Name] = &innerCluster{
kubernetesURL: kubernetesEndpoint,