ipam

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2023 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CIDRAllocator

type CIDRAllocator interface {
	// AllocateOrOccupyCIDR looks at the given node, assigns it a valid
	// CIDR if it doesn't currently have one or mark the CIDR as used if
	// the node already have one.
	AllocateOrOccupyCIDR(logger klog.Logger, node *corev1.Node) error
	// ReleaseCIDR releases the CIDR of the removed node.
	ReleaseCIDR(logger klog.Logger, node *corev1.Node) error
	// Run starts all the working logic of the allocator.
	Run(ctx context.Context)
}

CIDRAllocator is an interface implemented by things that know how to allocate/occupy/recycle CIDR for nodes.

func NewMultiCIDRRangeAllocator

func NewMultiCIDRRangeAllocator(
	ctx context.Context,
	client clientset.Interface,
	networkClient clustercidrclient.ClusterCIDRInterface,
	nodeInformer informers.NodeInformer,
	clusterCIDRInformer clustercidrinformers.ClusterCIDRInformer,
	allocatorParams CIDRAllocatorParams,
	nodeList *corev1.NodeList,
	testCIDRMap map[string][]*cidrset.ClusterCIDR,
) (CIDRAllocator, error)

NewMultiCIDRRangeAllocator returns a CIDRAllocator to allocate CIDRs for node (one for each ip family). Caller must always pass in a list of existing nodes to the new allocator. NodeList is only nil in testing.

type CIDRAllocatorParams

type CIDRAllocatorParams struct {
	// ClusterCIDRs is list of cluster cidrs.
	ClusterCIDRs []*net.IPNet
	// ServiceCIDR is primary service cidr for cluster.
	ServiceCIDR *net.IPNet
	// SecondaryServiceCIDR is secondary service cidr for cluster.
	SecondaryServiceCIDR *net.IPNet
	// NodeCIDRMaskSizes is list of node cidr mask sizes.
	NodeCIDRMaskSizes []int
}

CIDRAllocatorParams is parameters that's required for creating new cidr range allocator.

type PriorityQueue

type PriorityQueue []*PriorityQueueItem

A PriorityQueue implements heap.Interface and holds PriorityQueueItems.

func (PriorityQueue) Len

func (pq PriorityQueue) Len() int

func (PriorityQueue) Less

func (pq PriorityQueue) Less(i, j int) bool

Less compares the priority queue items, to store in a min heap. Less(i,j) == true denotes i has higher priority than j.

func (*PriorityQueue) Pop

func (pq *PriorityQueue) Pop() interface{}

func (*PriorityQueue) Push

func (pq *PriorityQueue) Push(x interface{})

func (PriorityQueue) Swap

func (pq PriorityQueue) Swap(i, j int)

type PriorityQueueItem

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

An PriorityQueueItem is something we manage in a priority queue.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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