kubernetes: k8s.io/kubernetes/pkg/proxy/ipvs Index | Files | Directories

package ipvs

import "k8s.io/kubernetes/pkg/proxy/ipvs"


Package Files

graceful_termination.go ipset.go netlink.go netlink_linux.go proxier.go


const (

    // KubeFireWallChain is the kubernetes firewall chain.
    KubeFireWallChain utiliptables.Chain = "KUBE-FIREWALL"

    // KubeMarkMasqChain is the mark-for-masquerade chain
    KubeMarkMasqChain utiliptables.Chain = "KUBE-MARK-MASQ"

    // KubeNodePortChain is the kubernetes node port chain
    KubeNodePortChain utiliptables.Chain = "KUBE-NODE-PORT"

    // KubeMarkDropChain is the mark-for-drop chain
    KubeMarkDropChain utiliptables.Chain = "KUBE-MARK-DROP"

    // KubeForwardChain is the kubernetes forward chain
    KubeForwardChain utiliptables.Chain = "KUBE-FORWARD"

    // KubeLoadBalancerChain is the kubernetes chain for loadbalancer type service
    KubeLoadBalancerChain utiliptables.Chain = "KUBE-LOAD-BALANCER"

    // DefaultScheduler is the default ipvs scheduler algorithm - round robin.
    DefaultScheduler = "rr"

    // DefaultDummyDevice is the default dummy interface which ipvs service address will bind to it.
    DefaultDummyDevice = "kube-ipvs0"
const EntryInvalidErr = "error adding entry %s to ipset %s"

EntryInvalidErr indicates if an ipset entry is invalid or not

const (
    // MinIPSetCheckVersion is the min ipset version we need.  IPv6 is supported in ipset 6.x
    MinIPSetCheckVersion = "6.0"

func CanUseIPVSProxier Uses

func CanUseIPVSProxier(handle KernelHandler, ipsetver IPSetVersioner) (bool, error)

CanUseIPVSProxier returns true if we can use the ipvs Proxier. This is determined by checking if all the required kernel modules can be loaded. It may return an error if it fails to get the kernel modules information without error, in which case it will also return false.

func CleanupLeftovers Uses

func CleanupLeftovers(ipvs utilipvs.Interface, ipt utiliptables.Interface, ipset utilipset.Interface, cleanupIPVS bool) (encounteredError bool)

CleanupLeftovers clean up all ipvs and iptables rules created by ipvs Proxier.

func GetUniqueRSName Uses

func GetUniqueRSName(vs *utilipvs.VirtualServer, rs *utilipvs.RealServer) string

GetUniqueRSName return a string type unique rs name with vs information

type GracefulTerminationManager Uses

type GracefulTerminationManager struct {
    // contains filtered or unexported fields

GracefulTerminationManager manage rs graceful termination information and do graceful termination work rsList is the rs list to graceful termination, ipvs is the ipvsinterface to do ipvs delete/update work

func NewGracefulTerminationManager Uses

func NewGracefulTerminationManager(ipvs utilipvs.Interface) *GracefulTerminationManager

NewGracefulTerminationManager create a gracefulTerminationManager to manage ipvs rs graceful termination work

func (*GracefulTerminationManager) GracefulDeleteRS Uses

func (m *GracefulTerminationManager) GracefulDeleteRS(vs *utilipvs.VirtualServer, rs *utilipvs.RealServer) error

GracefulDeleteRS to update rs weight to 0, and add rs to graceful terminate list

func (*GracefulTerminationManager) InTerminationList Uses

func (m *GracefulTerminationManager) InTerminationList(uniqueRS string) bool

InTerminationList to check whether specified unique rs name is in graceful termination list

func (*GracefulTerminationManager) MoveRSOutofGracefulDeleteList Uses

func (m *GracefulTerminationManager) MoveRSOutofGracefulDeleteList(uniqueRS string) error

MoveRSOutofGracefulDeleteList to delete an rs and remove it from the rsList immediately

func (*GracefulTerminationManager) Run Uses

func (m *GracefulTerminationManager) Run()

Run start a goroutine to try to delete rs in the graceful delete rsList with an interval 1 minute

type IPGetter Uses

type IPGetter interface {
    NodeIPs() ([]net.IP, error)

IPGetter helps get node network interface IP

type IPSet Uses

type IPSet struct {
    // contains filtered or unexported fields

IPSet wraps util/ipset which is used by IPVS proxier.

func NewIPSet Uses

func NewIPSet(handle utilipset.Interface, name string, setType utilipset.Type, isIPv6 bool, comment string) *IPSet

NewIPSet initialize a new IPSet struct

type IPSetVersioner Uses

type IPSetVersioner interface {
    // returns "X.Y"
    GetVersion() (string, error)

IPSetVersioner can query the current ipset version.

type KernelHandler Uses

type KernelHandler interface {
    GetModules() ([]string, error)

KernelHandler can handle the current installed kernel modules.

type LinuxKernelHandler Uses

type LinuxKernelHandler struct {
    // contains filtered or unexported fields

LinuxKernelHandler implements KernelHandler interface.

func NewLinuxKernelHandler Uses

func NewLinuxKernelHandler() *LinuxKernelHandler

NewLinuxKernelHandler initializes LinuxKernelHandler with exec.

func (*LinuxKernelHandler) GetModules Uses

func (handle *LinuxKernelHandler) GetModules() ([]string, error)

GetModules returns all installed kernel modules.

type NetLinkHandle Uses

type NetLinkHandle interface {
    // EnsureAddressBind checks if address is bound to the interface and, if not, binds it.  If the address is already bound, return true.
    EnsureAddressBind(address, devName string) (exist bool, err error)
    // UnbindAddress unbind address from the interface
    UnbindAddress(address, devName string) error
    // EnsureDummyDevice checks if dummy device is exist and, if not, create one.  If the dummy device is already exist, return true.
    EnsureDummyDevice(devName string) (exist bool, err error)
    // DeleteDummyDevice deletes the given dummy device by name.
    DeleteDummyDevice(devName string) error
    // ListBindAddress will list all IP addresses which are bound in a given interface
    ListBindAddress(devName string) ([]string, error)
    // GetLocalAddresses returns all unique local type IP addresses based on specified device and filter device
    // If device is not specified, it will list all unique local type addresses except filter device addresses
    GetLocalAddresses(dev, filterDev string) (sets.String, error)

NetLinkHandle for revoke netlink interface

func NewNetLinkHandle Uses

func NewNetLinkHandle(isIPv6 bool) NetLinkHandle

NewNetLinkHandle will create a new NetLinkHandle

type Proxier Uses

type Proxier struct {
    // contains filtered or unexported fields

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

func NewProxier Uses

func NewProxier(ipt utiliptables.Interface,
    ipvs utilipvs.Interface,
    ipset utilipset.Interface,
    sysctl utilsysctl.Interface,
    exec utilexec.Interface,
    syncPeriod time.Duration,
    minSyncPeriod time.Duration,
    excludeCIDRs []string,
    strictARP bool,
    masqueradeAll bool,
    masqueradeBit int,
    clusterCIDR string,
    hostname string,
    nodeIP net.IP,
    recorder record.EventRecorder,
    healthzServer healthcheck.HealthzUpdater,
    scheduler string,
    nodePortAddresses []string,
) (*Proxier, error)

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

func (*Proxier) OnEndpointsAdd Uses

func (proxier *Proxier) OnEndpointsAdd(endpoints *v1.Endpoints)

OnEndpointsAdd is called whenever creation of new endpoints object is observed.

func (*Proxier) OnEndpointsDelete Uses

func (proxier *Proxier) OnEndpointsDelete(endpoints *v1.Endpoints)

OnEndpointsDelete is called whenever deletion of an existing endpoints object is observed.

func (*Proxier) OnEndpointsSynced Uses

func (proxier *Proxier) OnEndpointsSynced()

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

func (*Proxier) OnEndpointsUpdate Uses

func (proxier *Proxier) OnEndpointsUpdate(oldEndpoints, endpoints *v1.Endpoints)

OnEndpointsUpdate is called whenever modification of an existing endpoints object is observed.

func (*Proxier) OnServiceAdd Uses

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

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

func (*Proxier) OnServiceDelete Uses

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

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

func (*Proxier) OnServiceSynced Uses

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 Uses

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

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

func (*Proxier) Sync Uses

func (proxier *Proxier) Sync()

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

func (*Proxier) SyncLoop Uses

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.



Package ipvs imports 31 packages (graph) and is imported by 8 packages. Updated 2019-07-21. Refresh now. Tools for package owners.