Factor an API out into a module
authorMichael Bridgen <mikeb@squaremobius.net>
Fri, 7 Aug 2015 15:27:52 +0000 (16:27 +0100)
committerMichael Bridgen <mikeb@squaremobius.net>
Wed, 16 Sep 2015 09:14:39 +0000 (10:14 +0100)
commitb88f173c43b9ed7f63a3e849fee6dd63d0b890f1
treee9ad871633197388acaf74c69881162a3a69e9d0
parent5da5738456e27a781d7a534a35aa55b9e0159526
Factor an API out into a module

This takes some of the machinery from CNI and from the rkt networking
code, and turns it into a library that can be linked into go apps.

Included is an example command-line application that uses the library,
called `cnitool`.

Other headline changes:

 * Plugin exec'ing is factored out

The motivation here is to factor out the protocol for invoking
plugins. To that end, a generalisation of the code from api.go and
pkg/plugin/ipam.go goes into pkg/invoke/exec.go.

 * Move argument-handling and conf-loading into public API

The fact that the arguments get turned into an environment for the
plugin is incidental to the API; so, provide a way of supplying them
as a struct or saying "just use the same arguments as I got" (the
latter is for IPAM plugins).
28 files changed:
README.md
build
cnitool/cni.go [new file with mode: 0644]
libcni/api.go [new file with mode: 0644]
libcni/conf.go [new file with mode: 0644]
pkg/invoke/args.go [new file with mode: 0644]
pkg/invoke/exec.go [new file with mode: 0644]
pkg/invoke/find.go [new file with mode: 0644]
pkg/ip/cidr.go
pkg/ipam/ipam.go [new file with mode: 0644]
pkg/plugin/ipam.go [deleted file]
pkg/skel/skel.go
pkg/types/args.go [moved from pkg/plugin/args.go with 56% similarity]
pkg/types/types.go [moved from pkg/plugin/types.go with 73% similarity]
plugins/ipam/dhcp/daemon.go
plugins/ipam/dhcp/lease.go
plugins/ipam/dhcp/main.go
plugins/ipam/dhcp/options.go
plugins/ipam/dhcp/options_test.go
plugins/ipam/host-local/allocator.go
plugins/ipam/host-local/config.go
plugins/ipam/host-local/main.go
plugins/main/bridge/bridge.go
plugins/main/ipvlan/ipvlan.go
plugins/main/macvlan/macvlan.go
plugins/main/ptp/ptp.go
plugins/meta/flannel/flannel.go
test