ECS Bridge Plugin
Overview
The ECS Bridge plugin configures the network namespace of the container to be
able to communicate with the credentials endpoint of the ECS Agent by creating a
bridge (if required) and veth pair to connect the container's network namespace
to the bridge. An example configuration for invoking this plugin is listed next:
{
"type":"ecs-bridge",
"cniVersion":"0.3.0",
"bridge":"ecs-br0",
"mtu":1500,
"ipam":{
"type":"ecs-ipam",
"id":"test",
"cniVersion":"0.3.0",
"ipv4-subnet":"169.254.172.0/22",
"ipv4-routes":[
{
"dst":"169.254.172.1"
}
]
}
}
Parameters
bridge
(string, required): the name of the bridge
ipam
(ipam config, required): the ipam configuration to use, refer
to ../ipam/README.md for more details
mtu
(int, optional): the maximum transmission unit size for the bridge
Example
Please ensure that the environment variables needed for running any CNI plugins
are appropriately configured:
CNI_COMMAND
: Command to execute eg: ADD.
CNI_PATH
: Plugin binary path eg: pwd
/bin.
CNI_IFNAME
: Interface name inside the container
Add:
export CNI_COMMAND=ADD && cat mynet.conf | ../bin/ecs-bridge
Del:
export CNI_COMMAND=DEL && cat mynet.conf | ../bin/ecs-bridge
mynet.conf
is the configuration file for the plugin, it's the same as described
in the overview above.
Testing
End-to-end Tests
The end-to-end test suite for this package makes the following assumptions:
- The
ecs-bridge
and ecs-ipam
plugin executables have been built
- The
CNI_PATH
environment variable points to the location of these plugins
- The test is being executed with
root
user privileges
Since these tests invoke the the ECS Bridge plugin as if an end user such as
the ECS Agent is invoking it, additional configuration variables can be set to
prevent the test runner from cleaning up the artifacts generated during the test
execution for debugging purposes:
ECS_PRESERVE_E2E_TEST_LOGS
: This is set to false
by default.
Overriding with true
preserves log files from the plugins
ECS_BRIDGE_PRESERVE_IPAM_DB
: This is set to false
by default. Overriding
with true
preserves the IPAM database generated by the ECS IPAM plugin
Please refer the Makefile for an example of the command line required to
run end-to-end tests (under the e2e-test
target).