kubectlk8s.io/kubectl/pkg/cmd/portforward Index | Files

package portforward

import "k8s.io/kubectl/pkg/cmd/portforward"

Index

Functions

func NewCmdPortForward

func NewCmdPortForward(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

Types

type PortForwardOptions

type PortForwardOptions struct {
	Namespace     string
	PodName       string
	RESTClient    restclient.Interface
	Config        *restclient.Config
	PodClient     corev1client.PodsGetter
	Address       []string
	Ports         []string
	PortForwarder portForwarder
	StopChannel   chan struct{}
	ReadyChannel  chan struct{}
}

PortForwardOptions contains all the options for running the port-forward cli command.

func NewDefaultPortForwardOptions

func NewDefaultPortForwardOptions(streams genericiooptions.IOStreams) *PortForwardOptions

func (*PortForwardOptions) Complete

func (o *PortForwardOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, args []string) error

Complete completes all the required options for port-forward cmd.

func (PortForwardOptions) RunPortForward

func (o PortForwardOptions) RunPortForward() error

Deprecated: Use RunPortForwardContext instead, which allows canceling. RunPortForward implements all the necessary functionality for port-forward cmd.

func (PortForwardOptions) RunPortForwardContext

func (o PortForwardOptions) RunPortForwardContext(ctx context.Context) error

RunPortForwardContext implements all the necessary functionality for port-forward cmd. It ends portforwarding when an error is received from the backend, or an os.Interrupt signal is received, or the provided context is done.

func (PortForwardOptions) Validate

func (o PortForwardOptions) Validate() error

Validate validates all the required options for port-forward cmd.

Source Files

portforward.go

Version
v0.32.3 (latest)
Published
Mar 12, 2025
Platform
linux/amd64
Imports
26 packages
Last checked
6 days ago

Tools for package owners.