IP Address Management: Creation flow

Registered by Antoni Segura Puimedon

To manage IP Address allocation Kuryr must create the networks when libnetwork issues NetworkCreate. For subnet creation, the approach should be:

1. The user creates a subnet pool:
     neutron subnetpool-create –default-prefixlen 24 –pool-prefix 10.10.0.0/16 kuryr
2. The user sets the pool name in /etc/kuryr/kuryr.conf
     subnet_pools_v4=kuryr,other
     subnet_pools_v6=kuryrv6
3. On libnetwork's EndpointCreate,
     if libnetwork passes a CIDR for the endpoint:
         a) Check if the network has a subnet with that CIDR. If it does not create it
         b) Use the subnet that matches the CIDR.
     If it does not:
         a) Check if subnets called Defaultv4 and Defaultv6 exist for the network and otherwise create them from the configured pools.
         b) Use the default subnets.
4. Create a port on the selected subnets.

Blueprint information

Status:
Complete
Approver:
Irena Berezovsky
Priority:
Undefined
Drafter:
Antoni Segura Puimedon
Direction:
Needs approval
Assignee:
Taku Fukushima
Definition:
Obsolete
Series goal:
None
Implementation:
Unknown
Milestone target:
None
Completed by
Antoni Segura Puimedon

Related branches

Sprints

Whiteboard

(danehans): Take a look how Weave's libnetwork remote driver implements IPAM:

https://github.com/weaveworks/docker-plugin/blob/master/plugin/driver/ipam.go

Could be a good reference model for this work. Workflow SUmmary of Weave IPAM:

1. ipam of driver uses Docker client to obatin the ip address of the weave container (b/c it runs a DHCP server).
2. ipam of driver checks the status of weave using http (lloking for an http response code)
3. ipam of driver parses the CIDR of the Docker bridge IP to get the network
4. ipam of driver returns an IP for the container ID to the Docker client, allocating a fresh one if necessary or nil if one has not been allocated
5. ipam of driver releases an IP which is no longer needed
6. The driver (driver.go) requests from the ipam driver (ipam.go) to allocate an IP to the endpoint during the endpoint creation.

Endpoint create includes the IP allocation functionality. Containers then attach to the Endpoint ID (Neutron subnet ID)

The main driver also performs these functions:

1. Creates veth pair
2. Creates a mac addr for the container
3. Weave driver implements DNS, registering/de-registering container IP-to-hostname mapping? Should similar functionality be implemented in Kuryr?
4. Also sets IP of DNS Server.

It appears that endpoint is equivalent to Neutron subnet.

(/danehans)

(Vikas)
 IMHO, now with docker 1.9.0_rc1 ,we will not need to create default subnets explicitly. Even if user is not giving any subnet, built-in ipam driver will pass default subnet in json input to kuryr network driver. Should we keep current changes also where default subnets are configured in kuryr config for backward compatibility with older docker versions?

(/Vikas)

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.