ipallocator

package
v0.1.0-latest-stable Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2026 License: Apache-2.0 Imports: 11 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const CNIBinDir = "/opt/cni/bin"

CNIBinDir is the directory which contains the CNI binaries

Variables

This section is empty.

Functions

This section is empty.

Types

type NVIPAMIPAllocator

type NVIPAMIPAllocator struct {

	// FileSystemRoot controls the file system root. It's used for enabling easier testing of the package. Defaults to
	// empty.
	FileSystemRoot string
	// contains filtered or unexported fields
}

NVIPAMIPAllocator uses the CNI spec to allocate an IP from NVIPAM

func New

func New(cninet *libcni.CNIConfig, podName string, podNamespace string, podUID string) *NVIPAMIPAllocator

New creates a new IPAllocator that can handle allocation of IPs using the NVIPAM.

func (*NVIPAMIPAllocator) Allocate

Allocate allocates an IP from the NVIPAM given the input request

func (*NVIPAMIPAllocator) Deallocate

Deallocate deallocates the allocated IP from the NVIPAM

func (*NVIPAMIPAllocator) ParseRequests

func (a *NVIPAMIPAllocator) ParseRequests(requests string) ([]NVIPAMIPAllocatorRequest, error)

ParseRequests parses requests from the given input. This input is supposed to be a list of json objects.

type NVIPAMIPAllocatorRequest

type NVIPAMIPAllocatorRequest struct {
	// Name is the name of the request. Determines the file the result will be written to.
	Name string `json:"name"`
	// PoolName is the name of the NVIPAM pool we should request an IP from
	PoolName string `json:"poolName"`
	// PoolType is the type of the NVIPAM pool we should request an IP from. If empty, we defer to the default defined
	// by NVIPAM.
	PoolType NVIPAMPoolType `json:"poolType,omitempty"`
	// AllocateIPWIthIndex instructs NVIPAM to allocate the IP with the given index from the chunk of the pool that is
	// allocated for the node
	AllocateIPWIthIndex *int32 `json:"allocateIPWithIndex,omitempty"`
}

NVIPAMIPAllocatorRequest is a struct that contains the fields a request to the IP Allocator can have

type NVIPAMIPAllocatorResult

type NVIPAMIPAllocatorResult struct {
	// IP is the allocated IP in CIDR format
	IP string `json:"ip"`
	// Gateway is the gateway of the subnet the IP belongs to
	Gateway string `json:"gateway"`
}

NVIPAMIPAllocatorResult is a struct that contains the fields the result of the IP Allocator will write to a file per request for each IP allocated.

type NVIPAMPoolType

type NVIPAMPoolType string

NVIPAMPoolType are the supported NVIPAM pools types

const (
	// PoolTypeIPPool contains string representation for pool type of IPPool
	PoolTypeIPPool NVIPAMPoolType = "ippool"
	// PoolTypeCIDRPool contains string representation for pool type of CIDRPool
	PoolTypeCIDRPool NVIPAMPoolType = "cidrpool"
)

Jump to

Keyboard shortcuts

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