63 Commits

Author SHA1 Message Date
Gabe Rosenhouse
0135e2751e versioning: ipam config is not versioned 2016-09-19 13:25:28 -07:00
Gabe Rosenhouse
fd150a4c97 skel: Plugins require a cniVersion in the NetConf 2016-09-18 21:30:57 -07:00
Gabe Rosenhouse
536cb5b99b 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
5a67f5d6fb Merge pull request #273 from zreigz/reconfigure-bridge-ip
Reconfigure bridge IP address
2016-08-12 15:04:22 -07:00
Lukasz Zajaczkowski
d09b18dac4 plugins: reconfigure bridge IP address
Add possibility to reconfigure bridge IP address when there is a new value.
New boolean flag added to net configuration to force IP change if it is need.
Otherwise code behaves as previously and throws error
2016-08-02 07:33:17 +02:00
Stefan Junker
5a52316ab5 plugins/{bridge,macvlan} test: ensure hardware addr
* bridge: Test the following interface's hardware address for the CNI specific
prefix:
  - bridge with IP address
  - container veth
* plugins/macvlan test: ensure hardware addr
2016-07-22 15:40:00 -07:00
Stefan Junker
55fd81f775 plugins/ptp: set the host veth hwaddr correctly 2016-07-22 15:34:54 -07:00
Stefan Junker
7d19c01818 pkg/ip: use iface name in SetHWAddrByIP 2016-07-22 15:34:53 -07:00
Stefan Junker
924b30b57d plugins: set MAC addresses based on IP
This will give deterministic MAC addresses for all interfaces CNI
creates and manages the IP for:
* bridge: container veth and host bridge
* macvlan: container veth
* ptp: container veth and host veth
2016-07-22 15:34:53 -07:00
Pengfei Ni
cd14fc0e06 plugins/main/ptp: add functional tests 2016-07-11 09:25:36 +08:00
Stefan Junker
72337159c1 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
8afda5faed tests/bridge: ensure isDefaultGateway works 2016-05-21 01:07:05 +02:00
Stefan Junker
534768fcd4 bridge: add isDefaultGateway field
When isDefaultGateway is true it automatically sets isGateway to true.
The default route will be added via the (bridge's) gateway IP.
If a default gateway has been configured via IPAM in the same
configuration file, the plugin will error out.
2016-05-21 00:38:42 +02:00
Dan Williams
ebf83ffde5 bridge: add e2e testing 2016-05-20 17:10:25 -05:00
Dan Williams
552dc43168 macvlan: add e2e testing 2016-05-20 17:10:25 -05:00
Dan Williams
185e33ebe9 ipvlan: add e2e testing 2016-05-20 17:10:25 -05:00
Dan Williams
c0d34c692f ns: add interface, use it, and fix thread-related namespace switch issues
Add a namespace object interface for somewhat cleaner code when
creating and switching between network namespaces.  All created
namespaces are now mounted in /var/run/netns to ensure they
have persistent inodes and paths that can be passed around
between plugin components without relying on the current namespace
being correct.

Also remove the thread-locking arguments from the ns package
per https://github.com/appc/cni/issues/183 by doing all the namespace
changes in a separate goroutine that locks/unlocks itself, instead of
the caller having to track OS thread locking.
2016-05-20 17:10:25 -05:00
Stefan Junker
3e1c3c60da Merge pull request #199 from dcbw/fix-bridge-tx-queue-length
bridge: leave TX queue length as kernel default, not 0
2016-05-19 23:05:08 +02:00
Minhan Xia
89ab9299ab plugins/bridge: add support to set hairpin mode 2016-05-19 12:06:37 +02:00
Dan Williams
f4eb76318e macvlan: sysctl must be set in macvlan interface's namespace
The macvlan is initially created in a separate network namespace
and the sysctl must be set in that namespace too.
2016-05-19 12:06:37 +02:00
Stefan Junker
5d67d22caa plugins/{ptp,bridge}: teardown first
This will allow the IPAM allocations to be cleared in case the
interfaces and iptables rules are non-existent.
2016-05-19 12:06:37 +02:00
Stefan Junker
2c482f433c *: 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
Iago López Galeiras
a993ef5f7f plugins/bridge: clean masquerading rules
In the Add command we set up masquerading rules that didn't have a
corresponding clean-up code in Del.

Add the clean-up code.
2016-05-19 12:06:36 +02:00
Piotr Skamruk
a1dab0aa40 macvlan: set proxy_arp in time of creating interface
Resolves CNI part of https://github.com/coreos/rkt/issues/1765
Second part would be adding similar lines into kvm flavored macvlan
support (in time of creating macvtap device).
2016-05-19 12:06:16 +02:00
Gabe Rosenhouse
9044dc2831 Extract testhelpers from loopback test suite 2016-05-19 12:06:16 +02:00
Dan Williams
899c0efd42 bridge: leave TX queue length as kernel default, not 0
Not using NewLinkAttrs() or not initializing TxQLen leaves
the value as 0, which tells the kernel to set a zero-length
tx_queue_len.  That messes up FIFO traffic shapers (like pfifo)
that use the device TX queue length as the default packet
limit.  This leads to a default packet limit of 0, which drops
all packets.
2016-05-12 10:35:50 -05:00
Stefan Junker
d91971cbe0 plugins/{ptp,bridge}: teardown first
This will allow the IPAM allocations to be cleared in case the
interfaces and iptables rules are non-existent.
2016-05-11 19:47:55 +02:00
Stefan Junker
ed5f8dfeb2 *: 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-06 16:40:27 +02:00
Iago López Galeiras
6aa26f9fd2 plugins/bridge: clean masquerading rules
In the Add command we set up masquerading rules that didn't have a
corresponding clean-up code in Del.

Add the clean-up code.
2016-05-03 12:21:58 +02:00
Stefan Junker
911d941794 Merge pull request #187 from appc/v0.3.0
merge unneeded branch v0.3.0 into master
2016-04-22 19:25:54 +02:00
Gabe Rosenhouse
5d932e4716 Extract testhelpers from loopback test suite 2016-04-17 18:28:10 -07:00
Piotr Skamruk
b2f492e8b5 macvlan: set proxy_arp in time of creating interface
Resolves CNI part of https://github.com/coreos/rkt/issues/1765
Second part would be adding similar lines into kvm flavored macvlan
support (in time of creating macvtap device).
2016-04-07 21:40:58 +02:00
Jonathan Boulle
f6135c7ba3 *: add missing license headers + check 2016-04-01 15:35:21 +02:00
Stefan Junker
6aad63055c *: add comment to iptables rules for ipmasq 2016-03-31 18:01:32 +02:00
Abhishek Chanda
c33daf6706 pkg: add a function to generate chain names
Adds a function to generate chain names for use in iptables and
ports all drivers to use that function. Also adds tests for the
said function.
2016-03-31 18:01:32 +02:00
Stefan Junker
4a5426b77a tests: loopback DEL 2016-03-02 17:56:44 +01:00
Stefan Junker
80ab40470c tests: loopback stdout must be JSON 2016-03-02 15:27:05 +01:00
Stefan Junker
52be8aa615 plugins/loopback: take lo down on CmdDel 2016-03-02 15:27:05 +01:00
Stefan Junker
e282f6939d plugins/loopback: return empty result
This is needed to conform to the specification and allow successful
unmarshalling in the invoker.
2016-03-02 15:27:00 +01:00
zachgersh
1e3d680d13 Handle namespaces with care
- After creating new netns, switch back to main netns
- Lock thread during test and test setup
2016-02-29 12:29:06 -05:00
Zachary Gershman
2708bdf2f5 Create a plugin for up'ing a lo device
- Believe we need sudo to create netns
- Use syscall instead of relying on ip netns
- Add sudo to .travis.yml
- Needs more -E
- Revert Godeps GoVersion to 1.4.2
- in travis, test command is run with all necessary env vars
- Loopback plugin only works on 'lo' interface
- Update README, add loopback plugin config
- note script dependency on jq

Signed-off-by: Gabe Rosenhouse <grosenhouse@pivotal.io>
2016-02-29 12:29:06 -05:00
Stefan Junker
137dc8a673 *: reflect SPEC's DNS changes in implementation
* DNS is now a type which will result in a JSON dictionary in
  configurations and results
* Minor refactoring, making use of type embedding
2016-01-29 10:39:28 +01:00
Alban Crequy
2f9ef4adb7 *: add "dns" field to the configuration
appc/cni#76 added a "dns" field in the result JSON. But before this
patch, the plugins had no way of knowing which name server to return.

There could be two ways of knowing which name server to return:
1. add it as an extra argument ("CNI_ARGS")
2. add it in the network configuration as a convenience (received via
   stdin)

I chose the second way because it is easier. In the case of rkt, it
means the user could just add the DNS name servers in
/etc/rkt/net.d/mynetwork.conf.
2016-01-26 18:54:56 +01:00
Eugene Yakubovich
f885288a2d Merge pull request #69 from eyakubovich/err-msgs
Route del would fail due to wrong scope; better errors
2015-09-30 11:56:56 -07:00
Eugene Yakubovich
0becca2e96 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
Eugene Yakubovich
5efd3ba883 Route del would fail due to wrong scope; better errors
In some cases the route deletion would fail due to wrong
scope. It should be NOWHERE when deleting (per iproute2).
This also adds more verbose error messages.
2015-09-29 11:27:49 -07:00
Stefan Junker
f1c9c632e1 Revert "plugins/ptp: allow host veth to be UP"
This reverts commit 231d2d5a27f3ba54219c3f0b1c8ef2c5dab4faaf.
2015-09-24 18:32:18 +02:00
Stefan Junker
231d2d5a27 plugins/ptp: allow host veth to be UP 2015-09-24 10:57:36 +02:00
Eugene Yakubovich
7d8d6b2a7e Use single IP on the host for ptp veths
Instead of allocating a /31 for each container,
use the same IP on the host side for all veths.
This is very similar how real point-to-point
devices work (using donor IPs).
2015-09-23 11:04:38 +02:00
Michael Bridgen
b88f173c43 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