reflectors

package
v1.19.2 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2026 License: Apache-2.0 Imports: 48 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// K8sInitializerPrefix is the StateDB initializer prefix used here. This can
	// be used to wait for the tables to be populated just from k8s even when
	// other initializers are present.
	K8sInitializerPrefix = "k8s-"
)

Variables

View Source
var Cell = cell.Module(
	"loadbalancer-reflectors",
	"Reflects external state to load-balancing tables",

	K8sReflectorCell,

	FileReflectorCell,

	cell.Provide(NetnsCookieSupportFunc),
)
View Source
var FileReflectorCell = cell.Module(
	"file-reflector",
	"Synchronizes load-balancing state from a file",

	cell.Config(fileReflectorConfig{}),
	cell.Invoke(registerFileReflector),
)

FileReflectorCell synchronizes the load-balancing state from a file specified with --lb-state-file. The file format is specified by StateFile and consists of Kubernetes services and endpoint slices.

The Kubernetes definitions are used to avoid having a new format and conversions from that format and it is also familiar to users.

The implementation is tested by 'pkg/loadbalancer/tests/testdata/file.txtar' which also shows an example of the file format.

View Source
var K8sReflectorCell = cell.Module(
	"k8s-reflector",
	"Reflects load-balancing state from Kubernetes",

	cell.ProvidePrivate(newEventStream),
	cell.Invoke(RegisterK8sReflector),
)

K8sReflectorCell reflects Kubernetes Service and EndpointSlice objects to the load-balancing tables.

Functions

func CheckServiceNodeExposure

func CheckServiceNodeExposure(localNode *node.LocalNode, annotations map[string]string) (bool, error)

CheckServiceNodeExposure returns true if the service should be installed onto the local node, and false if the node should ignore and not install the service.

func EventStreamForBenchmark added in v1.19.0

func EventStreamForBenchmark(eps <-chan resource.Event[*k8s.Endpoints], svcs <-chan resource.Event[*slim_corev1.Service]) stream.Observable[event]

func NewSvcExposureType

func NewSvcExposureType(svc *slim_corev1.Service) (*exposeSvcType, error)

func RegisterK8sReflector

func RegisterK8sReflector(p reflectorParams)

Types

type HaveNetNSCookieSupport added in v1.19.0

type HaveNetNSCookieSupport func() bool

func NetnsCookieSupportFunc added in v1.19.0

func NetnsCookieSupportFunc() HaveNetNSCookieSupport

type SVCMetrics

type SVCMetrics interface {
	AddService(svc *loadbalancer.Service)
	DelService(svc *loadbalancer.Service)
}

func NewSVCMetricsNoop

func NewSVCMetricsNoop() SVCMetrics

type StateFile

type StateFile struct {
	Services  []slim_corev1.Service            `json:"services"`
	Endpoints []slim_discoveryv1.EndpointSlice `json:"endpoints"`
}

StateFile defines the format for the state file used with --lb-state-file.

Jump to

Keyboard shortcuts

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