Skip to content

Commit 3702cb6

Browse files
committed
Merge pull request #958 from aboch/dc
Fix IPAM driver documentation
2 parents f198d12 + b99d8bc commit 3702cb6

1 file changed

Lines changed: 20 additions & 26 deletions

File tree

docs/ipam.md

Lines changed: 20 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -24,31 +24,20 @@ It is the remote driver's responsibility to manage its database.
2424

2525
## Ipam Contract
2626

27-
The IPAM driver (internal or remote) has to comply with the contract specified in `ipamapi.contract.go`:
27+
The remote IPAM driver must serve the following requests:
2828

29-
```go
30-
// Ipam represents the interface the IPAM service plugins must implement
31-
// in order to allow injection/modification of IPAM database.
32-
type Ipam interface {
33-
// GetDefaultAddressSpaces returns the default local and global address spaces for this ipam
34-
GetDefaultAddressSpaces() (string, string, error)
35-
// RequestPool returns an address pool along with its unique id. Address space is a mandatory field
36-
// which denotes a set of non-overlapping pools. pool describes the pool of addresses in CIDR notation.
37-
// subpool indicates a smaller range of addresses from the pool, for now it is specified in CIDR notation.
38-
// Both pool and subpool are non mandatory fields. When they are not specified, Ipam driver may choose to
39-
// return a self chosen pool for this request. In such case the v6 flag needs to be set appropriately so
40-
// that the driver would return the expected ip version pool.
41-
RequestPool(addressSpace, pool, subPool string, options map[string]string, v6 bool) (string, *net.IPNet, map[string]string, error)
42-
// ReleasePool releases the address pool identified by the passed id
43-
ReleasePool(poolID string) error
44-
// Request address from the specified pool ID. Input options or required IP can be passed.
45-
RequestAddress(string, net.IP, map[string]string) (*net.IPNet, map[string]string, error)
46-
// Release the address from the specified pool ID
47-
ReleaseAddress(string, net.IP) error
48-
}
49-
```
29+
- **GetDefaultAddressSpaces**
30+
31+
- **RequestPool**
32+
33+
- **ReleasePool**
34+
35+
- **Request address**
5036

51-
The following sections explain the each of the above API's semantics, when they are called during network/endpoint lifecycle, and the corresponding payload for remote driver HTTP request/responses.
37+
- **Release address**
38+
39+
40+
The following sections explain each of the above requests' semantic, when they are called during network/endpoint lifecycle, and the corresponding payload for remote driver HTTP request/responses.
5241

5342

5443
## IPAM Configuration and flow
@@ -148,13 +137,13 @@ For this API, the remote driver will receive a POST message to the URL `/IpamDri
148137

149138
Where:
150139

151-
* `AddressSpace` the IP address space
140+
* `AddressSpace` the IP address space. It denotes a set of non-overlapping pools.
152141
* `Pool` The IPv4 or IPv6 address pool in CIDR format
153142
* `SubPool` An optional subset of the address pool, an ip range in CIDR format
154143
* `Options` A map of IPAM driver specific options
155144
* `V6` Whether an IPAM self-chosen pool should be IPv6
156145

157-
AddressSpace is the only mandatory field. If no `Pool` is specified IPAM driver may return a self chosen address pool. In such case, `V6` flag must be set if caller wants an IPAM-chosen IPv6 pool. A request with empty `Pool` and non-empty `SubPool` should be rejected as invalid.
146+
AddressSpace is the only mandatory field. If no `Pool` is specified IPAM driver may choose to return a self chosen address pool. In such case, `V6` flag must be set if caller wants an IPAM-chosen IPv6 pool. A request with empty `Pool` and non-empty `SubPool` should be rejected as invalid.
158147
If a `Pool` is not specified IPAM will allocate one of the default pools. When `Pool` is not specified, the `V6` flag should be set if the network needs IPv6 addresses to be allocated.
159148

160149
A successful response is in the form:
@@ -272,4 +261,9 @@ As of now libnetwork accepts the following capabilities:
272261
### RequiresMACAddress
273262

274263
It is a boolean value which tells libnetwork whether the ipam driver needs to know the interface MAC address in order to properly process the `RequestAddress()` call.
275-
If true, on `CreateEndpoint()` request, libnetwork will generate a random MAC address for the endpoint (if an explicit MAC address was not already provided by the user) and pass it to `RequestAddress()` when requesting the IP address inside the options map. The key will be the `netlabel.MacAddress` constant: `"com.docker.network.endpoint.macaddress"`.
264+
If true, on `CreateEndpoint()` request, libnetwork will generate a random MAC address for the endpoint (if an explicit MAC address was not already provided by the user) and pass it to `RequestAddress()` when requesting the IP address inside the options map. The key will be the `netlabel.MacAddress` constant: `"com.docker.network.endpoint.macaddress"`.
265+
266+
267+
## Appendix
268+
269+
A Go extension for the IPAM remote API is available at [docker/go-plugins-helpers/ipam](https://github.com/docker/go-plugins-helpers/tree/master/ipam)

0 commit comments

Comments
 (0)