Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
bb0eb3c3
Commit
bb0eb3c3
authored
Feb 03, 2017
by
Yu-Ju Hong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix CRI port forwarding
Websocket support was introduced #33684, which broke the CRI implementation. This change fixes it.
parent
ab794c61
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
1 deletion
+8
-1
websocket.go
pkg/kubelet/server/portforward/websocket.go
+7
-0
server.go
pkg/kubelet/server/streaming/server.go
+1
-1
No files found.
pkg/kubelet/server/portforward/websocket.go
View file @
bb0eb3c3
...
@@ -45,6 +45,8 @@ const (
...
@@ -45,6 +45,8 @@ const (
// options contains details about which streams are required for
// options contains details about which streams are required for
// port forwarding.
// port forwarding.
// All fields incldued in V4Options need to be expressed explicilty in the
// CRI (pkg/kubelet/api/{version}/runtime/api.proto) PortForwardRequest.
type
V4Options
struct
{
type
V4Options
struct
{
Ports
[]
int32
Ports
[]
int32
}
}
...
@@ -82,6 +84,11 @@ func NewV4Options(req *http.Request) (*V4Options, error) {
...
@@ -82,6 +84,11 @@ func NewV4Options(req *http.Request) (*V4Options, error) {
},
nil
},
nil
}
}
// BuildV4Options returns a V4Options based on the given information.
func
BuildV4Options
(
ports
[]
int32
)
(
*
V4Options
,
error
)
{
return
&
V4Options
{
Ports
:
ports
},
nil
}
// handleWebSocketStreams handles requests to forward ports to a pod via
// handleWebSocketStreams handles requests to forward ports to a pod via
// a PortForwarder. A pair of streams are created per port (DATA n,
// a PortForwarder. A pair of streams are created per port (DATA n,
// ERROR n+1). The associated port is written to each stream as a unsigned 16
// ERROR n+1). The associated port is written to each stream as a unsigned 16
...
...
pkg/kubelet/server/streaming/server.go
View file @
bb0eb3c3
...
@@ -302,7 +302,7 @@ func (s *server) servePortForward(req *restful.Request, resp *restful.Response)
...
@@ -302,7 +302,7 @@ func (s *server) servePortForward(req *restful.Request, resp *restful.Response)
return
return
}
}
portForwardOptions
,
err
:=
portforward
.
NewV4Options
(
req
.
Reques
t
)
portForwardOptions
,
err
:=
portforward
.
BuildV4Options
(
pf
.
Por
t
)
if
err
!=
nil
{
if
err
!=
nil
{
resp
.
WriteError
(
http
.
StatusBadRequest
,
err
)
resp
.
WriteError
(
http
.
StatusBadRequest
,
err
)
return
return
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment