Documentation ¶
Index ¶
- type CreateRequest
- type CreateResponse
- type DefaultPortForwarder
- type ForwardedPort
- type IOStreams
- type Options
- type PortForwardPortSpec
- type PortForwardSpec
- type PortForwarder
- type Service
- func (s *Service) Create(ctx context.Context, gvk schema.GroupVersionKind, name string, ...) (CreateResponse, error)
- func (s *Service) Find(namespace string, gvk schema.GroupVersionKind, name string) ([]State, error)
- func (s *Service) Get(id string) (State, bool)
- func (s *Service) List(ctx context.Context) []State
- func (s *Service) Stop()
- func (s *Service) StopForwarder(id string)
- type ServiceOptions
- type State
- type States
- type Target
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateRequest ¶
type CreateRequest struct { Namespace string `json:"namespace"` APIVersion string `json:"apiVersion"` Kind string `json:"kind"` Name string `json:"name"` Ports []PortForwardPortSpec `json:"ports"` }
type CreateResponse ¶
type CreateResponse PortForwardSpec
type DefaultPortForwarder ¶
type DefaultPortForwarder struct {
IOStreams
}
func (*DefaultPortForwarder) ForwardPorts ¶
type ForwardedPort ¶
type IOStreams ¶
type IOStreams struct { // In think, os.Stdin In io.Reader // Out think, os.Stdout Out io.Writer // ErrOut think, os.Stderr ErrOut io.Writer }
IOStreams provides the standard names for iostreams. This is useful for embedding and for unit testing. Inconsistent and different names make it hard to read and review code
type Options ¶
type Options struct { Config *restclient.Config RESTClient rest.Interface Address []string Ports []string PortForwarder portForwarder StopChannel <-chan struct{} ReadyChannel chan struct{} PortsChannel chan []ForwardedPort }
Options contains all the options for running a port-forward <snip> from pkg/kubectl/cmd/portforward/portforward.go <snip>
type PortForwardPortSpec ¶
type PortForwardPortSpec struct { Remote uint16 `json:"remote"` Local uint16 `json:"local,omitempty"` }
PortForwardPortSpec describes a forwarded port.
type PortForwardSpec ¶
type PortForwardSpec struct { ID string `json:"id"` Status string `json:"status"` Message string `json:"message"` Ports []PortForwardPortSpec `json:"ports"` CreatedAt time.Time `json:"createdAt"` }
PortForwardSpec describes a port forward. TODO Merge with PortForwardState (GH#498)
type PortForwarder ¶
type PortForwarder interface { List(ctx context.Context) []State Get(id string) (State, bool) Create(ctx context.Context, gvk schema.GroupVersionKind, name string, namespace string, remotePort uint16) (CreateResponse, error) Find(namespace string, gvk schema.GroupVersionKind, name string) ([]State, error) Stop() StopForwarder(id string) }
PortForwarder allows querying active port-forwards
func Default ¶
func Default(ctx context.Context, client cluster.ClientInterface, objectStore store.Store) (PortForwarder, error)
Default create a port forward instance.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is a port forwarding service.
func New ¶
func New(ctx context.Context, opts ServiceOptions) *Service
New creates an instance of Service.
func (*Service) Create ¶
func (s *Service) Create(ctx context.Context, gvk schema.GroupVersionKind, name string, namespace string, remotePort uint16) (CreateResponse, error)
Create creates a new port forward for the specified object and remote port. Implements PortForwardInterface.
func (*Service) Stop ¶
func (s *Service) Stop()
Stop stops all forwarders. The portForwardService is invalid after calling stop.
func (*Service) StopForwarder ¶
StopForwarder stops an individual port forward specified by id. Implements PortForwardInterface.
type ServiceOptions ¶
type ServiceOptions struct { RESTClient rest.Interface Config *restclient.Config ObjectStore store.Store PortForwarder portForwarder }
ServiceOptions contains all the options for running a port-forward service
type State ¶
type State struct { ID string CreatedAt time.Time Ports []ForwardedPort Target Target Pod Target // contains filtered or unexported fields }
State describes a single port-forward's runtime state