Support CNI_ARGS in static IPAM plugin

This change is to add CNI_ARGS support in static IPAM plugin.
When IP/SUBNET/GATEWAY are given in CNI_ARGS, static IPAM adds
these info in addition to config files.

To configure ip address only from CNI_ARGS, 'address' field in config
is changed to optional from required.
This commit is contained in:
Tomofumi Hayashi
2018-06-18 15:46:48 +09:00
parent 1d973f59d2
commit 6da1cb7876
3 changed files with 119 additions and 5 deletions

View File

@@ -38,8 +38,17 @@ static IPAM is very simple IPAM plugin that assigns IPv4 and IPv6 addresses stat
## Network configuration reference
* `type` (string, required): "static"
* `addresses` (array, required): an array of arrays of ip address objects:
* `addresses` (array, optional): an array of arrays of ip address objects:
* `address` (string, required): CIDR notation IP address.
* `gateway` (string, optional): IP inside of "subnet" to designate as the gateway.
* `routes` (string, optional): list of routes add to the container namespace. Each route is a dictionary with "dst" and optional "gw" fields. If "gw" is omitted, value of "gateway" will be used.
* `dns` (string, optional): the dictionary with "nameservers", "domain" and "search".
## Supported arguments
The following [CNI_ARGS](https://github.com/containernetworking/cni/blob/master/SPEC.md#parameters) are supported:
* `IP`: request a specific IP address from a subnet
* `SUBNET`: request a specific subnet
* `GATEWAY`: request a specific gateway address
(example: CNI_ARGS="IP=10.10.0.1;SUBNET=10.10.0.0/24;GATEWAY=10.10.0.254")