statelessloadbalancer

package
v0.0.0-...-265eb5a Latest Latest
Warning

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

Go to latest
Published: May 30, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

type Controller struct {
	client.Client
	Scheme *runtime.Scheme
	// Name of the gateway in which this controller is running.
	Name string
	// Namespace of the gateway in which this controller is running.
	Namespace        string
	ServiceManager   serviceManager
	GatewayClassName string
}

Controller reconciles the Gateway Object to run the stateless-load-balancer.

func (*Controller) Reconcile

func (c *Controller) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

Reconcile implements the reconciliation of the Gateway of Stateless-load-balancer class. This function is trigger by any change (create/update/delete) in any resource related to the object (L34Route/Service/Gateway/EndpointSlice).

For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.13.0/pkg/reconcile

func (*Controller) SetupWithManager

func (c *Controller) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type Flow

type Flow interface {
	// Name of the flow
	GetName() string
	// Source CIDRs allowed in the flow
	// e.g.: ["124.0.0.0/24", "2001::/32"
	GetSourceCIDRs() []string
	// Destination CIDRs allowed in the flow
	// e.g.: ["124.0.0.0/24", "2001::/32"
	GetDestinationCIDRs() []string
	// Source port ranges allowed in the flow
	// e.g.: ["35000-35500", "40000"]
	GetSourcePortRanges() []string
	// Destination port ranges allowed in the flow
	// e.g.: ["35000-35500", "40000"]
	GetDestinationPortRanges() []string
	// Protocols allowed
	// e.g.: ["tcp", "udp"]
	GetProtocols() []string
	// Priority of the flow
	GetPriority() int32
	// Bytes in L4 header
	GetByteMatches() []string
}

Flow is the interface that wraps the basic Flow method.

type LoadBalancerInstance

type LoadBalancerInstance interface {
	// AddService adds a load-balancer service.
	AddService(ctx context.Context, name string) (ServiceInstance, error)
	// DeleteService deletes a load-balancer service and all related configuration (targets and flows).
	DeleteService(ctx context.Context, name string) error
}

LoadBalancerInstance defines an interface to add/delete load-balancer services within a load balancer instance (e.g. nfqlb).

type Manager

type Manager struct {
	LoadBalancer LoadBalancerInstance
	// contains filtered or unexported fields
}

Manager is an helper structure to control a load balancer instance.

func NewManager

func NewManager(loadBalancer LoadBalancerInstance) *Manager

NewManager is the constructor of Manager.

func (*Manager) SetEndpoints

func (m *Manager) SetEndpoints(
	ctx context.Context,
	service *v1.Service,
	endpoints []v1discovery.Endpoint,
) error

SetEndpoints adds the non existing endpoint, updates the existing ones and removes the ones that are not passed as parameter.

func (*Manager) SetFlows

func (m *Manager) SetFlows(ctx context.Context,
	l34Routes []*v1alpha1.L34Route,
) error

SetFlows adds the non existing l34Routes, updates the existing ones and removes the ones that are not passed as parameter.

func (*Manager) SetServices

func (m *Manager) SetServices(
	ctx context.Context,
	services []*v1.Service,
) error

SetService adds the service to the load balancer instance if not already existing.

type NFQLBInstance

type NFQLBInstance struct {
	*nfqlb.NFQueueLoadBalancer
}

NFQLBInstance is a wrapper of nfqlb.NFQueueLoadBalancer to match the LoadBalancerInstance interface.

func NewNFQLB

func NewNFQLB(nfqLoadBalancer *nfqlb.NFQueueLoadBalancer) *NFQLBInstance

NewNFQLB is the constructor of NFQLBInstance.

func (*NFQLBInstance) AddService

func (nfqlbi *NFQLBInstance) AddService(ctx context.Context, name string) (ServiceInstance, error)

AddService implements AddService of LoadBalancerInstance for nfqlb.

type ServiceInstance

type ServiceInstance interface {
	// Name of the Service
	GetName() string
	// AddFlow adds/updates a Flow selecting the associated load-balancer service.
	AddFlow(ctx context.Context, flowToAdd Flow) error
	// DeleteFlow adds a Flow selecting the associated load-balancer service.
	DeleteFlow(ctx context.Context, flowToDelete Flow) error
	// AddTarget adds a target identifier to the load-balancer service
	// and configures the policy route associated.
	AddTarget(ctx context.Context, ips []string, identifier int) error
	// DeleteTarget deletes a target identifier to the load-balancer service
	// and deletes the policy route associated.
	DeleteTarget(ctx context.Context, ips []string, identifier int) error
}

ServiceInstance represents a service instantiated by the load balancer instance.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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