podcidr

package
v0.0.0-...-c34bea4 Latest Latest
Warning

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

Go to latest
Published: May 20, 2022 License: Apache-2.0 Imports: 22 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 {
	fmt.Stringer

	Occupy(cidr *net.IPNet) error
	AllocateNext() (*net.IPNet, error)
	Release(cidr *net.IPNet) error
	IsAllocated(cidr *net.IPNet) (bool, error)
	IsIPv6() bool
	IsFull() bool
	InRange(cidr *net.IPNet) bool
}

type ErrAllocatorFull

type ErrAllocatorFull struct{}

ErrAllocatorFull ...

func (*ErrAllocatorFull) Error

func (e *ErrAllocatorFull) Error() string

Error returns the human-readable error for the ErrAllocatorFull

type ErrAllocatorNotFound

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

ErrAllocatorNotFound is an error that should be used in case the node tries to allocate a CIDR for an allocator that does not exist.

func (*ErrAllocatorNotFound) Error

func (e *ErrAllocatorNotFound) Error() string

Error returns the human-readable error for the ErrAllocatorNotFound

type ErrCIDRAllocated

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

ErrCIDRAllocated is an error that should be used when the requested CIDR is already allocated.

func (*ErrCIDRAllocated) Error

func (e *ErrCIDRAllocated) Error() string

Error returns the human-readable error for the ErrAllocatorNotFound

type ErrNoAllocators

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

ErrNoAllocators is an error that returned if no allocators are available to allocate a CIDR. This can often be a configuration problem.

func (ErrNoAllocators) Error

func (e ErrNoAllocators) Error() string

Error returns the human-readable error for the ErrNoAllocators.

type NodesPodCIDRManager

type NodesPodCIDRManager struct {

	// Lock protects all fields below
	lock.Mutex
	// contains filtered or unexported fields
}

NodesPodCIDRManager will be used to manage podCIDRs for the nodes in the cluster.

func NewNodesPodCIDRManager

func NewNodesPodCIDRManager(
	v4Allocators, v6Allocators []CIDRAllocator,
	nodeGetter ipam.CiliumNodeGetterUpdater,
	triggerMetrics trigger.MetricsObserver) *NodesPodCIDRManager

NewNodesPodCIDRManager will create a node podCIDR manager. Both v4Allocators and v6Allocators can be nil, but not at the same time. nodeGetter will be used to populate synced node status / spec with kubernetes.

func (*NodesPodCIDRManager) Create

func (n *NodesPodCIDRManager) Create(node *v2.CiliumNode) bool

Create will re-allocate the node podCIDRs. In case the node already has podCIDRs allocated, the podCIDR allocator will try to allocate those CIDRs internally. In case the node does not have any podCIDR set, its allocation will only happen once n.Resync has been called at least one time. In case the CIDRs were able to be allocated, the CiliumNode will have its podCIDRs fields set with the allocated CIDRs. In case the CIDRs were unable to be allocated, this function will return true and the node will have its status updated into kubernetes with the error message by the NodesPodCIDRManager.

func (*NodesPodCIDRManager) Delete

func (n *NodesPodCIDRManager) Delete(nodeName string)

Delete deletes the node from the allocator and releases the associated CIDRs of that node.

func (*NodesPodCIDRManager) Resync

Resync resyncs the nodes with k8s.

func (*NodesPodCIDRManager) Update

func (n *NodesPodCIDRManager) Update(node *v2.CiliumNode) bool

Update will re-allocate the node podCIDRs. In case the node already has podCIDRs allocated, the podCIDR allocator will try to allocate those CIDRs. In case the CIDRs were able to be allocated, the CiliumNode will have its podCIDRs fields set with the allocated CIDRs. In case the CIDRs were unable to be allocated, this function will return true and the node will have its status updated into kubernetes with the error message by the NodesPodCIDRManager.

Jump to

Keyboard shortcuts

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