mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-10-31 10:18:13 +00:00 
			
		
		
		
	Merge pull request #40951 from yujuhong/fix_cri_portforward
Automatic merge from submit-queue (batch tested with PRs 40930, 40951) Fix CRI port forwarding Websocket support was introduced #33684, which broke the CRI implementation. This change fixes it.
This commit is contained in:
		| @@ -45,6 +45,8 @@ const ( | ||||
|  | ||||
| // options contains details about which streams are required for | ||||
| // 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 { | ||||
| 	Ports []int32 | ||||
| } | ||||
| @@ -82,6 +84,11 @@ func NewV4Options(req *http.Request) (*V4Options, error) { | ||||
| 	}, 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 | ||||
| // 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 | ||||
|   | ||||
| @@ -302,7 +302,7 @@ func (s *server) servePortForward(req *restful.Request, resp *restful.Response) | ||||
| 		return | ||||
| 	} | ||||
|  | ||||
| 	portForwardOptions, err := portforward.NewV4Options(req.Request) | ||||
| 	portForwardOptions, err := portforward.BuildV4Options(pf.Port) | ||||
| 	if err != nil { | ||||
| 		resp.WriteError(http.StatusBadRequest, err) | ||||
| 		return | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Kubernetes Submit Queue
					Kubernetes Submit Queue