Documentation ¶
Overview ¶
This package is an experiment in making a remote ipam driver for docker. Most of the code here was lifted from github.com/docker/libnetwork/ipam, the default docker ipam, which is copyright Docker Inc.
Index ¶
- type AddressRange
- type Allocator
- func (a *Allocator) DumpDatabase() string
- func (a *Allocator) GetDefaultAddressSpaces() (string, string, error)
- func (a *Allocator) ReleaseAddress(poolID string, address net.IP) error
- func (a *Allocator) ReleasePool(poolID string) error
- func (a *Allocator) RequestAddress(poolID string, prefAddress net.IP, opts map[string]string) (*net.IPNet, map[string]string, error)
- func (a *Allocator) RequestPool(addressSpace, pool, subPool string, options map[string]string, v6 bool) (string, *net.IPNet, map[string]string, error)
- type IPAMDriver
- func (ipd *IPAMDriver) GetCapabilities() (*ipam.CapabilitiesResponse, error)
- func (ipd *IPAMDriver) GetDefaultAddressSpaces() (*ipam.AddressSpacesResponse, error)
- func (ipd *IPAMDriver) ReleaseAddress(req *ipam.ReleaseAddressRequest) error
- func (ipd *IPAMDriver) ReleasePool(req *ipam.ReleasePoolRequest) error
- func (ipd *IPAMDriver) RequestAddress(req *ipam.RequestAddressRequest) (*ipam.RequestAddressResponse, error)
- func (ipd *IPAMDriver) RequestPool(pool *ipam.RequestPoolRequest) (*ipam.RequestPoolResponse, error)
- type PoolData
- type SubnetKey
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddressRange ¶
AddressRange specifies first and last ip ordinal which identify a range in a a pool of addresses
func (*AddressRange) MarshalJSON ¶
func (r *AddressRange) MarshalJSON() ([]byte, error)
MarshalJSON returns the JSON encoding of the Range object
func (*AddressRange) String ¶
func (r *AddressRange) String() string
String returns the string form of the AddressRange object
func (*AddressRange) UnmarshalJSON ¶
func (r *AddressRange) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes data into the Range object
type Allocator ¶
Allocator provides per address space ipv4/ipv6 book keeping
func NewAllocator ¶
NewAllocator returns an instance of libnetwork ipam
func (*Allocator) DumpDatabase ¶
DumpDatabase dumps the internal info
func (*Allocator) GetDefaultAddressSpaces ¶
GetDefaultAddressSpaces returns the local and global default address spaces
func (*Allocator) ReleaseAddress ¶
ReleaseAddress releases the address from the specified pool ID
func (*Allocator) ReleasePool ¶
ReleasePool releases the address pool identified by the passed id
type IPAMDriver ¶
type IPAMDriver struct { Addresses ipam.AddressSpacesResponse Alloc *Allocator }
This implements the Ipam interface
func NewIPAMDriver ¶
func NewIPAMDriver(Addresses *ipam.AddressSpacesResponse, cfg *datastore.ScopeCfg) (*IPAMDriver, error)
This creates a new instance of IPAMDriver
func (*IPAMDriver) GetCapabilities ¶
func (ipd *IPAMDriver) GetCapabilities() (*ipam.CapabilitiesResponse, error)
Callback for our driver to determine whether or not it requires
func (*IPAMDriver) GetDefaultAddressSpaces ¶
func (ipd *IPAMDriver) GetDefaultAddressSpaces() (*ipam.AddressSpacesResponse, error)
GetDefaultAddressSpaces returns the default local and global address spaces for this ipam
func (*IPAMDriver) ReleaseAddress ¶
func (ipd *IPAMDriver) ReleaseAddress(req *ipam.ReleaseAddressRequest) error
Releases an address (not just a clever name)
func (*IPAMDriver) ReleasePool ¶
func (ipd *IPAMDriver) ReleasePool(req *ipam.ReleasePoolRequest) error
Release the address from the specified pool ID
func (*IPAMDriver) RequestAddress ¶
func (ipd *IPAMDriver) RequestAddress(req *ipam.RequestAddressRequest) (*ipam.RequestAddressResponse, error)
Request an Address
func (*IPAMDriver) RequestPool ¶
func (ipd *IPAMDriver) RequestPool(pool *ipam.RequestPoolRequest) (*ipam.RequestPoolResponse, error)
RequestPool returns an address pool along with its unique id. Address space is a mandatory field which denotes a set of non-overlapping pools. pool describes the pool of addresses in CIDR notation. subpool indicates a smaller range of addresses from the pool, for now it is specified in CIDR notation. Both pool and subpool are non mandatory fields. When they are not specified, Ipam driver may choose to return a self chosen pool for this request. In such case the v6 flag needs to be set appropriately so that the driver would return the expected ip version pool.
type PoolData ¶
type PoolData struct { ParentKey SubnetKey Pool *net.IPNet Range *AddressRange `json:",omitempty"` RefCount int }
PoolData contains the configured pool data
func (*PoolData) MarshalJSON ¶
MarshalJSON returns the JSON encoding of the PoolData object
func (*PoolData) UnmarshalJSON ¶
UnmarshalJSON decodes data into the PoolData object
type SubnetKey ¶
SubnetKey is the pointer to the configured pools in each address space
func (*SubnetKey) FromString ¶
FromString populate the SubnetKey object reading it from string