cilium: github.com/cilium/cilium/pkg/loadbalancer Index | Files

package loadbalancer

import "github.com/cilium/cilium/pkg/loadbalancer"

Package loadbalancer contains all logic related with the loadbalancer +groupName=pkg

Index

Package Files

doc.go loadbalancer.go zz_generated.deepcopy.go

Constants

const (
    SVCTypeNone         = SVCType("NONE")
    SVCTypeHostPort     = SVCType("HostPort")
    SVCTypeClusterIP    = SVCType("ClusterIP")
    SVCTypeNodePort     = SVCType("NodePort")
    SVCTypeExternalIPs  = SVCType("ExternalIPs")
    SVCTypeLoadBalancer = SVCType("LoadBalancer")
)
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 = 0
    // ScopeInternal is the lookup scope for services from inside the node.
    ScopeInternal = 1
)

Variables

var (
    // AllProtocols is the list of all supported L4 protocols
    AllProtocols = []L4Type{TCP, UDP}
)

type Backend Uses

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 Uses

func NewBackend(id BackendID, protocol L4Type, ip net.IP, portNumber uint16) *Backend

NewBackend creates the Backend struct instance from given params.

func NewBackendFromBackendModel Uses

func NewBackendFromBackendModel(base *models.BackendAddress) (*Backend, error)

func (*Backend) DeepCopy Uses

func (in *Backend) DeepCopy() *Backend

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Backend.

func (*Backend) DeepCopyInto Uses

func (in *Backend) DeepCopyInto(out *Backend)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Backend) GetBackendModel Uses

func (b *Backend) GetBackendModel() *models.BackendAddress

func (*Backend) String Uses

func (b *Backend) String() string

type BackendID Uses

type BackendID uint16

BackendID is the backend's ID.

type FEPortName Uses

type FEPortName string

FEPortName is the name of the frontend's port.

type ID Uses

type ID uint32

ID is the ID of L3n4Addr endpoint (either service or backend).

type L3n4Addr Uses

type L3n4Addr struct {
    IP  net.IP
    L4Addr
    Scope uint8
}

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}.

func NewL3n4Addr Uses

func NewL3n4Addr(protocol L4Type, ip net.IP, portNumber uint16, scope uint8) *L3n4Addr

NewL3n4Addr creates a new L3n4Addr.

func NewL3n4AddrFromBackendModel Uses

func NewL3n4AddrFromBackendModel(base *models.BackendAddress) (*L3n4Addr, error)

func NewL3n4AddrFromModel Uses

func NewL3n4AddrFromModel(base *models.FrontendAddress) (*L3n4Addr, error)

func (*L3n4Addr) DeepCopy Uses

func (a *L3n4Addr) DeepCopy() *L3n4Addr

DeepCopy returns a DeepCopy of the given L3n4Addr.

func (*L3n4Addr) DeepCopyInto Uses

func (in *L3n4Addr) DeepCopyInto(out *L3n4Addr)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*L3n4Addr) GetModel Uses

func (a *L3n4Addr) GetModel() *models.FrontendAddress

func (L3n4Addr) Hash Uses

func (a L3n4Addr) Hash() string

Hash calculates L3n4Addr's internal SHA256Sum.

func (*L3n4Addr) IsIPv6 Uses

func (a *L3n4Addr) IsIPv6() bool

IsIPv6 returns true if the IP address in the given L3n4Addr is IPv6 or not.

func (*L3n4Addr) String Uses

func (a *L3n4Addr) String() string

String returns the L3n4Addr in the "IPv4:Port[/Scope]" format for IPv4 and "[IPv6]:Port[/Scope]" format for IPv6.

func (*L3n4Addr) StringID Uses

func (a *L3n4Addr) StringID() string

StringID returns the L3n4Addr as string to be used for unique identification

func (*L3n4Addr) StringWithProtocol Uses

func (a *L3n4Addr) StringWithProtocol() string

StringWithProtocol returns the L3n4Addr in the "IPv4:Port/Protocol[/Scope]" format for IPv4 and "[IPv6]:Port/Protocol[/Scope]" format for IPv6.

