Use CNI_IFNAME environment variable
According to CNI spec kubelet expects CNI_IFNAME (the name inside container) if sandbox is not empty. Both python and golang implementation was done unconditionally, IOW we can add both empty sandbox and interface name on the host and nonempty sandbox and container's iface name. Closes-Bug: #1835038 Change-Id: I3f21bc0c0790bb79ee81db361cd072609a0a3169 Signed-off-by: Alexey Perevalov <a.perevalov@samsung.com>
This commit is contained in:
@@ -111,7 +111,7 @@ func cmdAdd(args *skel.CmdArgs) error {
|
||||
}
|
||||
|
||||
iface := current.Interface{}
|
||||
iface.Name = vif.VifName
|
||||
iface.Name = args.IfName
|
||||
iface.Mac = vif.Address
|
||||
iface.Sandbox = args.ContainerID
|
||||
|
||||
|
@@ -100,7 +100,7 @@ class CNIRunner(object):
|
||||
cni_routes_list = result.setdefault("routes", [])
|
||||
result["interfaces"] = [
|
||||
{
|
||||
"name": vif.vif_name,
|
||||
"name": params["CNI_IFNAME"],
|
||||
"mac": vif.address,
|
||||
"sandbox": self.get_container_id(params)}]
|
||||
for subnet in vif.network.subnets.objects:
|
||||
|
@@ -64,6 +64,7 @@ class TestCNIDaemonizedRunner(test_base.TestCase, TestCNIRunnerMixin):
|
||||
'CNI_COMMAND': cni_cmd,
|
||||
'CNI_CONTAINERID': 'a4181c680a39',
|
||||
'CNI_ARGS': 'foo=bar',
|
||||
'CNI_IFNAME': 'eth0',
|
||||
}
|
||||
result = self.runner.run(env, m_fin, m_fout)
|
||||
m_post.assert_called_with(
|
||||
|
Reference in New Issue
Block a user