Documentation ¶
Index ¶
- Constants
- Variables
- func DeleteLBs(nbClient libovsdbclient.Client, uuids []string) error
- func EnsureLBs(nbClient libovsdbclient.Client, service *corev1.Service, existingCacheLBs []LB, ...) error
- func GetServiceKeyFromEndpointSliceForDefaultNetwork(endpointSlice *discovery.EndpointSlice) (string, error)
- func IsHostEndpoint(endpointIP string) bool
- func LoadBalancersEqualNoUUID(lbs1, lbs2 []LB) bool
- type Addr
- type ChassisTemplateVarMap
- type Controller
- type LB
- type LBOpts
- type LBRule
- type NodeIPsTemplates
- type Template
- type TemplateMap
Constants ¶
const LBVipNodeTemplate string = "NODEIP"
const TemplatePrefix = "^"
Variables ¶
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 ¶
IsHostEndpoint determines if the given endpoint ip belongs to a host networked pod
func LoadBalancersEqualNoUUID ¶
LoadBalancersEqualNoUUID compares load balancer objects excluding uuid
Types ¶
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, networkManager networkmanager.Interface, 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
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 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.