logicalswitchmanager

package
v0.0.0-...-eee9142 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: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SwitchNotFound = subnet.ErrSubnetNotFound

Functions

This section is empty.

Types

type LogicalSwitchManager

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

LogicalSwitchManager provides switch info management APIs including IPAM for the host subnets

func NewL2SwitchManager

func NewL2SwitchManager() *LogicalSwitchManager

NewL2SwitchManager initializes a new logical switch manager for L2 secondary networks. In L2, we do not auto-reserve the GW and mp0 IPs on the subnet - the reasons are different depending on the topology though:

  • localnet: it is the user's responsibility to know which IPs to exclude from the physical network
  • layer2: this is a disconnected network, thus it doesn't have a GW, nor a management port

func NewL2SwitchManagerForUserDefinedPrimaryNetwork

func NewL2SwitchManagerForUserDefinedPrimaryNetwork() *LogicalSwitchManager

NewL2SwitchManagerForUserDefinedPrimaryNetwork initializes a new logical switch manager for L2 primary networks. A user defined primary network auto-reserves the .1 and .2 IP addresses, which are required for egressing the cluster over this user defined network.

func NewLogicalSwitchManager

func NewLogicalSwitchManager() *LogicalSwitchManager

NewLogicalSwitchManager initializes a new logical switch manager for L3 networks.

func (*LogicalSwitchManager) AddNoHostSubnetSwitch

func (manager *LogicalSwitchManager) AddNoHostSubnetSwitch(switchName string) error

AddNoHostSubnetSwitch adds/updates a switch without any host subnets to the logical switch manager

func (*LogicalSwitchManager) AddOrUpdateSwitch

func (manager *LogicalSwitchManager) AddOrUpdateSwitch(switchName string, hostSubnets []*net.IPNet, excludeSubnets ...*net.IPNet) error

AddOrUpdateSwitch adds/updates a switch to the logical switch manager for subnet and IPAM management.

func (*LogicalSwitchManager) AllocateHybridOverlay

func (manager *LogicalSwitchManager) AllocateHybridOverlay(switchName string, hybridOverlayAnnotation []string) ([]*net.IPNet, error)

func (*LogicalSwitchManager) AllocateIPs

func (manager *LogicalSwitchManager) AllocateIPs(switchName string, ipnets []*net.IPNet) error

AllocateIPs will block off IPs in the ipnets slice as already allocated for a given switch

func (*LogicalSwitchManager) AllocateNextIPs

func (manager *LogicalSwitchManager) AllocateNextIPs(switchName string) ([]*net.IPNet, error)

AllocateNextIPs allocates IP addresses from each of the host subnets for a given switch

func (*LogicalSwitchManager) AllocateUntilFull

func (manager *LogicalSwitchManager) AllocateUntilFull(switchName string) error

AllocateUntilFull used for unit testing only, allocates the rest of the switch subnet

func (*LogicalSwitchManager) ConditionalIPRelease

func (manager *LogicalSwitchManager) ConditionalIPRelease(switchName string, ipnets []*net.IPNet, predicate func() (bool, error)) (bool, error)

ConditionalIPRelease determines if any IP is available to be released from an IPAM conditionally if func is true. It guarantees state of the allocator will not change while executing the predicate function TODO(trozet): add unit testing for this function

func (*LogicalSwitchManager) DeleteSwitch

func (manager *LogicalSwitchManager) DeleteSwitch(switchName string)

Remove a switch from the the logical switch manager

func (*LogicalSwitchManager) ForSwitch

func (manager *LogicalSwitchManager) ForSwitch(switchName string) subnet.NamedAllocator

ForSubnet return an IP allocator for the specified switch

func (*LogicalSwitchManager) GetSubnetName

func (manager *LogicalSwitchManager) GetSubnetName(subnets []*net.IPNet) (string, bool)

GetSubnetName will find the switch that contains one of the subnets from "subnets" if not it will return "", false

func (*LogicalSwitchManager) GetSwitchSubnets

func (manager *LogicalSwitchManager) GetSwitchSubnets(switchName string) []*net.IPNet

Given a switch name, get all its host-subnets

func (*LogicalSwitchManager) IsNonHostSubnetSwitch

func (manager *LogicalSwitchManager) IsNonHostSubnetSwitch(switchName string) bool

Given a switch name, checks if the switch is a noHostSubnet switch

func (*LogicalSwitchManager) ReleaseIPs

func (manager *LogicalSwitchManager) ReleaseIPs(switchName string, ipnets []*net.IPNet) error

Mark the IPs in ipnets slice as available for allocation by releasing them from the IPAM pool of allocated IPs. If there aren't IPs to release the method does not return an error.

Jump to

Keyboard shortcuts

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