The ECS ENI plugin configures the network namespace of the container with an
Elastic Network Interface (ENI) device. It also starts the dhclient
process to
renew leases on the ipv4 and ipv6 addresses (when an ipv6 address is specified).
An example configuration for invoking the plugin is listed next:
{
"type":"ecs-eni",
"cniVersion":"0.3.0",
"eni":"eni-eni01en1",
"ipv4-address":"172.31.31.65/20",
"mac":"01:23:45:67:89:ab",
"block-instance-metadata":true
}
eni
(string, required): the ENI IDipv4-address
(string, required): the ipv4 address of the ENI. This is the Primary private IPV4 address of the interfacemac
(string, required): the MAC address of the ENIipv6-address
(string, optional): the ipv6 address of the ENIblock-instance-metadata
(bool, optional): specifies if the route to EC2 instance metadata should be blocked
ENI_DHCLIENT_LEASES_PATH
(string, optional): the dhclient leases file path. Set to/var/lib/dhclient
by defaultENI_DHCLIENT_PID_FILE_PATH
(string, optional): the dhclient pid file path. Set to/var/run
by default
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
export CNI_COMMAND=ADD && cat mynet.conf | ../bin/ecs-eni
export CNI_COMMAND=DEL && cat mynet.conf | ../bin/ecs-eni
mynet.conf
is the configuration file for the plugin, it's the same as described
in the overview above.
The end-to-end test suite for this package makes the following assumptions:
- The test suite is being executed on an EC2 Instance
- The EC2 Instance has been launched with an IAM Role that has permissions to
invoke the following APIs:
- ec2:DescribeSecurityGroups
- ec2:CreateNetworkInterface
- ec2:DescribeNetworkInterfaces
- ec2:DeleteNetworkInterface
- ec2:AttachNetworkInterface
- ec2:DetachNetworkInterface
- The EC2 Instance has room to attach at least one ENI. Please refer to aws eni documentation for details on the limits based on instance type
- The
ecs-eni
plugin executable has 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 ENI 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 tofalse
by default. Overriding withtrue
preserves log files from the plugins
Please refer the Makefile for an example of the command line required to
run end-to-end tests (under the e2e-test
target).