Documentation ¶
Overview ¶
Description: This file has the package proxier.
Package proxier has helpers for creating proxier instances ¶
Description: This file has the package proxier.
Description: This file has the package proxier.
Index ¶
- Constants
- Variables
- func NewPortForwarder(ctx context.Context, k kubernetes.Interface, r *rest.Config, ...) (chan<- PortForwardRequest, <-chan struct{}, *worker, error)
- type CreatePortForwardRequest
- type DeletePortForwardRequest
- type PodInfo
- type PortForwardConnection
- type PortForwardRequest
- type PortForwardStatus
- type Proxier
- type ProxyOpts
- type ServiceInfo
- type ServiceStatus
Constants ¶
const PodKind = "Pod"
Variables ¶
var ( // ErrAlreadyExists is returned when we've already created a // port-forward for this service. This can happen when an update event // is recieved for a service that we've already created a port-forward // for. This should generally be ignored but may be useful to log a // warning about. ErrAlreadyExists = errors.New("already have a port-forward for this service") )
Contains error types that are returned by the port-forward worker.
Functions ¶
func NewPortForwarder ¶
func NewPortForwarder(ctx context.Context, k kubernetes.Interface, r *rest.Config, log logrus.FieldLogger, opts *ProxyOpts) (chan<- PortForwardRequest, <-chan struct{}, *worker, error)
NewPortForwarder creates a new port-forward worker that handles creating port-forwards and destroying port-forwards.
nolint:gocritic,golint,revive // Why: It's by design that we're returning an unexported type.
Types ¶
type CreatePortForwardRequest ¶
type CreatePortForwardRequest struct { // Service is the service this port-forward implements. Service ServiceInfo // Hostnames are the DNS entries to inject into our host's DNS // for this port-forward. This will be attached to the IP that // is created for this service. Hostnames []string // Ports are the ports this port-forward exposes Ports []string // Endpoint is the specific pod to use for this service. Endpoint *PodInfo // Recreate specifies if this should be recreated if it already // exists Recreate bool RecreateReason string }
CreatePortForwardRequest is a request to create port-forward
type DeletePortForwardRequest ¶
type DeletePortForwardRequest struct { // Service is the service that should delete being port-forwarded Service ServiceInfo // IsShuttingDown denotes if the entire process is shutting down as // opposed to a single port-forward, or group, being deleted. IsShuttingDown bool }
DeletePortForwardRequest is a request to delete a port-forward
type PodInfo ¶
type PortForwardConnection ¶
type PortForwardConnection struct { Service ServiceInfo Pod PodInfo Status PortForwardStatus StatusReason string // IP that this port-forward allocates IP netip.Addr Hostnames []string // Ports is a local -> remote port list Ports []string // contains filtered or unexported fields }
PortForwardConnection is a port-forward that is managed by the port-forward worker.
type PortForwardRequest ¶
type PortForwardRequest struct { DeletePortForwardRequest *DeletePortForwardRequest CreatePortForwardRequest *CreatePortForwardRequest }
PortForwardRequest is a port-forward request, the non-nil struct is the type of request this is. There should only ever be one non-nil struct.
type PortForwardStatus ¶
type PortForwardStatus string
var ( PortForwardStatusRunning PortForwardStatus = "running" PortForwardStatusRecreating PortForwardStatus = "recreating" PortForwardStatusWaiting PortForwardStatus = "waiting" )
type Proxier ¶
type Proxier struct {
// contains filtered or unexported fields
}
Proxier handles creating an maintaining proxies to a remote Kubernetes service
func NewProxier ¶
func NewProxier(ctx context.Context, k kubernetes.Interface, kconf *rest.Config, log logrus.FieldLogger, opts *ProxyOpts) (*Proxier, error)
NewProxier creates a new proxier instance
type ServiceInfo ¶
type ServiceInfo struct { // Name is the name of this service Name string // Namespace is the namespace of this service Namespace string }
func (*ServiceInfo) Key ¶
func (s *ServiceInfo) Key() string
type ServiceStatus ¶
type ServiceStatus struct { ServiceInfo ServiceInfo Endpoint PodInfo // Statuses is dependent on the number of tunnels that exist for this // connection. Generally this is one, since a service is usually one // connection. Currently only one is supported, but in the future // certain services will have more than one. Statuses []PortForwardStatus // Reason is the reason that this service is in this status. // This is generally only set for services that are in a // non-running state. Reason string // IP is the IP address of this tunnel IP string // Ports are the ports this service is exposing Ports []string }