...

Package iptables

import "k8s.io/kubernetes/pkg/proxy/iptables"
Overview
Index

Overview ▾

Index ▾

func CleanupLeftovers(ipt utiliptables.Interface) (encounteredError bool)
func NewDualStackProxier(ipt [2]utiliptables.Interface, sysctl utilsysctl.Interface, exec utilexec.Interface, syncPeriod time.Duration, minSyncPeriod time.Duration, masqueradeAll bool, localhostNodePorts bool, masqueradeBit int, localDetectors [2]proxyutiliptables.LocalTrafficDetector, hostname string, nodeIPs map[v1.IPFamily]net.IP, recorder events.EventRecorder, healthzServer *healthcheck.ProxierHealthServer, nodePortAddresses []string, initOnly bool) (proxy.Provider, error)
type Proxier
    func NewProxier(ipFamily v1.IPFamily, ipt utiliptables.Interface, sysctl utilsysctl.Interface, exec utilexec.Interface, syncPeriod time.Duration, minSyncPeriod time.Duration, masqueradeAll bool, localhostNodePorts bool, masqueradeBit int, localDetector proxyutiliptables.LocalTrafficDetector, hostname string, nodeIP net.IP, recorder events.EventRecorder, healthzServer *healthcheck.ProxierHealthServer, nodePortAddressStrings []string, initOnly bool) (*Proxier, error)
    func (proxier *Proxier) OnEndpointSliceAdd(endpointSlice *discovery.EndpointSlice)
    func (proxier *Proxier) OnEndpointSliceDelete(endpointSlice *discovery.EndpointSlice)
    func (proxier *Proxier) OnEndpointSliceUpdate(_, endpointSlice *discovery.EndpointSlice)
    func (proxier *Proxier) OnEndpointSlicesSynced()
    func (proxier *Proxier) OnNodeAdd(node *v1.Node)
    func (proxier *Proxier) OnNodeDelete(node *v1.Node)
    func (proxier *Proxier) OnNodeSynced()
    func (proxier *Proxier) OnNodeUpdate(oldNode, node *v1.Node)
    func (proxier *Proxier) OnServiceAdd(service *v1.Service)
    func (proxier *Proxier) OnServiceCIDRsChanged(_ []string)
    func (proxier *Proxier) OnServiceDelete(service *v1.Service)
    func (proxier *Proxier) OnServiceSynced()
    func (proxier *Proxier) OnServiceUpdate(oldService, service *v1.Service)
    func (proxier *Proxier) Sync()
    func (proxier *Proxier) SyncLoop()

Package files

proxier.go

func CleanupLeftovers

func CleanupLeftovers(ipt utiliptables.Interface) (encounteredError bool)

CleanupLeftovers removes all iptables rules and chains created by the Proxier It returns true if an error was encountered. Errors are logged.

func NewDualStackProxier

func NewDualStackProxier(
    ipt [2]utiliptables.Interface,
    sysctl utilsysctl.Interface,
    exec utilexec.Interface,
    syncPeriod time.Duration,
    minSyncPeriod time.Duration,
    masqueradeAll bool,
    localhostNodePorts bool,
    masqueradeBit int,
    localDetectors [2]proxyutiliptables.LocalTrafficDetector,
    hostname string,
    nodeIPs map[v1.IPFamily]net.IP,
    recorder events.EventRecorder,
    healthzServer *healthcheck.ProxierHealthServer,
    nodePortAddresses []string,
    initOnly bool,
) (proxy.Provider, error)

NewDualStackProxier creates a MetaProxier instance, with IPv4 and IPv6 proxies.

type Proxier

Proxier is an iptables based proxy for connections between a localhost:lport and services that provide the actual backends.

type Proxier struct {
    // contains filtered or unexported fields
}

func NewProxier