type L3n4AddrID Uses

type L3n4AddrID struct {
    L3n4Addr
    ID  ID
}

L3n4AddrID is used to store, as an unique L3+L4 plus the assigned ID, in the KVStore.

func NewL3n4AddrID Uses

func NewL3n4AddrID(protocol L4Type, ip net.IP, portNumber uint16, scope uint8, id ID) *L3n4AddrID

NewL3n4AddrID creates a new L3n4AddrID.

func (*L3n4AddrID) DeepCopy Uses

func (in *L3n4AddrID) DeepCopy() *L3n4AddrID

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new L3n4AddrID.

func (*L3n4AddrID) DeepCopyInto Uses

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) Equals Uses

func (l *L3n4AddrID) Equals(o *L3n4AddrID) bool

Equals checks equality of both given addresses.

func (*L3n4AddrID) IsIPv6 Uses

func (l *L3n4AddrID) IsIPv6() bool

IsIPv6 returns true if the IP address in L3n4Addr's L3n4AddrID is IPv6 or not.

type L4Addr Uses

type L4Addr struct {
    Protocol L4Type
    Port     uint16
}

L4Addr is an abstraction for the backend port with a L4Type, usually tcp or udp, and the Port number.

func NewL4Addr Uses

func NewL4Addr(protocol L4Type, number uint16) *L4Addr

NewL4Addr creates a new L4Addr.

func (*L4Addr) DeepCopy Uses

func (l *L4Addr) DeepCopy() *L4Addr

DeepCopy returns a DeepCopy of the given L4Addr.

func (*L4Addr) DeepCopyInto Uses

func (in *L4Addr) DeepCopyInto(out *L4Addr)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*L4Addr) Equals Uses

func (l *L4Addr) Equals(o *L4Addr) bool

Equals returns true if both L4Addr are considered equal.

type L4Type Uses

type L4Type string

L4Type name.

func NewL4Type Uses

func NewL4Type(name string) (L4Type, error)

type SVC Uses

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
}

SVC is a structure for storing service details.

func (*SVC) DeepCopy Uses

func (in *SVC) DeepCopy() *SVC

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SVC.

func (*SVC) DeepCopyInto Uses

func (in *SVC) DeepCopyInto(out *SVC)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*SVC) GetModel Uses

func (s *SVC) GetModel() *models.Service

type SVCTrafficPolicy Uses

type SVCTrafficPolicy string

SVCTrafficPolicy defines which backends are chosen

type SVCType Uses

type SVCType string

SVCType is a type of a service.

type ServiceFlags Uses

type ServiceFlags uint8

ServiceFlags is the datapath representation of the service flags that can be used.

func CreateSvcFlag Uses

func CreateSvcFlag(svcLocal, sessionAffinity, isRoutable bool, svcTypes ...SVCType) ServiceFlags

CreateSvcFlag returns the ServiceFlags for all given SVCTypes.

func (ServiceFlags) IsSvcType Uses

func (s ServiceFlags) IsSvcType(svcLocal, sessionAffinity, isRoutable bool, svcType SVCType) bool

IsSvcType returns true if the serviceFlags is the given SVCType.

func (ServiceFlags) SVCTrafficPolicy Uses

func (s ServiceFlags) SVCTrafficPolicy() SVCTrafficPolicy

SVCTrafficPolicy returns a service traffic policy from the flags

func (ServiceFlags) SVCType Uses

func (s ServiceFlags) SVCType() SVCType

SVCType returns a service type from the flags

func (ServiceFlags) String Uses

func (s ServiceFlags) String() string

String returns the string implementation of ServiceFlags.

func (ServiceFlags) UInt8 Uses

func (s ServiceFlags) UInt8() uint8

UInt8 returns the UInt8 representation of the ServiceFlags.

type ServiceID Uses

type ServiceID uint16

ServiceID is the service's ID.

Package loadbalancer imports 8 packages (graph) and is imported by 29 packages. Updated 2020-08-03. Refresh now. Tools for package owners.