Marc,

I think the CNI_ARGS that Mesos passed into CNI plugin is the NetworkInfo
object.
https://github.com/apache/mesos/blob/master/include/mesos/mesos.proto#L3096

I don't know if there's a way in Marathon to inject NetworkInfo.labels from
the app definition. Any marathon folks can answer this?

- Jie

On Fri, May 3, 2019 at 6:41 AM Marc Roos <m.r...@f1-outsourcing.eu> wrote:

>
> I read the jira issue [0] that labels would be injected into the cni
> json. But I can't get this to work. I have changed the source of a
> plugin so it would dump the configuration files and this is how it looks
> like, when you dump the ip configured in the cni network json [1] as
> expected. When adding the labels, you get a totally different json [2],
> so how should this ever work???
>
>
> This is not working
> ===================
> {
>   "id": "/server",
>   "user": "nobody",
>   "cmd": "python -m SimpleHTTPServer 8080",
>   "cpus": 0.1,
>   "mem": 32,
>   "disk": 0,
>   "instances": 1,
>   "acceptedResourceRoles": ["*"],
>   "constraints": [["hostname","CLUSTER","m03.local"]],
>   "backoffSeconds": 10,
>   "ipAddress": { "networkName": "test-macvtap-cniip" },
>   "labels": { "CNI_ARGS": "IP=192.168.122.173" } }
>
> This is also not working
> ========================
> {
>   "id": "/server",
>   "user": "nobody",
>   "cmd": "python -m SimpleHTTPServer 8080",
>   "cpus": 0.1,
>   "mem": 32,
>   "disk": 0,
>   "instances": 1,
>   "acceptedResourceRoles": ["*"],
>   "constraints": [["hostname","CLUSTER","m03.local"]],
>   "backoffSeconds": 10,
>   "networks": [ { "mode": "container", "name": "test-macvtap-cniip" } ],
>   "env": { "CNI_ARGS" : "'IP=192.168.122.173'" } }
>
> This does work:
> ===============
> CNI_PATH="/usr/libexec/cni/" NETCONFPATH="/etc/mesos-cni"
> CNI_IFNAME="eth1" CNI_ARGS='IP=192.168.122.173' cnitool-0.5.2 add
> test-macvtap-cniip /var/run/netns/testing
>
>
>
> [1]
> ===
> Cni network config only
> [
>   {
>     "args": {
>       "cni": {
>         "ips": [
>           "192.168.122.177"
>         ]
>       }
>     },
>     "cniVersion": "",
>     "dns": {
>       "nameservers": [
>         "192.168.10.10"
>       ]
>     },
>     "hostrouteif": "macvtap1",
>     "ipam": {
>       "rangeEnd": "192.168.122.179",
>       "rangeStart": "192.168.122.171",
>       "routes": [
>         {
>           "dst": "192.168.122.22/32",
>           "gw": "0.0.0.0"
>         },
>         {
>           "dst": "192.168.10.10/32",
>           "gw": "0.0.0.0"
>         },
>         {
>           "dst": "192.168.10.22/32",
>           "gw": "0.0.0.0"
>         }
>       ],
>       "subnet": "192.168.122.0/24",
>       "type": "host-local"
>     },
>     "master": "eth1",
>     "name": "test-macvtap",
>     "type": "macvtap"
>   }
> ]
>
>
> [2]
> ===
> Dump from the marathon launched task with labels.
> [
>   {
>     "args": {
>       "org.apache.mesos": {
>         "network_info": {
>           "ip_addresses": [
>             {
>               "protocol": "IPv4"
>             }
>           ],
>           "labels": {
>             "labels": [
>               {
>                 "key": "ips",
>                 "value": "192.168.122.172"
>               }
>             ]
>           },
>           "name": "test-macvtap-cniip"
>         }
>       }
>     },
>     "dns": {
>       "nameservers": [
>         "192.168.10.10"
>       ]
>     },
>     "hostrouteif": "macvtap0",
>     "ipam": {
>       "rangeEnd": "192.168.122.179",
>       "rangeStart": "192.168.122.171",
>       "routes": [
>         {
>           "dst": "192.168.10.153/32",
>           "gw": "0.0.0.0"
>         }
>       ],
>       "subnet": "192.168.122.0/24",
>       "type": "host-local"
>     },
>     "master": "eth1",
>     "name": "test-macvtap-cniip",
>     "type": "macvtap"
>   }
> ]
>
> [0] https://issues.apache.org/jira/browse/MESOS-5592
>
>
>
>

Reply via email to