@@ -18,24 +18,25 @@ package dispatch
18
18
19
19
import (
20
20
"fmt"
21
+ "net/http"
22
+ "net/url"
23
+ "strings"
24
+ "sync"
25
+
21
26
corev1 "k8s.io/api/core/v1"
22
27
"k8s.io/apimachinery/pkg/api/errors"
23
28
"k8s.io/apimachinery/pkg/util/httpstream"
24
- "k8s.io/apimachinery/pkg/util/net"
25
29
"k8s.io/apimachinery/pkg/util/proxy"
26
30
"k8s.io/apiserver/pkg/endpoints/handlers/responsewriters"
27
31
"k8s.io/client-go/rest"
28
32
"k8s.io/client-go/tools/cache"
29
33
"k8s.io/client-go/tools/clientcmd"
30
34
"k8s.io/klog"
35
+
31
36
clusterv1alpha1 "kubesphere.io/kubesphere/pkg/apis/cluster/v1alpha1"
32
37
"kubesphere.io/kubesphere/pkg/apiserver/request"
33
38
clusterinformer "kubesphere.io/kubesphere/pkg/client/informers/externalversions/cluster/v1alpha1"
34
39
clusterlister "kubesphere.io/kubesphere/pkg/client/listers/cluster/v1alpha1"
35
- "net/http"
36
- "net/url"
37
- "strings"
38
- "sync"
39
40
)
40
41
41
42
const proxyURLFormat = "/api/v1/namespaces/kubesphere-system/services/:ks-apiserver:/proxy%s"
@@ -198,21 +199,6 @@ func (c *clusterDispatch) getInnerCluster(name string) *innerCluster {
198
199
return nil
199
200
}
200
201
201
- // copy from https://github.com/kubernetes/apimachinery/blob/master/pkg/util/proxy/dial.go
202
- func supportsHTTP11 (nextProtos []string ) bool {
203
- if len (nextProtos ) == 0 {
204
- return true
205
- }
206
-
207
- for _ , proto := range nextProtos {
208
- if proto == "http/1.1" {
209
- return true
210
- }
211
- }
212
-
213
- return false
214
- }
215
-
216
202
func (c * clusterDispatch ) updateInnerClusters (obj interface {}) {
217
203
cluster := obj .(* clusterv1alpha1.Cluster )
218
204
@@ -247,14 +233,6 @@ func (c *clusterDispatch) updateInnerClusters(obj interface{}) {
247
233
return
248
234
}
249
235
250
- tlsConfig , err := net .TLSClientConfig (transport )
251
- if err == nil {
252
- // since http2 doesn't support websocket, we need to disable http2 when using websocket
253
- if supportsHTTP11 (tlsConfig .NextProtos ) {
254
- tlsConfig .NextProtos = []string {"http/1.1" }
255
- }
256
- }
257
-
258
236
c .mutex .Lock ()
259
237
c .innerClusters [cluster .Name ] = & innerCluster {
260
238
kubernetesURL : kubernetesEndpoint ,
0 commit comments