18 Commits

Author SHA1 Message Date
Gabe Rosenhouse
2515b8c712 skel: adds PluginMainWithError which returns a *types.Error
Enables plugins to do their own error-handling and cleanup logic
2017-01-22 16:57:42 -08:00
Gabe Rosenhouse
04ba7c7761 versioning: plugins require version match with config
infer version 0.1.0 when config is missing an explicit "cniVersion" field
2016-09-19 13:00:49 -07:00
Gabe Rosenhouse
921292ff77 skel: Plugins require a cniVersion in the NetConf 2016-09-18 21:30:57 -07:00
Gabe Rosenhouse
b1e254d901 versioning: plugins report a list of supported versions
Further progress on versioning support (Issue #266).
Bump CNI spec version to 0.3.0
2016-09-02 11:26:17 -04:00
Tom Denham
415d707faf Merge pull request #267 from rosenhouse/version-cmd
Adds VERSION command
2016-08-12 15:06:22 -07:00
Gabe Rosenhouse
728071e7d1 misc: fix up copyright dates 2016-07-14 16:09:27 -07:00
Gabe Rosenhouse
30c99d17cc pkg/skel: plugins now respond to VERSION command
To support CNI spec versioning, plugins must be able to report version
information to container runtimes.
2016-07-14 00:24:32 -04:00
Gabe Rosenhouse
eda79f7645 pkg/skel: improve error message for missing CNI_COMMAND env var
This makes the error message for missing CNI_COMMAND consistent with
that of other required environment variables.
2016-07-14 00:24:32 -04:00
Gabe Rosenhouse
f2b6ec0375 pkg/skel: missing env var log lines appear in stderr
Previously, the log lines appeared in stdout before the JSON encoding of
the error message.  That would break JSON parsing of stdout.  Instead, we use
stderr for these unstructured logs, consistent with the CNI spec.
2016-07-14 00:24:27 -04:00
Gabe Rosenhouse
3c43314926 pkg/skel: refactor to use dependency injection
Extract dependencies on os to enable more complete unit test coverage
2016-07-14 00:06:58 -04:00
Stefan Junker
5fe036b88a plugins: don't require CNI_NETNS for DEL command
This will allow to free up the IPAM allocations when the caller doesn't
have access to the network namespace anymore, e.g. due to a reboot.
2016-05-27 10:57:39 +02:00
Stefan Junker
d7de8d4f98 pkg/skel: allow arg requriements specified by CMD 2016-05-27 10:56:24 +02:00
Stefan Junker
fc229c5090 *: appc/cni -> containernetworking/cni
The project has been moved so internally we simply rename everything.
Consumers are recommended to update their vendored version of cni.
2016-05-19 12:06:36 +02:00
Eugene Yakubovich
4bee884fae Change copyright from CoreOS to CNI authors
CNI is developed by more than just CoreOS, Inc
and the copyright is retained by all CNI
contributors (for their respective contributed code).
2015-09-29 11:51:33 -07:00
Michael Bridgen
09a8148e36 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).
2015-09-16 10:14:39 +01:00
Eugene Yakubovich
31c0dbf110 Propagate json error object to the caller
When plugin errors out, it prints out a JSON object to stdout
describing the failure. This object needs to be propagated out
through the plugins and to the container runtime. This change
also adds Print method to both the result and error structs
for easy serialization to stdout.
2015-06-09 10:46:28 -07:00
Eugene Yakubovich
c7a1442830 report errors via JSON
This reflects the latest SPEC draft.
2015-05-08 15:07:09 -07:00
Eugene Yakubovich
c24708ff62 Add plugin code
This adds basic plugins.
"main" types: veth, bridge, macvlan
"ipam" type: host-local

The code has been ported over from github.com/coreos/rkt project
and adapted to fit the CNI spec.
2015-04-27 14:14:29 -07:00