package hostport
import "k8s.io/kubernetes/pkg/kubelet/network/hostport"
Index ¶
- func NewFakeIPTables() *fakeIPTables
- type HostPortManager
- type HostportSyncer
- type PodPortMapping
- type PortMapping
Functions ¶
func NewFakeIPTables ¶
func NewFakeIPTables() *fakeIPTables
Types ¶
type HostPortManager ¶
type HostPortManager interface { // Add implements port mappings. // id should be a unique identifier for a pod, e.g. podSandboxID. // podPortMapping is the associated port mapping information for the pod. // natInterfaceName is the interface that localhost used to talk to the given pod. Add(id string, podPortMapping *PodPortMapping, natInterfaceName string) error // Remove cleans up matching port mappings // Remove must be able to clean up port mappings without pod IP Remove(id string, podPortMapping *PodPortMapping) error }
HostPortManager is an interface for adding and removing hostport for a given pod sandbox.
func NewHostportManager ¶
func NewHostportManager(iptables utiliptables.Interface) HostPortManager
type HostportSyncer ¶
type HostportSyncer interface { // SyncHostports gathers all hostports on node and setup iptables rules to enable them. // On each invocation existing ports are synced and stale rules are deleted. SyncHostports(natInterfaceName string, activePodPortMappings []*PodPortMapping) error // OpenPodHostportsAndSync opens hostports for a new PodPortMapping, gathers all hostports on // node, sets up iptables rules enable them. On each invocation existing ports are synced and stale rules are deleted. // 'newPortMapping' must also be present in 'activePodPortMappings'. OpenPodHostportsAndSync(newPortMapping *PodPortMapping, natInterfaceName string, activePodPortMappings []*PodPortMapping) error }
HostportSyncer takes a list of PodPortMappings and implements hostport all at once
func NewHostportSyncer ¶
func NewHostportSyncer(iptables utiliptables.Interface) HostportSyncer
type PodPortMapping ¶
type PodPortMapping struct { Namespace string Name string PortMappings []*PortMapping HostNetwork bool IP net.IP }
PodPortMapping represents a pod's network state and associated container port mappings
func ConstructPodPortMapping ¶
func ConstructPodPortMapping(pod *v1.Pod, podIP net.IP) *PodPortMapping
ConstructPodPortMapping creates a PodPortMapping from the ports specified in the pod's containers.
type PortMapping ¶
type PortMapping struct { Name string HostPort int32 ContainerPort int32 Protocol v1.Protocol HostIP string }
PortMapping represents a network port in a container
Source Files ¶
fake_iptables.go hostport.go hostport_manager.go hostport_syncer.go
Directories ¶
Path | Synopsis |
---|---|
pkg/kubelet/network/hostport/testing |
- Version
- v1.8.1
- Published
- Oct 11, 2017
- Platform
- js/wasm
- Imports
- 13 packages
- Last checked
- 6 minutes ago –
Tools for package owners.