services

package
v0.0.0-...-e0f77fc Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: Apache-2.0 Imports: 42 Imported by: 0

Documentation

Index

Constants

View Source
const LBVipNodeTemplate string = "NODEIP"
View Source
const TemplatePrefix = "^"

Variables

View Source
var NoServiceLabelError = fmt.Errorf("endpointSlice missing the service name label")

Functions

func DeleteLBs

func DeleteLBs(nbClient libovsdbclient.Client, uuids []string) error

DeleteLBs deletes all load balancer uuids supplied Note: this also automatically removes them from the switches, routers, and the groups :-)

func EnsureLBs

func EnsureLBs(nbClient libovsdbclient.Client, service *corev1.Service, existingCacheLBs []LB, LBs []LB, netInfo util.NetInfo) error

EnsureLBs provides a generic load-balancer reconciliation engine.

It assures that, for a given set of ExternalIDs, only the configured list of load balancers exist. Existing load-balancers will be updated, new ones will be created as needed, and stale ones will be deleted.

For example, you might want to ensure that service ns/foo has the correct set of load balancers. You would call it with something like

EnsureLBs( { kind: Service, owner: ns/foo}, { {Name: Service_ns/foo_cluster_tcp, ...}})

This will ensure that, for this example, only that one LB exists and has the desired configuration.

It will commit all updates in a single transaction, so updates will be atomic and users should see no disruption. However, concurrent calls that modify the same externalIDs are not allowed.

It is assumed that names are meaningful and somewhat stable, to minimize churn. This function doesn't work with Load_Balancers without a name.

func GetServiceKeyFromEndpointSliceForDefaultNetwork

func GetServiceKeyFromEndpointSliceForDefaultNetwork(endpointSlice *discovery.EndpointSlice) (string, error)

GetServiceKeyFromEndpointSliceForDefaultNetwork returns a controller key for a Service but derived from an EndpointSlice. Not UDN-aware, is used for egress services

func IsHostEndpoint

func IsHostEndpoint(endpointIP string) bool

IsHostEndpoint determines if the given endpoint ip belongs to a host networked pod

func LoadBalancersEqualNoUUID

func LoadBalancersEqualNoUUID(lbs1, lbs2 []LB) bool

LoadBalancersEqualNoUUID compares load balancer objects excluding uuid

Types

type Addr

type Addr struct {
	IP       string
	Port     int32
	Template *Template
}

func (*Addr) String

func (a *Addr) String() string

type ChassisTemplateVarMap

type ChassisTemplateVarMap map[string]*nbdb.ChassisTemplateVar

type Controller

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

Controller manages selector-based service endpoints.

func NewController

func NewController(client clientset.Interface,
	nbClient libovsdbclient.Client,
	serviceInformer coreinformers.ServiceInformer,
	endpointSliceInformer discoveryinformers.EndpointSliceInformer,
	nodeInformer coreinformers.NodeInformer,
	nadController networkAttachDefController.NADController,
	recorder record.EventRecorder,
	netInfo util.NetInfo,
) (*Controller, error)

NewController returns a new *Controller.

func (*Controller) RequestFullSync

func (c *Controller) RequestFullSync(nodeInfos []nodeInfo)

RequestFullSync re-syncs every service that currently exists

func (*Controller) Run

func (c *Controller) Run(workers int, stopCh <-chan struct{}, runRepair, useLBGroups, useTemplates bool) error

Run will not return until stopCh is closed. workers determines how many endpoints will be handled in parallel.

type LB

type LB struct {
	Name        string
	UUID        string
	Protocol    string // one of TCP, UDP, SCTP
	ExternalIDs map[string]string
	Opts        LBOpts

	Rules []LBRule

	Templates TemplateMap // Templates that this LB uses as backends.

	// the names of logical switches, routers and LB groups that this LB should be attached to
	Switches []string
	Routers  []string
	Groups   []string
}

LB is a desired or existing load_balancer configuration in OVN.

type LBOpts

type LBOpts struct {
	// if the service should send back tcp REJECT in case of no endpoints
	Reject bool

	// if the service should raise empty_lb events
	EmptyLBEvents bool

	// If greater than 0, then enable per-client-IP affinity.
	AffinityTimeOut int32

	// If true, then disable SNAT entirely
	SkipSNAT bool

	// If true, this is a LB template.
	Template bool

	// Only useful for template LBs.
	AddressFamily corev1.IPFamily
}

type LBRule

type LBRule struct {
	Source  Addr
	Targets []Addr
}

type NodeIPsTemplates

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

NodeIPTemplates maintains templates variables for many IP addresses per node, creating them in the form NODEIP_IPv4_0, NODEIP_IPv4_1, NODEIP_IPv4_2, ... if and when they are needed.

func NewNodeIPsTemplates

func NewNodeIPsTemplates(ipFamily corev1.IPFamily) *NodeIPsTemplates

func (*NodeIPsTemplates) AddIP

func (n *NodeIPsTemplates) AddIP(chassisID string, ip net.IP)

AddIP adds a template variable for the specified chassis and ip address.

func (*NodeIPsTemplates) AsTemplateMap

func (n *NodeIPsTemplates) AsTemplateMap() TemplateMap

func (*NodeIPsTemplates) AsTemplates

func (n *NodeIPsTemplates) AsTemplates() []*Template

func (*NodeIPsTemplates) Len

func (n *NodeIPsTemplates) Len() int

type Template

type Template struct {
	// The name of the template.
	Name string

	// Per chassis template value, indexed by chassisID.
	Value map[string]string
}

Chassis_Template_Var records store (for efficiency reasons) a 'variables' map for each chassis. For simpler CMS code, store templates in memory as a (Name, Value) tuple where Value is a map with potentially different values on each chassis.

type TemplateMap

type TemplateMap map[string]*Template

Jump to

Keyboard shortcuts

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