ipampool

package
v1.6.11 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultRefreshDelay pool monitor poll delay default in seconds.
	DefaultRefreshDelay = 1 * time.Second
	// DefaultMaxIPs default maximum allocatable IPs
	DefaultMaxIPs = 250
)

Variables

This section is empty.

Functions

func CalculateMaxFreeIPs

func CalculateMaxFreeIPs(scaler v1alpha.Scaler) int64

CalculateMaxFreeIPs calculates the maximum free IP quantity based on the Scaler in the passed NodeNetworkConfig. Half of odd batches are rounded up!

func CalculateMinFreeIPs

func CalculateMinFreeIPs(scaler v1alpha.Scaler) int64

CalculateMinFreeIPs calculates the minimum free IP quantity based on the Scaler in the passed NodeNetworkConfig. Half of odd batches are rounded up!

func GenerateARMID

func GenerateARMID(nc *v1alpha.NetworkContainer) string

GenerateARMID uses the Subnet ARM ID format to populate the ARM ID with the metadata. If either of the metadata attributes are empty, then the ARM ID will be an empty string.

Types

type Monitor

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

func NewMonitor

func NewMonitor(httpService cns.HTTPService, nnccli nodeNetworkConfigSpecUpdater, cssSource <-chan v1alpha1.ClusterSubnetState, opts *Options) *Monitor

func (*Monitor) GetStateSnapshot

func (pm *Monitor) GetStateSnapshot() cns.IpamPoolMonitorStateSnapshot

GetStateSnapshot gets a snapshot of the IPAMPoolMonitor struct.

func (*Monitor) Start

func (pm *Monitor) Start(ctx context.Context) error

Start begins the Monitor's pool reconcile loop. On first run, it will block until a NodeNetworkConfig is received (through a call to Update()). Subsequently, it will run run once per RefreshDelay and attempt to re-reconcile the pool.

func (*Monitor) Update

func (pm *Monitor) Update(nnc *v1alpha.NodeNetworkConfig) error

Update ingests a NodeNetworkConfig, clamping some values to ensure they are legal and then pushing it to the Monitor's source channel. If the Monitor has been Started but is blocking until it receives an NNC, this will start the pool reconcile loop. If the Monitor has not been Started, this will block until Start() is called, which will immediately read this passed NNC and start the pool reconcile loop.

type Options

type Options struct {
	RefreshDelay time.Duration
	MaxIPs       int64
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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