Documentation ¶
Index ¶
- Constants
- func CanUseIPVSProxier(ipvs utilipvs.Interface, ipsetver IPSetVersioner, scheduler string) error
- func CleanupLeftovers(ipvs utilipvs.Interface, ipt utiliptables.Interface, ipset utilipset.Interface) (encounteredError bool)
- func GetUniqueRSName(vs *utilipvs.VirtualServer, rs *utilipvs.RealServer) string
- func NewDualStackProxier(ipt [2]utiliptables.Interface, ipvs utilipvs.Interface, ...) (proxy.Provider, error)
- type GracefulTerminationManager
- func (m *GracefulTerminationManager) GracefulDeleteRS(vs *utilipvs.VirtualServer, rs *utilipvs.RealServer) error
- func (m *GracefulTerminationManager) InTerminationList(uniqueRS string) bool
- func (m *GracefulTerminationManager) MoveRSOutofGracefulDeleteList(uniqueRS string) error
- func (m *GracefulTerminationManager) Run()
- type IPSet
- type IPSetVersioner
- type KernelHandler
- type LinuxKernelHandler
- type NetLinkHandle
- type Proxier
- 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) OnServiceDelete(service *v1.Service)
- func (proxier *Proxier) OnServiceSynced()
- func (proxier *Proxier) OnServiceUpdate(oldService, service *v1.Service)
- func (proxier *Proxier) Sync()
- func (proxier *Proxier) SyncLoop()
Constants ¶
const (
// MinIPSetCheckVersion is the min ipset version we need. IPv6 is supported in ipset 6.x
MinIPSetCheckVersion = "6.0"
)
Variables ¶
This section is empty.
Functions ¶
func CanUseIPVSProxier ¶
func CanUseIPVSProxier(ipvs utilipvs.Interface, ipsetver IPSetVersioner, scheduler string) error
CanUseIPVSProxier checks if we can use the ipvs Proxier. The ipset version and the scheduler are checked. If any virtual servers (VS) already exist with the configured scheduler, we just return. Otherwise we check if a dummy VS can be configured with the configured scheduler. Kernel modules will be loaded automatically if necessary.
func CleanupLeftovers ¶
func CleanupLeftovers(ipvs utilipvs.Interface, ipt utiliptables.Interface, ipset utilipset.Interface) (encounteredError bool)
CleanupLeftovers clean up all ipvs and iptables rules created by ipvs Proxier.
func GetUniqueRSName ¶ added in v1.11.5
func GetUniqueRSName(vs *utilipvs.VirtualServer, rs *utilipvs.RealServer) string
GetUniqueRSName return a string type unique rs name with vs information
func NewDualStackProxier ¶ added in v1.16.0
func NewDualStackProxier( ipt [2]utiliptables.Interface, ipvs utilipvs.Interface, ipset utilipset.Interface, sysctl utilsysctl.Interface, exec utilexec.Interface, syncPeriod time.Duration, minSyncPeriod time.Duration, excludeCIDRs []string, strictARP bool, tcpTimeout time.Duration, tcpFinTimeout time.Duration, udpTimeout time.Duration, masqueradeAll bool, masqueradeBit int, localDetectors [2]proxyutiliptables.LocalTrafficDetector, hostname string, nodeIP [2]net.IP, recorder events.EventRecorder, healthzServer healthcheck.ProxierHealthUpdater, scheduler string, nodePortAddresses []string, kernelHandler KernelHandler, ) (proxy.Provider, error)
NewDualStackProxier returns a new Proxier for dual-stack operation
Types ¶
type GracefulTerminationManager ¶ added in v1.11.5
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 ¶ added in v1.11.5
func NewGracefulTerminationManager(ipvs utilipvs.Interface) *GracefulTerminationManager
NewGracefulTerminationManager create a gracefulTerminationManager to manage ipvs rs graceful termination work
func (*GracefulTerminationManager) GracefulDeleteRS ¶ added in v1.11.5
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 ¶ added in v1.11.5
func (m *GracefulTerminationManager) InTerminationList(uniqueRS string) bool
InTerminationList to check whether specified unique rs name is in graceful termination list
func (*GracefulTerminationManager) MoveRSOutofGracefulDeleteList ¶ added in v1.11.5
func (m *GracefulTerminationManager) MoveRSOutofGracefulDeleteList(uniqueRS string) error
MoveRSOutofGracefulDeleteList to delete an rs and remove it from the rsList immediately
func (*GracefulTerminationManager) Run ¶ added in v1.11.5
func (m *GracefulTerminationManager) Run()
Run start a goroutine to try to delete rs in the graceful delete rsList with an interval 1 minute
type IPSetVersioner ¶ added in v1.9.0
IPSetVersioner can query the current ipset version.
type KernelHandler ¶ added in v1.10.0
KernelHandler can handle the current installed kernel modules.
type LinuxKernelHandler ¶ added in v1.10.0
type LinuxKernelHandler struct {
// contains filtered or unexported fields
}
LinuxKernelHandler implements KernelHandler interface.
func NewLinuxKernelHandler ¶ added in v1.10.0
func NewLinuxKernelHandler() *LinuxKernelHandler
NewLinuxKernelHandler initializes LinuxKernelHandler with exec.
func (*LinuxKernelHandler) GetKernelVersion ¶ added in v1.16.0
func (handle *LinuxKernelHandler) GetKernelVersion() (string, error)
GetKernelVersion returns currently running kernel version.
type NetLinkHandle ¶ added in v1.9.0
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) // GetAllLocalAddresses return all local addresses on the node. // Only the addresses of the current family are returned. // IPv6 link-local and loopback addresses are excluded. GetAllLocalAddresses() (sets.Set[string], error) // GetLocalAddresses return all local addresses for an interface. // Only the addresses of the current family are returned. // IPv6 link-local and loopback addresses are excluded. GetLocalAddresses(dev string) (sets.Set[string], error) // GetAllLocalAddressesExcept return all local addresses on the node, except from the passed dev. // This is not the same as to take the diff between GetAllLocalAddresses and GetLocalAddresses // since an address can be assigned to many interfaces. This problem raised // https://github.com/kubernetes/kubernetes/issues/114815 GetAllLocalAddressesExcept(dev string) (sets.Set[string], error) }
NetLinkHandle for revoke netlink interface
func NewNetLinkHandle ¶ added in v1.9.0
func NewNetLinkHandle(isIPv6 bool) NetLinkHandle
NewNetLinkHandle will create a new NetLinkHandle
type Proxier ¶
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 ¶
func NewProxier(ipFamily v1.IPFamily, 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, tcpTimeout time.Duration, tcpFinTimeout time.Duration, udpTimeout time.Duration, masqueradeAll bool, masqueradeBit int, localDetector proxyutiliptables.LocalTrafficDetector, hostname string, nodeIP net.IP, recorder events.EventRecorder, healthzServer healthcheck.ProxierHealthUpdater, scheduler string, nodePortAddressStrings []string, kernelHandler KernelHandler, ) (*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) OnEndpointSliceAdd ¶ added in v1.16.0
func (proxier *Proxier) OnEndpointSliceAdd(endpointSlice *discovery.EndpointSlice)
OnEndpointSliceAdd is called whenever creation of a new endpoint slice object is observed.
func (*Proxier) OnEndpointSliceDelete ¶ added in v1.16.0
func (proxier *Proxier) OnEndpointSliceDelete(endpointSlice *discovery.EndpointSlice)
OnEndpointSliceDelete is called whenever deletion of an existing endpoint slice object is observed.
func (*Proxier) OnEndpointSliceUpdate ¶ added in v1.16.0
func (proxier *Proxier) OnEndpointSliceUpdate(_, endpointSlice *discovery.EndpointSlice)
OnEndpointSliceUpdate is called whenever modification of an existing endpoint slice object is observed.
func (*Proxier) OnEndpointSlicesSynced ¶ added in v1.16.0
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 ¶ added in v1.17.0
OnNodeAdd is called whenever creation of new node object is observed.
func (*Proxier) OnNodeDelete ¶ added in v1.17.0
OnNodeDelete is called whenever deletion of an existing node object is observed.
func (*Proxier) OnNodeSynced ¶ added in v1.17.0
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 ¶ added in v1.17.0
OnNodeUpdate is called whenever modification of an existing node object is observed.
func (*Proxier) OnServiceAdd ¶
OnServiceAdd is called whenever creation of new service object is observed.
func (*Proxier) OnServiceDelete ¶
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 ¶
OnServiceUpdate is called whenever modification of an existing service object is observed.