Documentation ¶
Overview ¶
Package ipam that specifies the contract the IPAM plugin need to satisfy, decoupling IPAM interface and implementation.
Index ¶
- Variables
- type AddressRequest
- type AddressResponse
- type AddressSpace
- type Allocator
- func (a *Allocator) AddSubnet(addrSpace AddressSpace, subnetInfo *SubnetInfo) error
- func (a *Allocator) AddVendorInfo([]byte) error
- func (a *Allocator) DumpDatabase()
- func (a *Allocator) Exists() bool
- func (a *Allocator) Index() uint64
- func (a *Allocator) Key() []string
- func (a *Allocator) KeyPrefix() []string
- func (a *Allocator) Release(addrSpace AddressSpace, address net.IP)
- func (a *Allocator) RemoveSubnet(addrSpace AddressSpace, subnet *net.IPNet) error
- func (a *Allocator) Request(addrSpace AddressSpace, req *AddressRequest) (*AddressResponse, error)
- func (a *Allocator) RequestV6(addrSpace AddressSpace, req *AddressRequest) (*AddressResponse, error)
- func (a *Allocator) SetIndex(index uint64)
- func (a *Allocator) SetValue(value []byte) error
- func (a *Allocator) Value() []byte
- type Config
- type IPAM
- type SubnetInfo
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidIpamService = errors.New("Invalid IPAM Service") ErrInvalidIpamConfigService = errors.New("Invalid IPAM Config Service") ErrIpamNotAvailable = errors.New("IPAM Service not available") ErrIpamInternalError = errors.New("IPAM Internal Error") ErrInvalidAddressSpace = errors.New("Invalid Address Space") ErrInvalidSubnet = errors.New("Invalid Subnet") ErrInvalidRequest = errors.New("Invalid Request") ErrSubnetNotFound = errors.New("Subnet not found") ErrOverlapSubnet = errors.New("Subnet overlaps with existing subnet on this address space") ErrNoAvailableSubnet = errors.New("No available subnet") ErrNoAvailableIPs = errors.New("No available addresses on subnet") ErrIPAlreadyAllocated = errors.New("Address already in use") ErrIPOutOfRange = errors.New("Requested address is out of range") ErrSubnetAlreadyRegistered = errors.New("Subnet already registered on this address space") ErrBadSubnet = errors.New("Address space does not contain specified subnet") )
ErrIpamNotAvailable is returned when the plugin prviding the IPAM service is not available
Functions ¶
This section is empty.
Types ¶
type AddressRequest ¶
type AddressRequest struct { Subnet net.IPNet // Preferred subnet pool (Optional) Address net.IP // Preferred address (Optional) Endpoint string // For static IP mapping (Optional) OpaqueData []byte // Vendor specific request data }
AddressRequest encloses the information a client needs to pass to IPAM when requesting an address
func (*AddressRequest) Validate ¶
func (req *AddressRequest) Validate() error
Validate runs syntactic validation on this AddressRequest object
type AddressResponse ¶
type AddressResponse struct { Address net.IP Subnet SubnetInfo }
AddressResponse represents the IPAM service's response to an address request
type AddressSpace ¶
type AddressSpace string
AddressSpace identifies a unique pool of network addresses
type Allocator ¶
Allocator provides per address space ipv4/ipv6 book keeping
func NewAllocator ¶
NewAllocator returns an instance of libnetwork ipam
func (*Allocator) AddSubnet ¶
func (a *Allocator) AddSubnet(addrSpace AddressSpace, subnetInfo *SubnetInfo) error
AddSubnet adds a subnet for the specified address space
func (*Allocator) AddVendorInfo ¶
AddVendorInfo adds vendor specific data
func (*Allocator) DumpDatabase ¶
func (a *Allocator) DumpDatabase()
DumpDatabase dumps the internal info
func (*Allocator) KeyPrefix ¶
KeyPrefix returns the immediate parent key that can be used for tree walk
func (*Allocator) Release ¶
func (a *Allocator) Release(addrSpace AddressSpace, address net.IP)
Release allows releasing the address from the specified address space
func (*Allocator) RemoveSubnet ¶
func (a *Allocator) RemoveSubnet(addrSpace AddressSpace, subnet *net.IPNet) error
RemoveSubnet removes the subnet from the specified address space
func (*Allocator) Request ¶
func (a *Allocator) Request(addrSpace AddressSpace, req *AddressRequest) (*AddressResponse, error)
Request allows requesting an IPv4 address from the specified address space
func (*Allocator) RequestV6 ¶
func (a *Allocator) RequestV6(addrSpace AddressSpace, req *AddressRequest) (*AddressResponse, error)
RequestV6 requesting an IPv6 address from the specified address space
func (*Allocator) SetIndex ¶
SetIndex method allows the datastore to store the latest DB Index into this object
type Config ¶
type Config interface { // AddSubnet adds a subnet to the specified address space AddSubnet(AddressSpace, *SubnetInfo) error // RemoveSubnet removes a subnet from the specified address space RemoveSubnet(AddressSpace, *net.IPNet) error // AddVendorInfo adds Vendor specific data AddVendorInfo([]byte) error }
Config represents the interface the IPAM service plugins must implement in order to allow injection/modification of IPAM database. Common key is a addressspace
type IPAM ¶
type IPAM interface { // Request address from the specified address space Request(AddressSpace, *AddressRequest) (*AddressResponse, error) // Separate API for IPv6 RequestV6(AddressSpace, *AddressRequest) (*AddressResponse, error) // Release the address from the specified address space Release(AddressSpace, net.IP) }
IPAM defines the interface that needs to be implemented by IPAM service plugin Common key is a unique address space identifier