loadbalancer

package
v1.14.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 19, 2023 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RoundRobin     = "ROUND_ROBIN"
	Random         = "RANDOM"
	ConsistentHash = "CONSISTENT_HASH"

	HttpHeader   = "HTTP_HEADER"
	UserSourceIP = "USER_SOURCE_IP"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ConsistentHashPolicy

type ConsistentHashPolicy struct {
	Config *v1alpha1.ConsistentHash
	// contains filtered or unexported fields
}

func NewConsistentHashPolicy

func NewConsistentHashPolicy(config *v1alpha1.ConsistentHash, dr *istioapi.DestinationRule, endpoints []string) *ConsistentHashPolicy

func (*ConsistentHashPolicy) Name

func (ch *ConsistentHashPolicy) Name() string

func (*ConsistentHashPolicy) Pick

func (ch *ConsistentHashPolicy) Pick(endpoints []string, srcAddr net.Addr, netConn net.Conn, cliReq *http.Request) (endpoint string, req *http.Request, err error)

func (*ConsistentHashPolicy) Release

func (ch *ConsistentHashPolicy) Release()

func (*ConsistentHashPolicy) Sync

func (ch *ConsistentHashPolicy) Sync(endpoints []string)

func (*ConsistentHashPolicy) Update

func (ch *ConsistentHashPolicy) Update(oldDr, dr *istioapi.DestinationRule)

type HashKey

type HashKey struct {
	Type string
	Key  string
}

type LoadBalancer

type LoadBalancer struct {
	Config *v1alpha1.LoadBalancer
	// contains filtered or unexported fields
}

func New

func New(config *v1alpha1.LoadBalancer, kubeClient kubernetes.Interface, istioClient istio.Interface, syncPeriod time.Duration) *LoadBalancer

func (*LoadBalancer) CleanupStaleStickySessions

func (lb *LoadBalancer) CleanupStaleStickySessions(svcPort proxy.ServicePortName)

func (*LoadBalancer) DeleteService

func (lb *LoadBalancer) DeleteService(svcPort proxy.ServicePortName)

func (*LoadBalancer) GetServicePortName

func (lb *LoadBalancer) GetServicePortName(namespacedName types.NamespacedName, port int) (proxy.ServicePortName, bool)

func (*LoadBalancer) NewService

func (lb *LoadBalancer) NewService(svcPort proxy.ServicePortName, affinityType v1.ServiceAffinity, ttlSeconds int) error

func (*LoadBalancer) NextEndpoint

func (lb *LoadBalancer) NextEndpoint(svcPort proxy.ServicePortName, srcAddr net.Addr, sessionAffinityReset bool) (string, error)

func (*LoadBalancer) OnDestinationRuleAdd

func (lb *LoadBalancer) OnDestinationRuleAdd(dr *istioapi.DestinationRule)

func (*LoadBalancer) OnDestinationRuleDelete

func (lb *LoadBalancer) OnDestinationRuleDelete(dr *istioapi.DestinationRule)

func (*LoadBalancer) OnDestinationRuleSynced

func (lb *LoadBalancer) OnDestinationRuleSynced()

func (*LoadBalancer) OnDestinationRuleUpdate

func (lb *LoadBalancer) OnDestinationRuleUpdate(oldDr, dr *istioapi.DestinationRule)

func (*LoadBalancer) OnEndpointsAdd

func (lb *LoadBalancer) OnEndpointsAdd(endpoints *v1.Endpoints)

func (*LoadBalancer) OnEndpointsDelete

func (lb *LoadBalancer) OnEndpointsDelete(endpoints *v1.Endpoints)

func (*LoadBalancer) OnEndpointsSynced

func (lb *LoadBalancer) OnEndpointsSynced()

func (*LoadBalancer) OnEndpointsUpdate

func (lb *LoadBalancer) OnEndpointsUpdate(oldEndpoints *v1.Endpoints, endpoints *v1.Endpoints)

func (*LoadBalancer) OnServiceAdd

func (lb *LoadBalancer) OnServiceAdd(service *v1.Service)

func (*LoadBalancer) OnServiceDelete

func (lb *LoadBalancer) OnServiceDelete(service *v1.Service)

func (*LoadBalancer) OnServiceSynced

func (lb *LoadBalancer) OnServiceSynced()

func (*LoadBalancer) OnServiceUpdate

func (lb *LoadBalancer) OnServiceUpdate(oldService, service *v1.Service)

func (*LoadBalancer) Run

func (lb *LoadBalancer) Run() error

func (*LoadBalancer) ServiceHasEndpoints

func (lb *LoadBalancer) ServiceHasEndpoints(svcPort proxy.ServicePortName) bool

func (*LoadBalancer) TryConnectEndpoints

func (lb *LoadBalancer) TryConnectEndpoints(service proxy.ServicePortName, srcAddr net.Addr, protocol string,
	netConn net.Conn, cliReq *http.Request) (out net.Conn, err error)

TryConnectEndpoints attempts to connect to the next available endpoint for the given service, cycling through until it is able to successfully connect, or it has tried with all timeouts in EndpointDialTimeouts.

type Policy

type Policy interface {
	Name() string
	Update(oldDr, dr *istioapi.DestinationRule)
	Pick(endpoints []string, srcAddr net.Addr, tcpConn net.Conn, cliReq *http.Request) (string, *http.Request, error)
	Sync(endpoints []string)
	Release()
}

type RandomPolicy

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

func NewRandomPolicy

func NewRandomPolicy() *RandomPolicy

func (*RandomPolicy) Name

func (rd *RandomPolicy) Name() string

func (*RandomPolicy) Pick

func (rd *RandomPolicy) Pick(endpoints []string, srcAddr net.Addr, netConn net.Conn, cliReq *http.Request) (string, *http.Request, error)

func (*RandomPolicy) Release

func (rd *RandomPolicy) Release()

func (*RandomPolicy) Sync

func (rd *RandomPolicy) Sync(endpoints []string)

func (*RandomPolicy) Update

func (rd *RandomPolicy) Update(oldDr, dr *istioapi.DestinationRule)

type RoundRobinPolicy

type RoundRobinPolicy struct {
}

RoundRobinPolicy is a default policy.

func NewRoundRobinPolicy

func NewRoundRobinPolicy() *RoundRobinPolicy

func (*RoundRobinPolicy) Name

func (*RoundRobinPolicy) Name() string

func (*RoundRobinPolicy) Pick

func (*RoundRobinPolicy) Pick(endpoints []string, srcAddr net.Addr, netConn net.Conn, cliReq *http.Request) (string, *http.Request, error)

func (*RoundRobinPolicy) Release

func (*RoundRobinPolicy) Release()

func (*RoundRobinPolicy) Sync

func (*RoundRobinPolicy) Sync(endpoints []string)

func (*RoundRobinPolicy) Update

func (*RoundRobinPolicy) Update(oldDr, dr *istioapi.DestinationRule)

type ServiceObject

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL