stream

package
v1.2.10 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2026 License: Apache-2.0 Imports: 28 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetInterfaceNamePrefix

func GetInterfaceNamePrefix() string

GetInterfaceNamePrefix -

func New

func New(
	stream *nspAPI.Stream,
	targetRegistryClient nspAPI.TargetRegistryClient,
	configurationManagerClient nspAPI.ConfigurationManagerClient,
	nfqueue int,
	netUtils networking.Utils,
	lbFactory types.NFQueueLoadBalancerFactory,
	identifierOffset int,
	targetHitsMetrics *targetMetrics.HitsMetrics,
	neighborReachDetector *neighbor.NeighborReachabilityDetector,
	forwardingAvailabilityService *ForwardingAvailabilityService,
) (types.Stream, error)

func NewTarget

func NewTarget(nspTarget *nspAPI.Target, netUtils networking.Utils, targetHitsMetrics *targetMetrics.HitsMetrics, identifierOffset int) (types.Target, error)

func SetInterfaceNamePrefix

func SetInterfaceNamePrefix(ns string)

SetInterfaceNamePrefix - Derives the NSM v1.2-rc1 (same as v1.1.1) interface name prefix based on the Network Service name of the NSE.

Note: By letting NSM name the NSE interface there's no need for a custom interfacename.NewServer chain component.

Types

type Defrag

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

func NewDefrag

func NewDefrag(excludedIfPrefix string) (*Defrag, error)

NewDefrag - -Load kernel's defragmentation via conntrack. Needed by Flow rules to match L4 information - applied on packets arriving from outside world. -Do not allow defragmentation of packets from the direction of targets. Thus outbound IPv4 packets can leave the LB reflecting their originating source's PMTU information. -Forbid conntrack to do "book-keeping" in order to not "litter" memory.

func (*Defrag) Delete

func (d *Defrag) Delete() error

type ForwardingAvailabilityService added in v1.0.17

type ForwardingAvailabilityService struct {
	lbAPI.UnimplementedStreamAvailabilityServiceServer
	// contains filtered or unexported fields
}

ForwardingAvailabilityService keeps track of forwarding plane availability towards application targets.

It aggregates path informatation received form invidual Streams, and updates Watch clients based on the accumulated information whether the loadbalancer is capable of forwarding incoming traffic.

Update is performed using a custom loadbalancer Target. There is one common loadbalancer Target for all local forwarding paths. (That is, the forwarding capability is not distinguished on Stream level currently.)

Upon Register/Unregister the update of watchers is performed asynchronously not blocking the caller. Watch fetches the most recent availability information to be sent to the client.

Skips sending duplicate availability updates to a watcher, ensuring only changes are propagated.

func NewForwardingAvailabilityService added in v1.0.17

func NewForwardingAvailabilityService(ctx context.Context,
	target *lbAPI.Target) *ForwardingAvailabilityService

NewForwardingAvailabilityService - Creates a new forwarding availability service.

func NewForwardingAvailabilityServiceForTest added in v1.2.1

func NewForwardingAvailabilityServiceForTest(
	ctx context.Context,
	target *lbAPI.Target,
	delay time.Duration,
) *ForwardingAvailabilityService

NewForwardingAvailabilityServiceForTest - Creates a new Test-specific forwarding availability service using a delayed TargetGetter.

func (*ForwardingAvailabilityService) Register added in v1.0.17

func (fas *ForwardingAvailabilityService) Register(name string)

Register - Registers a new forwarding path. In case of the first forwarding path update() is called to inform Watch clients the LB is ready to forward traffic.

func (*ForwardingAvailabilityService) Stop added in v1.0.17

func (fas *ForwardingAvailabilityService) Stop()

Stop - Stop stops further user interaction via Register/Unregister calls. Blocks until all watchers have processed and acted upon the stop request. Also, informs clients that the loadbalancer target is no longer available.

func (*ForwardingAvailabilityService) Unregister added in v1.0.17

func (fas *ForwardingAvailabilityService) Unregister(name string)

Unregister - Unregisters a forfarding path. In case there are no remaining forwarding paths, update informs the Watch clients.

func (*ForwardingAvailabilityService) Watch added in v1.0.17

type LoadBalancer

type LoadBalancer struct {
	*nspAPI.Stream
	TargetRegistryClient       nspAPI.TargetRegistryClient
	ConfigurationManagerClient nspAPI.ConfigurationManagerClient
	IdentifierOffset           int
	// contains filtered or unexported fields
}

LoadBalancer -

func (*LoadBalancer) AddTarget

func (lb *LoadBalancer) AddTarget(target types.Target) error

AddTarget - Adds a target by configuring routing and activating it in nfqlb. Note: configuration fails if no (NSM) inteface is available in the subnet the target IPs belong to.

func (*LoadBalancer) Delete

func (lb *LoadBalancer) Delete() error

func (*LoadBalancer) GetTargets

func (lb *LoadBalancer) GetTargets() []types.Target

func (*LoadBalancer) InterfaceCreated added in v0.4.0

func (lb *LoadBalancer) InterfaceCreated(intf networking.Iface)

InterfaceCreated - When a new NSM interface of interest appears trigger processPendingTargets() to attempt configuring pending Targets (missing route could have become available)

func (*LoadBalancer) InterfaceDeleted added in v0.4.0

func (lb *LoadBalancer) InterfaceDeleted(intf networking.Iface)

InterfaceDeleted - When a NSM interface of interest disappears trigger processPendingTargets() to verify if configured Targets still have working routes

func (*LoadBalancer) RemoveTarget

func (lb *LoadBalancer) RemoveTarget(identifier int) error

RemoveTarget -

func (*LoadBalancer) Start

func (lb *LoadBalancer) Start(ctx context.Context) error

func (*LoadBalancer) TargetExists

func (lb *LoadBalancer) TargetExists(identifier int) bool

TargetExists -

type TargetGetter added in v1.2.1

type TargetGetter interface {
	// Get retrieves the current target based on the state of the provided ForwardingAvailabilityService.
	// It takes 'fas' as an argument because it needs to access fas's internal (locked) state.
	Get(fas *ForwardingAvailabilityService) *lbAPI.Target
}

TargetGetter defines the interface for retrieving the current load balancer target

Jump to

Keyboard shortcuts

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