diff --git a/staging/src/k8s.io/apiserver/pkg/util/wsstream/conn.go b/staging/src/k8s.io/apimachinery/pkg/util/httpstream/wsstream/conn.go similarity index 100% rename from staging/src/k8s.io/apiserver/pkg/util/wsstream/conn.go rename to staging/src/k8s.io/apimachinery/pkg/util/httpstream/wsstream/conn.go diff --git a/staging/src/k8s.io/apiserver/pkg/util/wsstream/conn_test.go b/staging/src/k8s.io/apimachinery/pkg/util/httpstream/wsstream/conn_test.go similarity index 100% rename from staging/src/k8s.io/apiserver/pkg/util/wsstream/conn_test.go rename to staging/src/k8s.io/apimachinery/pkg/util/httpstream/wsstream/conn_test.go diff --git a/staging/src/k8s.io/apiserver/pkg/util/wsstream/doc.go b/staging/src/k8s.io/apimachinery/pkg/util/httpstream/wsstream/doc.go similarity index 91% rename from staging/src/k8s.io/apiserver/pkg/util/wsstream/doc.go rename to staging/src/k8s.io/apimachinery/pkg/util/httpstream/wsstream/doc.go index 694ce81d20d..a1aa1688bd9 100644 --- a/staging/src/k8s.io/apiserver/pkg/util/wsstream/doc.go +++ b/staging/src/k8s.io/apimachinery/pkg/util/httpstream/wsstream/doc.go @@ -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" diff --git a/staging/src/k8s.io/apiserver/pkg/util/wsstream/stream.go b/staging/src/k8s.io/apimachinery/pkg/util/httpstream/wsstream/stream.go similarity index 100% rename from staging/src/k8s.io/apiserver/pkg/util/wsstream/stream.go rename to staging/src/k8s.io/apimachinery/pkg/util/httpstream/wsstream/stream.go diff --git a/staging/src/k8s.io/apiserver/pkg/util/wsstream/stream_test.go b/staging/src/k8s.io/apimachinery/pkg/util/httpstream/wsstream/stream_test.go similarity index 100% rename from staging/src/k8s.io/apiserver/pkg/util/wsstream/stream_test.go rename to staging/src/k8s.io/apimachinery/pkg/util/httpstream/wsstream/stream_test.go diff --git a/staging/src/k8s.io/apiserver/pkg/authentication/request/websocket/protocol.go b/staging/src/k8s.io/apiserver/pkg/authentication/request/websocket/protocol.go index 11afa84cbd0..ee8c89f5ced 100644 --- a/staging/src/k8s.io/apiserver/pkg/authentication/request/websocket/protocol.go +++ b/staging/src/k8s.io/apiserver/pkg/authentication/request/websocket/protocol.go @@ -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." diff --git a/staging/src/k8s.io/apiserver/pkg/endpoints/handlers/responsewriters/writers.go b/staging/src/k8s.io/apiserver/pkg/endpoints/handlers/responsewriters/writers.go index cf84e8e290e..acd8f0357aa 100644 --- a/staging/src/k8s.io/apiserver/pkg/endpoints/handlers/responsewriters/writers.go +++ b/staging/src/k8s.io/apiserver/pkg/endpoints/handlers/responsewriters/writers.go @@ -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" ) diff --git a/staging/src/k8s.io/apiserver/pkg/endpoints/handlers/watch.go b/staging/src/k8s.io/apiserver/pkg/endpoints/handlers/watch.go index 7d9372d967a..79cb11ca600 100644 --- a/staging/src/k8s.io/apiserver/pkg/endpoints/handlers/watch.go +++ b/staging/src/k8s.io/apiserver/pkg/endpoints/handlers/watch.go @@ -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 diff --git a/staging/src/k8s.io/apiserver/pkg/util/wsstream/legacy.go b/staging/src/k8s.io/apiserver/pkg/util/wsstream/legacy.go new file mode 100644 index 00000000000..61b4dd48927 --- /dev/null +++ b/staging/src/k8s.io/apiserver/pkg/util/wsstream/legacy.go @@ -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 diff --git a/staging/src/k8s.io/kubelet/pkg/cri/streaming/portforward/portforward.go b/staging/src/k8s.io/kubelet/pkg/cri/streaming/portforward/portforward.go index df0fe5a8e08..7aa668ca4dc 100644 --- a/staging/src/k8s.io/kubelet/pkg/cri/streaming/portforward/portforward.go +++ b/staging/src/k8s.io/kubelet/pkg/cri/streaming/portforward/portforward.go @@ -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 diff --git a/staging/src/k8s.io/kubelet/pkg/cri/streaming/portforward/websocket.go b/staging/src/k8s.io/kubelet/pkg/cri/streaming/portforward/websocket.go index cbedb5b6c98..3700a7e22ad 100644 --- a/staging/src/k8s.io/kubelet/pkg/cri/streaming/portforward/websocket.go +++ b/staging/src/k8s.io/kubelet/pkg/cri/streaming/portforward/websocket.go @@ -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 ( diff --git a/staging/src/k8s.io/kubelet/pkg/cri/streaming/remotecommand/httpstream.go b/staging/src/k8s.io/kubelet/pkg/cri/streaming/remotecommand/httpstream.go index 8c18b2e7247..92ab045d24b 100644 --- a/staging/src/k8s.io/kubelet/pkg/cri/streaming/remotecommand/httpstream.go +++ b/staging/src/k8s.io/kubelet/pkg/cri/streaming/remotecommand/httpstream.go @@ -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" diff --git a/staging/src/k8s.io/kubelet/pkg/cri/streaming/remotecommand/websocket.go b/staging/src/k8s.io/kubelet/pkg/cri/streaming/remotecommand/websocket.go index a81d2259bda..25900888522 100644 --- a/staging/src/k8s.io/kubelet/pkg/cri/streaming/remotecommand/websocket.go +++ b/staging/src/k8s.io/kubelet/pkg/cri/streaming/remotecommand/websocket.go @@ -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 ( diff --git a/vendor/modules.txt b/vendor/modules.txt index 9e91b72c714..ba6fe9cc31f 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -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