You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mesos.apache.org by Marcus <sh...@gmail.com> on 2017/03/17 18:33:15 UTC

Mesos CNI Result spec

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"
    ]
  }
}

Re: Mesos CNI Result spec

Posted by Marcus Sorensen <sh...@gmail.com>.
Thanks for taking the time to respond.

On 2017-03-17 13:02 (-0600), Avinash Sridharan <av...@mesosphere.io> wrote: 
> Hi Marcus,
>  The CNI Spec you are seeing is the latest SPEC of v0.3 . Mesos currently
> supports v0.2 and below. You can check out the by looking at the "tags" in
> the CNI repo. For e.g.,
> https://github.com/containernetworking/cni/blob/v0.4.0/SPEC.md
> 
> We have tickets open to support SPEC v0.3. Hopefully we can get to it
> pretty soon.
> 
> https://issues.apache.org/jira/browse/MESOS-7175
> 
> On Fri, Mar 17, 2017 at 11:33 AM, Marcus <sh...@gmail.com> wrote:
> 
> > 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"
> >     ]
> >   }
> > }
> >
> 
> 
> 
> -- 
> Avinash Sridharan, Mesosphere
> +1 (323) 702 5245
> 

Re: Mesos CNI Result spec

Posted by Avinash Sridharan <av...@mesosphere.io>.
Hi Marcus,
 The CNI Spec you are seeing is the latest SPEC of v0.3 . Mesos currently
supports v0.2 and below. You can check out the by looking at the "tags" in
the CNI repo. For e.g.,
https://github.com/containernetworking/cni/blob/v0.4.0/SPEC.md

We have tickets open to support SPEC v0.3. Hopefully we can get to it
pretty soon.

https://issues.apache.org/jira/browse/MESOS-7175

On Fri, Mar 17, 2017 at 11:33 AM, Marcus <sh...@gmail.com> wrote:

> 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"
>     ]
>   }
> }
>



-- 
Avinash Sridharan, Mesosphere
+1 (323) 702 5245