Hi,
I've been working on potentially building a custom CNI plugin. I'm
following the spec found here:
https://github.com/containernetworking/cni/blob/master/SPEC.md
I've found that the documented JSON result for the ADD command doesn't
result in Mesos or upstream frameworks being able to identify the assigned
IP. That is, there is no IP showing at the Mesos API level. This might just
be a misunderstanding or configuration issue on my part, but input would be
appreciated.
Looking at
"src/slave/containerizer/mesos/isolators/network/cni/spec.proto", I guessed
that I should be returning a different structure, and that structure works.
I don't see this structure explicitly documented anywhere, but the primary
difference is that there's an "ip" array in the documented spec, and an
"ip4" object in the working version.
One thing I did notice is per the spec document it shows a prevResult in
the format that works for me.
I am using master, I'll roll back to maybe the 1.1.1 RC (since it is
getting attention now on the mailing list) and see if the behavior is any
different.
Here's my JSON that I believe matches the spec but doesn't show the IP in
the Mesos frontend:
{
"cniVersion": "0.3.0",
"interfaces": [
{
"name": "eth0",
"mac": "36:c0:43:08:97:f7",
"sandbox": ""
}
],
"ip": [
{
"version": "4",
"address": "10.1.10.170/24",
"gateway": "10.10.10.1",
"interface": 0
}
],
"dns": {
"nameservers": [
"10.10.10.1"
]
}
}
And here's the modified JSON that is working:
{
"cniVersion": "0.3.0",
"interfaces": [
{
"name": "eth0",
"mac": "36:c0:43:08:97:f7",
"sandbox": ""
}
],
"ip4": {
"ip": "10.10.10.170/24",
"gateway": "10.10.10.1",
"interface": 0
},
"dns": {
"nameservers": [
"10.10.10.1"
]
}
}