Documentation ¶
Overview ¶
Package loadbalancer contains all logic related with the loadbalancer +groupName=pkg
Index ¶
- Constants
- Variables
- type Backend
- type BackendID
- type FEPortName
- type ID
- type L3n4Addr
- func (in *L3n4Addr) DeepCopy() *L3n4Addr
- func (in *L3n4Addr) DeepCopyInto(out *L3n4Addr)
- func (l *L3n4Addr) DeepEqual(o *L3n4Addr) bool
- func (a *L3n4Addr) GetModel() *models.FrontendAddress
- func (a L3n4Addr) Hash() string
- func (a *L3n4Addr) IsIPv6() bool
- func (a *L3n4Addr) String() string
- func (a *L3n4Addr) StringID() string
- func (a *L3n4Addr) StringWithProtocol() string
- type L3n4AddrID
- type L4Addr
- type L4Type
- type SVC
- type SVCTrafficPolicy
- type SVCType
- type ServiceFlags
- type ServiceID
- type SvcFlagParam
Constants ¶
const ( SVCTypeNone = SVCType("NONE") SVCTypeHostPort = SVCType("HostPort") SVCTypeClusterIP = SVCType("ClusterIP") SVCTypeNodePort = SVCType("NodePort") SVCTypeExternalIPs = SVCType("ExternalIPs") SVCTypeLoadBalancer = SVCType("LoadBalancer") SVCTypeLocalRedirect = SVCType("LocalRedirect") )
const ( SVCTrafficPolicyNone = SVCTrafficPolicy("NONE") SVCTrafficPolicyCluster = SVCTrafficPolicy("Cluster") SVCTrafficPolicyLocal = SVCTrafficPolicy("Local") )
const ( NONE = L4Type("NONE") // TCP type. TCP = L4Type("TCP") // UDP type. UDP = L4Type("UDP") )
const ( // ScopeExternal is the lookup scope for services from outside the node. ScopeExternal uint8 = iota // ScopeInternal is the lookup scope for services from inside the node. ScopeInternal )
Variables ¶
var ( // AllProtocols is the list of all supported L4 protocols AllProtocols = []L4Type{TCP, UDP} )
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend struct { // ID of the backend ID BackendID // Node hosting this backend. This is used to determine backends local to // a node. NodeName string L3n4Addr }
Backend represents load balancer backend.
func NewBackend ¶
NewBackend creates the Backend struct instance from given params.
func NewBackendFromBackendModel ¶
func NewBackendFromBackendModel(base *models.BackendAddress) (*Backend, error)
func (*Backend) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Backend.
func (*Backend) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*Backend) GetBackendModel ¶
func (b *Backend) GetBackendModel() *models.BackendAddress
type L3n4Addr ¶
L3n4Addr is used to store, as an unique L3+L4 address in the KVStore. It also includes the lookup scope for frontend addresses which is used in service handling for externalTrafficPolicy=Local, that is, Scope{External,Internal}.
+deepequal-gen=true +deepequal-gen:private-method=true
func NewL3n4Addr ¶
NewL3n4Addr creates a new L3n4Addr.
func NewL3n4AddrFromBackendModel ¶
func NewL3n4AddrFromBackendModel(base *models.BackendAddress) (*L3n4Addr, error)
func NewL3n4AddrFromModel ¶
func NewL3n4AddrFromModel(base *models.FrontendAddress) (*L3n4Addr, error)
func (*L3n4Addr) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new L3n4Addr.
func (*L3n4Addr) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*L3n4Addr) GetModel ¶
func (a *L3n4Addr) GetModel() *models.FrontendAddress
func (L3n4Addr) Hash ¶
Hash calculates a unique string of the L3n4Addr e.g for use as a key in maps. Note: the resulting string is meant to be used as a key for maps and is not readable by a human eye when printed out.
func (*L3n4Addr) IsIPv6 ¶
IsIPv6 returns true if the IP address in the given L3n4Addr is IPv6 or not.
func (*L3n4Addr) String ¶
String returns the L3n4Addr in the "IPv4:Port[/Scope]" format for IPv4 and "[IPv6]:Port[/Scope]" format for IPv6.
func (*L3n4Addr) StringID ¶
StringID returns the L3n4Addr as string to be used for unique identification
func (*L3n4Addr) StringWithProtocol ¶
StringWithProtocol returns the L3n4Addr in the "IPv4:Port/Protocol[/Scope]" format for IPv4 and "[IPv6]:Port/Protocol[/Scope]" format for IPv6.
type L3n4AddrID ¶
L3n4AddrID is used to store, as an unique L3+L4 plus the assigned ID, in the KVStore.
+deepequal-gen=true +deepequal-gen:private-method=true
func NewL3n4AddrID ¶
NewL3n4AddrID creates a new L3n4AddrID.
func (*L3n4AddrID) DeepCopy ¶
func (in *L3n4AddrID) DeepCopy() *L3n4AddrID
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new L3n4AddrID.
func (*L3n4AddrID) DeepCopyInto ¶
func (in *L3n4AddrID) DeepCopyInto(out *L3n4AddrID)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*L3n4AddrID) DeepEqual ¶
func (l *L3n4AddrID) DeepEqual(o *L3n4AddrID) bool
DeepEqual returns true if both the receiver and 'o' are deeply equal.
func (*L3n4AddrID) IsIPv6 ¶
func (l *L3n4AddrID) IsIPv6() bool
IsIPv6 returns true if the IP address in L3n4Addr's L3n4AddrID is IPv6 or not.
type L4Addr ¶
L4Addr is an abstraction for the backend port with a L4Type, usually tcp or udp, and the Port number.
+deepequal-gen=true +deepequal-gen:private-method=true
func (*L4Addr) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new L4Addr.
func (*L4Addr) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type SVC ¶
type SVC struct { Frontend L3n4AddrID // SVC frontend addr and an allocated ID Backends []Backend // List of service backends Type SVCType // Service type TrafficPolicy SVCTrafficPolicy // Service traffic policy SessionAffinity bool SessionAffinityTimeoutSec uint32 HealthCheckNodePort uint16 // Service health check node port Name string // Service name Namespace string // Service namespace LoadBalancerSourceRanges []*cidr.CIDR }
SVC is a structure for storing service details.
func (*SVC) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SVC.
func (*SVC) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type SVCTrafficPolicy ¶
type SVCTrafficPolicy string
SVCTrafficPolicy defines which backends are chosen
type ServiceFlags ¶
type ServiceFlags uint16
ServiceFlags is the datapath representation of the service flags that can be used (lb{4,6}_service.flags)
func (ServiceFlags) SVCTrafficPolicy ¶ added in v1.7.0
func (s ServiceFlags) SVCTrafficPolicy() SVCTrafficPolicy
SVCTrafficPolicy returns a service traffic policy from the flags
func (ServiceFlags) SVCType ¶
func (s ServiceFlags) SVCType() SVCType
SVCType returns a service type from the flags
func (ServiceFlags) String ¶
func (s ServiceFlags) String() string
String returns the string implementation of ServiceFlags.
func (ServiceFlags) UInt16 ¶
func (s ServiceFlags) UInt16() uint16
UInt8 returns the UInt16 representation of the ServiceFlags.
type SvcFlagParam ¶
type SvcFlagParam struct { SvcType SVCType SvcLocal bool SessionAffinity bool IsRoutable bool CheckSourceRange bool }
func (*SvcFlagParam) DeepCopy ¶
func (in *SvcFlagParam) DeepCopy() *SvcFlagParam
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SvcFlagParam.
func (*SvcFlagParam) DeepCopyInto ¶
func (in *SvcFlagParam) DeepCopyInto(out *SvcFlagParam)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.