Documentation
¶
Index ¶
- func PortForward(req *Request, errChan chan<- error) (*portforward.PortForwarder, error)
- type Option
- type PodOption
- type Request
- type Result
- func WithForwarders(ctx context.Context, options []*Option, kubeconfigPath string, ...) (*Result, error)
- func WithForwardersEmbedConfig(ctx context.Context, options []*Option, kubeconfigBytes []byte, ...) (*Result, error)
- func WithRestConfig(ctx context.Context, options []*Option, config *restclient.Config, ...) (*Result, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PortForward ¶ added in v0.2.1
func PortForward(req *Request, errChan chan<- error) (*portforward.PortForwarder, error)
PortForward is to forward port, and return the forwarder.
Types ¶
type Option ¶
type Option struct {
LocalPort int // the local port for forwarding
RemotePort int // the remote port port for forwarding
Namespace string // the k8s namespace metadata
PodName string // the k8s pod metadata
ServiceName string // the k8s service metadata
Source string // the k8s source string, eg: svc/my-nginx-svc po/my-nginx-66b6c48dd5-ttdb2
}
type Request ¶ added in v0.2.1
type Request struct {
RestConfig *rest.Config // RestConfig is the kubernetes config
Pod v1.Pod // Pod is the selected pod for this port forwarding
LocalPort int // LocalPort is the local port that will be selected to expose the PodPort
PodPort int // PodPort is the target port for the pod
Streams genericclioptions.IOStreams // Steams configures where to write or read input from
StopCh <-chan struct{} // StopCh is the channel used to manage the port forward lifecycle
ReadyCh chan struct{} // ReadyCh communicates when the tunnel is ready to receive traffic
}
type Result ¶
type Result struct {
Close func() // close the port forwarding
Ready func() ([][]portforward.ForwardedPort, error) // block till the forwarding ready
Wait func() // block and listen IOStreams close signal
}
func WithForwarders ¶
func WithForwarders(ctx context.Context, options []*Option, kubeconfigPath string, errChan chan<- error) (*Result, error)
WithForwarders is to forward port for k8s cloud services
func WithForwardersEmbedConfig ¶
func WithForwardersEmbedConfig(ctx context.Context, options []*Option, kubeconfigBytes []byte, errChan chan<- error) (*Result, error)
WithForwardersEmbedConfig is to forward port with kubeconfig bytes
func WithRestConfig ¶
func WithRestConfig(ctx context.Context, options []*Option, config *restclient.Config, errChan chan<- error) (*Result, error)
WithRestConfig is to forward port for k8s cloud services
Click to show internal directories.
Click to hide internal directories.