kubernetes: k8s.io/kubernetes/pkg/kubelet/cri/streaming/portforward Index | Files

package portforward

import "k8s.io/kubernetes/pkg/kubelet/cri/streaming/portforward"

Package portforward contains server-side logic for handling port forwarding requests.


Package Files

constants.go httpstream.go portforward.go websocket.go


const ProtocolV1Name = "portforward.k8s.io"

ProtocolV1Name is the name of the subprotocol used for port forwarding.


var SupportedProtocols = []string{ProtocolV1Name}

SupportedProtocols are the supported port forwarding protocols.

func ServePortForward Uses

func ServePortForward(w http.ResponseWriter, req *http.Request, portForwarder PortForwarder, podName string, uid types.UID, portForwardOptions *V4Options, idleTimeout time.Duration, streamCreationTimeout time.Duration, supportedProtocols []string)

ServePortForward handles a port forwarding request. A single request is kept alive as long as the client is still alive and the connection has not been timed out due to idleness. This function handles multiple forwarded connections; i.e., multiple `curl http://localhost:8888/` requests will be handled by a single invocation of ServePortForward.

type PortForwarder Uses

type PortForwarder interface {
    // PortForwarder copies data between a data stream and a port in a pod.
    PortForward(name string, uid types.UID, port int32, stream io.ReadWriteCloser) error

PortForwarder knows how to forward content from a data stream to/from a port in a pod.

type V4Options Uses

type V4Options struct {
    Ports []int32

V4Options contains details about which streams are required for port forwarding. All fields included in V4Options need to be expressed explicitly in the CRI (k8s.io/cri-api/pkg/apis/{version}/api.proto) PortForwardRequest.

func BuildV4Options Uses

func BuildV4Options(ports []int32) (*V4Options, error)

BuildV4Options returns a V4Options based on the given information.

func NewV4Options Uses

func NewV4Options(req *http.Request) (*V4Options, error)

NewV4Options creates a new options from the Request.

Package portforward imports 17 packages (graph) and is imported by 3 packages. Updated 2020-05-23. Refresh now. Tools for package owners.