Documentation
¶
Index ¶
Constants ¶
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 ¶
func (a *NVIPAMIPAllocator) Allocate(ctx context.Context, req NVIPAMIPAllocatorRequest) error
Allocate allocates an IP from the NVIPAM given the input request
func (*NVIPAMIPAllocator) Deallocate ¶
func (a *NVIPAMIPAllocator) Deallocate(ctx context.Context, req NVIPAMIPAllocatorRequest) error
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" )