func NewProxier(ipFamily v1.IPFamily,
    ipt utiliptables.Interface,
    sysctl utilsysctl.Interface,
    exec utilexec.Interface,
    syncPeriod time.Duration,
    minSyncPeriod time.Duration,
    masqueradeAll bool,
    localhostNodePorts bool,
    masqueradeBit int,
    localDetector proxyutiliptables.LocalTrafficDetector,
    hostname string,
    nodeIP net.IP,
    recorder events.EventRecorder,
    healthzServer *healthcheck.ProxierHealthServer,
    nodePortAddressStrings []string,
    initOnly bool,
) (*Proxier, error)

NewProxier returns a new Proxier given an iptables Interface instance. Because of the iptables logic, it is assumed that there is only a single Proxier active on a machine. An error will be returned if iptables fails to update or acquire the initial lock. Once a proxier is created, it will keep iptables up to date in the background and will not terminate if a particular iptables call fails.

func (*Proxier) OnEndpointSliceAdd

func (proxier *Proxier) OnEndpointSliceAdd(endpointSlice *discovery.EndpointSlice)

OnEndpointSliceAdd is called whenever creation of a new endpoint slice object is observed.

func (*Proxier) OnEndpointSliceDelete

func (proxier *Proxier) OnEndpointSliceDelete(endpointSlice *discovery.EndpointSlice)

OnEndpointSliceDelete is called whenever deletion of an existing endpoint slice object is observed.

func (*Proxier) OnEndpointSliceUpdate

func (proxier *Proxier) OnEndpointSliceUpdate(_, endpointSlice *discovery.EndpointSlice)

OnEndpointSliceUpdate is called whenever modification of an existing endpoint slice object is observed.

func (*Proxier) OnEndpointSlicesSynced

func (proxier *Proxier) OnEndpointSlicesSynced()

OnEndpointSlicesSynced is called once all the initial event handlers were called and the state is fully propagated to local cache.

func (*Proxier) OnNodeAdd

func (proxier *Proxier) OnNodeAdd(node *v1.Node)

OnNodeAdd is called whenever creation of new node object is observed.

func (*Proxier) OnNodeDelete

func (proxier *Proxier) OnNodeDelete(node *v1.Node)

OnNodeDelete is called whenever deletion of an existing node object is observed.

func (*Proxier) OnNodeSynced

func (proxier *Proxier) OnNodeSynced()

OnNodeSynced is called once all the initial event handlers were called and the state is fully propagated to local cache.

func (*Proxier) OnNodeUpdate

func (proxier *Proxier) OnNodeUpdate(oldNode, node *v1.Node)

OnNodeUpdate is called whenever modification of an existing node object is observed.

func (*Proxier) OnServiceAdd

func (proxier *Proxier) OnServiceAdd(service *v1.Service)

OnServiceAdd is called whenever creation of new service object is observed.

func (*Proxier) OnServiceCIDRsChanged

func (proxier *Proxier) OnServiceCIDRsChanged(_ []string)

OnServiceCIDRsChanged is called whenever a change is observed in any of the ServiceCIDRs, and provides complete list of service cidrs.

func (*Proxier) OnServiceDelete

func (proxier *Proxier) OnServiceDelete(service *v1.Service)

OnServiceDelete is called whenever deletion of an existing service object is observed.

func (*Proxier) OnServiceSynced

func (proxier *Proxier) OnServiceSynced()

OnServiceSynced is called once all the initial event handlers were called and the state is fully propagated to local cache.

func (*Proxier) OnServiceUpdate

func (proxier *Proxier) OnServiceUpdate(oldService, service *v1.Service)

OnServiceUpdate is called whenever modification of an existing service object is observed.

func (*Proxier) Sync

func (proxier *Proxier) Sync()

Sync is called to synchronize the proxier state to iptables as soon as possible.

func (*Proxier) SyncLoop

func (proxier *Proxier) SyncLoop()

SyncLoop runs periodic work. This is expected to run as a goroutine or as the main loop of the app. It does not return.