{"modulePath":"github.com/nvidia/doca-platform","version":"v0.1.0-latest-stable","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package ipallocator\n\n## Constants\n\n```go\nconst CNIBinDir = \"/opt/cni/bin\"\n```\nCNIBinDir is the directory which contains the CNI binaries\n\n## Types\n\n```go\ntype NVIPAMIPAllocator struct {\n\n\t// FileSystemRoot controls the file system root. It's used for enabling easier testing of the package. Defaults to\n\t// empty.\n\tFileSystemRoot string\n\t// contains filtered or unexported fields\n}\n```\nNVIPAMIPAllocator uses the CNI spec to allocate an IP from NVIPAM\n\n```go\nfunc New(cninet *libcni.CNIConfig, podName string, podNamespace string, podUID string) *NVIPAMIPAllocator\n```\nNew creates a new IPAllocator that can handle allocation of IPs using the NVIPAM.\n\n```go\nfunc (a *NVIPAMIPAllocator) Allocate(ctx context.Context, req NVIPAMIPAllocatorRequest) error\n```\nAllocate allocates an IP from the NVIPAM given the input request\n\n```go\nfunc (a *NVIPAMIPAllocator) Deallocate(ctx context.Context, req NVIPAMIPAllocatorRequest) error\n```\nDeallocate deallocates the allocated IP from the NVIPAM\n\n```go\nfunc (a *NVIPAMIPAllocator) ParseRequests(requests string) ([]NVIPAMIPAllocatorRequest, error)\n```\nParseRequests parses requests from the given input. This input is supposed to be a list of json objects.\n\n```go\ntype NVIPAMIPAllocatorRequest struct {\n\t// Name is the name of the request. Determines the file the result will be written to.\n\tName string `json:\"name\"`\n\t// PoolName is the name of the NVIPAM pool we should request an IP from\n\tPoolName string `json:\"poolName\"`\n\t// PoolType is the type of the NVIPAM pool we should request an IP from. If empty, we defer to the default defined\n\t// by NVIPAM.\n\tPoolType NVIPAMPoolType `json:\"poolType,omitempty\"`\n\t// AllocateIPWIthIndex instructs NVIPAM to allocate the IP with the given index from the chunk of the pool that is\n\t// allocated for the node\n\tAllocateIPWIthIndex *int32 `json:\"allocateIPWithIndex,omitempty\"`\n}\n```\nNVIPAMIPAllocatorRequest is a struct that contains the fields a request to the IP Allocator can have\n\n```go\ntype NVIPAMIPAllocatorResult struct {\n\t// IP is the allocated IP in CIDR format\n\tIP string `json:\"ip\"`\n\t// Gateway is the gateway of the subnet the IP belongs to\n\tGateway string `json:\"gateway\"`\n}\n```\nNVIPAMIPAllocatorResult is a struct that contains the fields the result of the IP Allocator will write to a file per request for each IP allocated.\n\n```go\ntype NVIPAMPoolType string\n```\nNVIPAMPoolType are the supported NVIPAM pools types\n\n```go\nconst (\n\t// PoolTypeIPPool contains string representation for pool type of IPPool\n\tPoolTypeIPPool NVIPAMPoolType = \"ippool\"\n\t// PoolTypeCIDRPool contains string representation for pool type of CIDRPool\n\tPoolTypeCIDRPool NVIPAMPoolType = \"cidrpool\"\n)\n```\n\n","path":"github.com/nvidia/doca-platform/pkg/ipallocator","name":"ipallocator","synopsis":"","isRedistributable":true}
