Documentation ¶
Index ¶
- Constants
- func IsPortFree(t PortTunnel) bool
- type Annotations
- type ContainerPortSpec
- func (c ContainerPortSpec) Match(ann *PFAnn) bool
- func (c ContainerPortSpec) MatchSpec(s string) bool
- func (c ContainerPortSpec) Port() intstr.IntOrString
- func (c ContainerPortSpec) String() string
- func (c ContainerPortSpec) ToPFAnn() *PFAnn
- func (c ContainerPortSpec) ToTunnel(address string) PortTunnel
- type ContainerPortSpecs
- func (c ContainerPortSpecs) Dump() string
- func (c ContainerPortSpecs) Find(pf *PFAnn) (ContainerPortSpec, bool)
- func (c ContainerPortSpecs) Match(pf *PFAnn) bool
- func (c ContainerPortSpecs) MatchAnnotations(s string) PFAnns
- func (c ContainerPortSpecs) MatchSpec(s string) bool
- func (c ContainerPortSpecs) ToTunnels(address string) PortTunnels
- type PFAnn
- type PFAnns
- type PortChecker
- type PortTunnel
- type PortTunnels
Constants ¶
const ( // K9sAutoPortForwardKey represents an auto portforwards annotation. K9sAutoPortForwardsKey = "k9scli.io/auto-port-forwards" // K9sPortForwardKey represents a portforwards annotation. K9sPortForwardsKey = "k9scli.io/port-forwards" )
Variables ¶
This section is empty.
Functions ¶
func IsPortFree ¶
func IsPortFree(t PortTunnel) bool
Types ¶
type Annotations ¶
func (Annotations) PreferredPorts ¶
func (a Annotations) PreferredPorts(specs ContainerPortSpecs) (PFAnns, error)
type ContainerPortSpec ¶
ContainerPortSpec represents a container port specification.
func NewPortSpec ¶
func NewPortSpec(co, portName string, port int32) ContainerPortSpec
NewPortSpec returns a new instance.
func (ContainerPortSpec) Match ¶
func (c ContainerPortSpec) Match(ann *PFAnn) bool
Match checks if the container spec matches an annotation.
func (ContainerPortSpec) MatchSpec ¶
func (c ContainerPortSpec) MatchSpec(s string) bool
func (ContainerPortSpec) Port ¶
func (c ContainerPortSpec) Port() intstr.IntOrString
func (ContainerPortSpec) String ¶
func (c ContainerPortSpec) String() string
String dumps spec to string.
func (ContainerPortSpec) ToPFAnn ¶
func (c ContainerPortSpec) ToPFAnn() *PFAnn
func (ContainerPortSpec) ToTunnel ¶
func (c ContainerPortSpec) ToTunnel(address string) PortTunnel
type ContainerPortSpecs ¶
type ContainerPortSpecs []ContainerPortSpec
ContainerPortSpecs represents a container exposed ports.
func FromContainerPorts ¶
func FromContainerPorts(co string, pp []v1.ContainerPort) ContainerPortSpecs
FromContainerPorts hydrates from a pod container specification.
func (ContainerPortSpecs) Dump ¶
func (c ContainerPortSpecs) Dump() string
func (ContainerPortSpecs) Find ¶
func (c ContainerPortSpecs) Find(pf *PFAnn) (ContainerPortSpec, bool)
Find finds a matching container port.
func (ContainerPortSpecs) Match ¶
func (c ContainerPortSpecs) Match(pf *PFAnn) bool
Match checks if container ports match a pf annotation.
func (ContainerPortSpecs) MatchAnnotations ¶
func (c ContainerPortSpecs) MatchAnnotations(s string) PFAnns
func (ContainerPortSpecs) MatchSpec ¶
func (c ContainerPortSpecs) MatchSpec(s string) bool
InSpecs checks if given port matches a spec.
func (ContainerPortSpecs) ToTunnels ¶
func (c ContainerPortSpecs) ToTunnels(address string) PortTunnels
ToTunnels convert port specs to tunnels.
type PFAnn ¶
type PFAnn struct { Container string ContainerPort intstr.IntOrString LocalPort string // contains filtered or unexported fields }
PFAnn represents a portforward annotation value. Shape: container/portname|portNum:localPort
func ParsePlainPF ¶
func (*PFAnn) Match ¶
func (p *PFAnn) Match(ss ContainerPortSpecs) bool
Match checks if annotation matches any of the container ports.
type PFAnns ¶
type PFAnns []*PFAnn
PFAnns represents a collection of port forward annotations.
func (PFAnns) ToPortSpec ¶
func (aa PFAnns) ToPortSpec(pp ContainerPortSpecs) (string, string)
ToPortSpec returns a container port and local port definitions.
func (PFAnns) ToTunnels ¶
func (aa PFAnns) ToTunnels(address string, pp ContainerPortSpecs, available PortChecker) (PortTunnels, error)
type PortTunnel ¶
type PortTunnel struct {
Address, Container, LocalPort, ContainerPort string
}
PortTunnel represents a host tunnel port mapper.
func NewPortTunnel ¶
func NewPortTunnel(a, co, lp, cp string) PortTunnel
type PortTunnels ¶
type PortTunnels []PortTunnel
PortTunnels represents a collection of tunnels.
func ToTunnels ¶
func ToTunnels(address, specs, localPorts string) (PortTunnels, error)
func (PortTunnels) CheckAvailable ¶
func (t PortTunnels) CheckAvailable() error