mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-13 13:55:41 +00:00
Merge pull request #118182 from seans3/wsstream-refactor
Refactor wsstream library from apiserver to apimachinery
This commit is contained in:
commit
056f3a56b8
@ -18,4 +18,4 @@ limitations under the License.
|
||||
// The Conn type allows callers to multiplex multiple read/write channels over
|
||||
// a single websocket. The Reader type allows an io.Reader to be copied over
|
||||
// a websocket channel as binary content.
|
||||
package wsstream // import "k8s.io/apiserver/pkg/util/wsstream"
|
||||
package wsstream // import "k8s.io/apimachinery/pkg/util/httpstream/wsstream"
|
@ -24,8 +24,8 @@ import (
|
||||
"strings"
|
||||
"unicode/utf8"
|
||||
|
||||
"k8s.io/apimachinery/pkg/util/httpstream/wsstream"
|
||||
"k8s.io/apiserver/pkg/authentication/authenticator"
|
||||
"k8s.io/apiserver/pkg/util/wsstream"
|
||||
)
|
||||
|
||||
const bearerProtocolPrefix = "base64url.bearer.authorization.k8s.io."
|
||||
|
@ -34,6 +34,7 @@ import (
|
||||
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/apimachinery/pkg/util/httpstream/wsstream"
|
||||
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
||||
"k8s.io/apiserver/pkg/audit"
|
||||
"k8s.io/apiserver/pkg/endpoints/handlers/negotiation"
|
||||
@ -42,7 +43,6 @@ import (
|
||||
"k8s.io/apiserver/pkg/registry/rest"
|
||||
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||
"k8s.io/apiserver/pkg/util/flushwriter"
|
||||
"k8s.io/apiserver/pkg/util/wsstream"
|
||||
"k8s.io/component-base/tracing"
|
||||
)
|
||||
|
||||
|
@ -30,12 +30,12 @@ import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/serializer/streaming"
|
||||
"k8s.io/apimachinery/pkg/util/httpstream/wsstream"
|
||||
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
||||
"k8s.io/apimachinery/pkg/watch"
|
||||
"k8s.io/apiserver/pkg/endpoints/handlers/negotiation"
|
||||
"k8s.io/apiserver/pkg/endpoints/metrics"
|
||||
apirequest "k8s.io/apiserver/pkg/endpoints/request"
|
||||
"k8s.io/apiserver/pkg/util/wsstream"
|
||||
)
|
||||
|
||||
// nothing will ever be sent down this channel
|
||||
|
59
staging/src/k8s.io/apiserver/pkg/util/wsstream/legacy.go
Normal file
59
staging/src/k8s.io/apiserver/pkg/util/wsstream/legacy.go
Normal file
@ -0,0 +1,59 @@
|
||||
/*
|
||||
Copyright 2023 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Deprecated: This WebSockets package under apiserver is no longer in use.
|
||||
// Please use the apimachinery version of the package at:
|
||||
//
|
||||
// k8s.io/apimachinery/pkg/util/httpstream/wsstream
|
||||
package wsstream
|
||||
|
||||
import apimachinerywsstream "k8s.io/apimachinery/pkg/util/httpstream/wsstream"
|
||||
|
||||
// Aliases for all exported symbols previously in "conn.go"
|
||||
const (
|
||||
ChannelWebSocketProtocol = apimachinerywsstream.ChannelWebSocketProtocol
|
||||
Base64ChannelWebSocketProtocol = apimachinerywsstream.Base64ChannelWebSocketProtocol
|
||||
)
|
||||
|
||||
type ChannelType = apimachinerywsstream.ChannelType
|
||||
|
||||
const (
|
||||
IgnoreChannel = apimachinerywsstream.IgnoreChannel
|
||||
ReadChannel = apimachinerywsstream.ReadChannel
|
||||
WriteChannel = apimachinerywsstream.WriteChannel
|
||||
ReadWriteChannel = apimachinerywsstream.ReadWriteChannel
|
||||
)
|
||||
|
||||
type ChannelProtocolConfig = apimachinerywsstream.ChannelProtocolConfig
|
||||
|
||||
var (
|
||||
IsWebSocketRequest = apimachinerywsstream.IsWebSocketRequest
|
||||
IgnoreReceives = apimachinerywsstream.IgnoreReceives
|
||||
NewDefaultChannelProtocols = apimachinerywsstream.NewDefaultChannelProtocols
|
||||
)
|
||||
|
||||
type Conn = apimachinerywsstream.Conn
|
||||
|
||||
var NewConn = apimachinerywsstream.NewConn
|
||||
|
||||
// Aliases for all exported symbols previously in "stream.go"
|
||||
type ReaderProtocolConfig = apimachinerywsstream.ReaderProtocolConfig
|
||||
|
||||
var NewDefaultReaderProtocols = apimachinerywsstream.NewDefaultReaderProtocols
|
||||
|
||||
type Reader = apimachinerywsstream.Reader
|
||||
|
||||
var NewReader = apimachinerywsstream.NewReader
|
@ -23,8 +23,8 @@ import (
|
||||
"time"
|
||||
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
"k8s.io/apimachinery/pkg/util/httpstream/wsstream"
|
||||
"k8s.io/apimachinery/pkg/util/runtime"
|
||||
"k8s.io/apiserver/pkg/util/wsstream"
|
||||
)
|
||||
|
||||
// PortForwarder knows how to forward content from a data stream to/from a port
|
||||
|
@ -31,9 +31,9 @@ import (
|
||||
|
||||
api "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
"k8s.io/apimachinery/pkg/util/httpstream/wsstream"
|
||||
"k8s.io/apimachinery/pkg/util/runtime"
|
||||
"k8s.io/apiserver/pkg/endpoints/responsewriter"
|
||||
"k8s.io/apiserver/pkg/util/wsstream"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -29,9 +29,9 @@ import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/util/httpstream"
|
||||
"k8s.io/apimachinery/pkg/util/httpstream/spdy"
|
||||
"k8s.io/apimachinery/pkg/util/httpstream/wsstream"
|
||||
remotecommandconsts "k8s.io/apimachinery/pkg/util/remotecommand"
|
||||
"k8s.io/apimachinery/pkg/util/runtime"
|
||||
"k8s.io/apiserver/pkg/util/wsstream"
|
||||
"k8s.io/client-go/tools/remotecommand"
|
||||
|
||||
"k8s.io/klog/v2"
|
||||
|
@ -21,9 +21,9 @@ import (
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"k8s.io/apimachinery/pkg/util/httpstream/wsstream"
|
||||
"k8s.io/apimachinery/pkg/util/runtime"
|
||||
"k8s.io/apiserver/pkg/endpoints/responsewriter"
|
||||
"k8s.io/apiserver/pkg/util/wsstream"
|
||||
)
|
||||
|
||||
const (
|
||||
|
2
vendor/modules.txt
vendored
2
vendor/modules.txt
vendored
@ -1386,6 +1386,7 @@ k8s.io/apimachinery/pkg/util/errors
|
||||
k8s.io/apimachinery/pkg/util/framer
|
||||
k8s.io/apimachinery/pkg/util/httpstream
|
||||
k8s.io/apimachinery/pkg/util/httpstream/spdy
|
||||
k8s.io/apimachinery/pkg/util/httpstream/wsstream
|
||||
k8s.io/apimachinery/pkg/util/intstr
|
||||
k8s.io/apimachinery/pkg/util/json
|
||||
k8s.io/apimachinery/pkg/util/jsonmergepatch
|
||||
@ -1572,7 +1573,6 @@ k8s.io/apiserver/pkg/util/openapi
|
||||
k8s.io/apiserver/pkg/util/proxy
|
||||
k8s.io/apiserver/pkg/util/shufflesharding
|
||||
k8s.io/apiserver/pkg/util/webhook
|
||||
k8s.io/apiserver/pkg/util/wsstream
|
||||
k8s.io/apiserver/pkg/util/x509metrics
|
||||
k8s.io/apiserver/pkg/warning
|
||||
k8s.io/apiserver/plugin/pkg/audit/buffered
|
||||
|
Loading…
Reference in New Issue
Block a user