remove_http1.1_support_code
Signed-off-by: yuswift <yuswiftli@yunify.com>
This commit is contained in:
@@ -18,24 +18,25 @@ package dispatch
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
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"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
"k8s.io/client-go/tools/clientcmd"
|
||||
"k8s.io/klog"
|
||||
|
||||
clusterv1alpha1 "kubesphere.io/kubesphere/pkg/apis/cluster/v1alpha1"
|
||||
"kubesphere.io/kubesphere/pkg/apiserver/request"
|
||||
clusterinformer "kubesphere.io/kubesphere/pkg/client/informers/externalversions/cluster/v1alpha1"
|
||||
clusterlister "kubesphere.io/kubesphere/pkg/client/listers/cluster/v1alpha1"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
"sync"
|
||||
)
|
||||
|
||||
const proxyURLFormat = "/api/v1/namespaces/kubesphere-system/services/:ks-apiserver:/proxy%s"
|
||||
@@ -198,21 +199,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)
|
||||
|
||||
@@ -247,14 +233,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,
|
||||
|
||||
Reference in New Issue
Block a user