RE: How should I pass the cni_args / ip, injecting lables #5592 not working

2019-06-02 Thread Marc Roos


Hi Jie, Thanks for the help, I managed to create a mesos delegate 
plugin[0] that injects labels into cni args. And seems to work fine.

In some cases I would like to have multiple container networks attached 
to the task. How can I specify multiple networks using this syntax?

"ipAddress": { "networkName": "test-delegate", "labels": {"CNI_ARGS": 
"IP=192.168.122.176"} },

Or is there an option to parse labels with this syntax as well?

"networks": [ { "mode": "container", "name": "test-delegate" } ]

Is it correct that cni chains are not supported in mesos 1.7? I tried to 
ask this here [1] but never got an answer.

Thanks again.


[0]
https://github.com/f1-outsourcing/plugins/tree/hostrouteif/plugins/meta/mesos
[1]
https://www.mail-archive.com/user@mesos.apache.org/msg10295.html




-Original Message-
From: Jie Yu 
To: user
Subject: Re: How should I pass the cni_args / ip, injecting lables #5592 
not working

Mesos's port mapper CNI plugin uses delegate model. You can take a look

https://github.com/apache/mesos/tree/master/src/slave/containerizer/mesos/isolators/network/cni/plugins/port_mapper


You can check out the go sample CNI implementation if you prefer golang 
https://github.com/containernetworking/plugins/tree/master/plugins/sample


- Jie

On Fri, May 3, 2019 at 3:18 PM Marc Roos  wrote:


 
Hmm, yes was already thinking of changing the source, but a wrapper 
is 
indeed better. Anyone have already something like this lying 
around? So 
I do not need to start from scratch :)


        
    
    -Original Message-----
        From: Jie Yu 
    To: user
Subject: Re: How should I pass the cni_args / ip, injecting lables 
#5592 
not working

ah. I think one workaround I can think of is to write a wrapper CNI 

plugin that understand args."org.apache.mesos", and set "cni.ips" 
properly for the macvtap plugin.


This is a common pattern in CNI called delegation before CNI 
chaining 
was proposed.

- Jie

On Fri, May 3, 2019 at 11:14 AM Marc Roos 
 
wrote:




 >  Yet the cni plugin is afaik not even looking at the 
 
args.'org.apache.mesos'.network_info configuration,
 >  for the cni_args it looks e.g. at args.cni.ips (or 
an 
environment 
variable)
 >
 >
 >That depends on the CNI plugin you're using. CNI is a 
spec 
between CO 
(container orchestration system
 > like K8s, mesos, etc.) and NP (network providers like 
calico, 
cisco, 
juniper, etc.).
 >
 >`args` field is the place where CO can inject CO specific 

information. 
Some CNI plugin might use those CO
 > specific information to perform some special operations. 

Although I 
don't like it, this is just how the
 > spec has evolved. The use of CNI_ARGS has been 
deprecated 


<https://github.com/containernetworking/cni/blob/master/CONVENTIONS.md#cni_args>
 > in favor of using `args` field.
 >
 >
 >  Or is it possible to reference in the cni network 
json 
config 
files a key of args.'org.apache.mesos'.network_info?
 >
 >
 >I don't really follow this. Can you state your use case?

Basically I want to assign a static ip via mesos/marathon. 
The only 
way 
I can get this to work now is via
 the cni network configuration something like this. But I 
do not 
want to 
start creating a cni network
 config file for every app.


{
  "name": "test-macvtap",
  "type": "macvtap",
  "master": "eth1",
  "hostrouteif": "macvtap1",
  "ipam": {
"type": "host-local",
"subnet": "192.168.122.0/24",
"rangeStart": "192.168.122.171",
"rangeEnd": "192.168.122.179",
"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" }]
  },
  "dns": { "nameservers": ["192.168.10.10"] },
  "args": {
"cni": { "ips": ["192.168.122.177"] }
}










RE: How should I pass the cni_args / ip, injecting lables #5592 not working

2019-05-04 Thread Marc Roos
 

I think this sample.go is only allowing you to make a chained plugin, 
that is being 
 executed after another plugin. Rendering it useless, because we want to 

 inject/change the ip adresses before the plugin is launched.
 At least I am not to much fan of assigning an ip address and then later 
modifying it.





-Original Message-
From: Jie Yu [mailto:yujie@gmail.com] 
Sent: zaterdag 4 mei 2019 0:22
To: user
Subject: Re: How should I pass the cni_args / ip, injecting lables #5592 
not working

Mesos's port mapper CNI plugin uses delegate model. You can take a look

https://github.com/apache/mesos/tree/master/src/slave/containerizer/mesos/isolators/network/cni/plugins/port_mapper


You can check out the go sample CNI implementation if you prefer golang 
https://github.com/containernetworking/plugins/tree/master/plugins/sample


- Jie

On Fri, May 3, 2019 at 3:18 PM Marc Roos  wrote:


 
Hmm, yes was already thinking of changing the source, but a wrapper 
is 
indeed better. Anyone have already something like this lying 
around? So 
I do not need to start from scratch :)




-Original Message-
From: Jie Yu [mailto:yujie@gmail.com] 
Sent: zaterdag 4 mei 2019 0:14
To: user
Subject: Re: How should I pass the cni_args / ip, injecting lables 
#5592 
not working

ah. I think one workaround I can think of is to write a wrapper CNI 

plugin that understand args."org.apache.mesos", and set "cni.ips" 
properly for the macvtap plugin.


This is a common pattern in CNI called delegation before CNI 
chaining 
was proposed.

- Jie

On Fri, May 3, 2019 at 11:14 AM Marc Roos 
 
wrote:




 >  Yet the cni plugin is afaik not even looking at the 
 
args.'org.apache.mesos'.network_info configuration,
 >  for the cni_args it looks e.g. at args.cni.ips (or 
an 
environment 
variable)
 >
 >
 >That depends on the CNI plugin you're using. CNI is a 
spec 
between CO 
(container orchestration system
 > like K8s, mesos, etc.) and NP (network providers like 
calico, 
cisco, 
juniper, etc.).
 >
 >`args` field is the place where CO can inject CO specific 

information. 
Some CNI plugin might use those CO
 > specific information to perform some special operations. 

Although I 
don't like it, this is just how the
 > spec has evolved. The use of CNI_ARGS has been 
deprecated 


<https://github.com/containernetworking/cni/blob/master/CONVENTIONS.md#cni_args>
 > in favor of using `args` field.
 >
 >
 >  Or is it possible to reference in the cni network 
json 
config 
files a key of args.'org.apache.mesos'.network_info?
 >
 >
 >I don't really follow this. Can you state your use case?

Basically I want to assign a static ip via mesos/marathon. 
The only 
way 
I can get this to work now is via
 the cni network configuration something like this. But I 
do not 
want to 
start creating a cni network
 config file for every app.


{
  "name": "test-macvtap",
  "type": "macvtap",
  "master": "eth1",
  "hostrouteif": "macvtap1",
  "ipam": {
"type": "host-local",
"subnet": "192.168.122.0/24",
"rangeStart": "192.168.122.171",
"rangeEnd": "192.168.122.179",
"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" }]
  },
  "dns": { "nameservers": ["192.168.10.10"] },
  "args": {
"cni": { "ips": ["192.168.122.177"] }
}










Re: How should I pass the cni_args / ip, injecting lables #5592 not working

2019-05-03 Thread Jie Yu
Mesos's port mapper CNI plugin uses delegate model. You can take a look
https://github.com/apache/mesos/tree/master/src/slave/containerizer/mesos/isolators/network/cni/plugins/port_mapper

You can check out the go sample CNI implementation if you prefer golang
https://github.com/containernetworking/plugins/tree/master/plugins/sample

- Jie

On Fri, May 3, 2019 at 3:18 PM Marc Roos  wrote:

>
> Hmm, yes was already thinking of changing the source, but a wrapper is
> indeed better. Anyone have already something like this lying around? So
> I do not need to start from scratch :)
>
>
>
>
> -Original Message-
> From: Jie Yu [mailto:yujie@gmail.com]
> Sent: zaterdag 4 mei 2019 0:14
> To: user
> Subject: Re: How should I pass the cni_args / ip, injecting lables #5592
> not working
>
> ah. I think one workaround I can think of is to write a wrapper CNI
> plugin that understand args."org.apache.mesos", and set "cni.ips"
> properly for the macvtap plugin.
>
>
> This is a common pattern in CNI called delegation before CNI chaining
> was proposed.
>
> - Jie
>
> On Fri, May 3, 2019 at 11:14 AM Marc Roos 
> wrote:
>
>
>
>
>  >  Yet the cni plugin is afaik not even looking at the
> args.'org.apache.mesos'.network_info configuration,
>  >  for the cni_args it looks e.g. at args.cni.ips (or an
> environment
> variable)
>  >
>  >
>  >That depends on the CNI plugin you're using. CNI is a spec
> between CO
> (container orchestration system
>  > like K8s, mesos, etc.) and NP (network providers like calico,
> cisco,
> juniper, etc.).
>  >
>  >`args` field is the place where CO can inject CO specific
> information.
> Some CNI plugin might use those CO
>  > specific information to perform some special operations.
> Although I
> don't like it, this is just how the
>  > spec has evolved. The use of CNI_ARGS has been deprecated
>
> <
> https://github.com/containernetworking/cni/blob/master/CONVENTIONS.md#cni_args
> >
>  > in favor of using `args` field.
>  >
>  >
>  >  Or is it possible to reference in the cni network json
> config
> files a key of args.'org.apache.mesos'.network_info?
>  >
>  >
>  >I don't really follow this. Can you state your use case?
>
> Basically I want to assign a static ip via mesos/marathon. The
> only
> way
> I can get this to work now is via
>  the cni network configuration something like this. But I do not
> want to
> start creating a cni network
>  config file for every app.
>
>
> {
>   "name": "test-macvtap",
>   "type": "macvtap",
>   "master": "eth1",
>   "hostrouteif": "macvtap1",
>   "ipam": {
> "type": "host-local",
> "subnet": "192.168.122.0/24",
> "rangeStart": "192.168.122.171",
> "rangeEnd": "192.168.122.179",
> "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" }]
>   },
>   "dns": { "nameservers": ["192.168.10.10"] },
>   "args": {
> "cni": { "ips": ["192.168.122.177"] }
> }
>
>
>
>
>
>


RE: How should I pass the cni_args / ip, injecting lables #5592 not working

2019-05-03 Thread Marc Roos
 
Hmm, yes was already thinking of changing the source, but a wrapper is 
indeed better. Anyone have already something like this lying around? So 
I do not need to start from scratch :)




-Original Message-
From: Jie Yu [mailto:yujie@gmail.com] 
Sent: zaterdag 4 mei 2019 0:14
To: user
Subject: Re: How should I pass the cni_args / ip, injecting lables #5592 
not working

ah. I think one workaround I can think of is to write a wrapper CNI 
plugin that understand args."org.apache.mesos", and set "cni.ips" 
properly for the macvtap plugin.


This is a common pattern in CNI called delegation before CNI chaining 
was proposed.

- Jie

On Fri, May 3, 2019 at 11:14 AM Marc Roos  
wrote:




 >  Yet the cni plugin is afaik not even looking at the  
args.'org.apache.mesos'.network_info configuration,
 >  for the cni_args it looks e.g. at args.cni.ips (or an 
environment 
variable)
 >
 >
 >That depends on the CNI plugin you're using. CNI is a spec 
between CO 
(container orchestration system
 > like K8s, mesos, etc.) and NP (network providers like calico, 
cisco, 
juniper, etc.).
 >
 >`args` field is the place where CO can inject CO specific 
information. 
Some CNI plugin might use those CO
 > specific information to perform some special operations. 
Although I 
don't like it, this is just how the
 > spec has evolved. The use of CNI_ARGS has been deprecated 

<https://github.com/containernetworking/cni/blob/master/CONVENTIONS.md#cni_args>
 > in favor of using `args` field.
 >
 >
 >  Or is it possible to reference in the cni network json 
config 
files a key of args.'org.apache.mesos'.network_info?
 >
 >
 >I don't really follow this. Can you state your use case?

Basically I want to assign a static ip via mesos/marathon. The only 
way 
I can get this to work now is via
 the cni network configuration something like this. But I do not 
want to 
start creating a cni network
 config file for every app.


{
  "name": "test-macvtap",
  "type": "macvtap",
  "master": "eth1",
  "hostrouteif": "macvtap1",
  "ipam": {
"type": "host-local",
"subnet": "192.168.122.0/24",
"rangeStart": "192.168.122.171",
"rangeEnd": "192.168.122.179",
"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" }]
  },
  "dns": { "nameservers": ["192.168.10.10"] },
  "args": {
"cni": { "ips": ["192.168.122.177"] }
}







Re: How should I pass the cni_args / ip, injecting lables #5592 not working

2019-05-03 Thread Jie Yu
ah. I think one workaround I can think of is to write a wrapper CNI plugin
that understand args."org.apache.mesos", and set "cni.ips" properly for the
macvtap plugin.

This is a common pattern in CNI called delegation before CNI chaining was
proposed.

- Jie

On Fri, May 3, 2019 at 11:14 AM Marc Roos  wrote:

>
>
>  >  Yet the cni plugin is afaik not even looking at the
> args.'org.apache.mesos'.network_info configuration,
>  >  for the cni_args it looks e.g. at args.cni.ips (or an environment
> variable)
>  >
>  >
>  >That depends on the CNI plugin you're using. CNI is a spec between CO
> (container orchestration system
>  > like K8s, mesos, etc.) and NP (network providers like calico, cisco,
> juniper, etc.).
>  >
>  >`args` field is the place where CO can inject CO specific information.
> Some CNI plugin might use those CO
>  > specific information to perform some special operations. Although I
> don't like it, this is just how the
>  > spec has evolved. The use of CNI_ARGS has been deprecated
> <
> https://github.com/containernetworking/cni/blob/master/CONVENTIONS.md#cni_args
> >
>  > in favor of using `args` field.
>  >
>  >
>  >  Or is it possible to reference in the cni network json config
> files a key of args.'org.apache.mesos'.network_info?
>  >
>  >
>  >I don't really follow this. Can you state your use case?
>
> Basically I want to assign a static ip via mesos/marathon. The only way
> I can get this to work now is via
>  the cni network configuration something like this. But I do not want to
> start creating a cni network
>  config file for every app.
>
>
> {
>   "name": "test-macvtap",
>   "type": "macvtap",
>   "master": "eth1",
>   "hostrouteif": "macvtap1",
>   "ipam": {
> "type": "host-local",
> "subnet": "192.168.122.0/24",
> "rangeStart": "192.168.122.171",
> "rangeEnd": "192.168.122.179",
> "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" }]
>   },
>   "dns": { "nameservers": ["192.168.10.10"] },
>   "args": {
> "cni": { "ips": ["192.168.122.177"] }
> }
>
>
>


RE: How should I pass the cni_args / ip, injecting lables #5592 not working

2019-05-03 Thread Marc Roos



 >  Yet the cni plugin is afaik not even looking at the  
args.'org.apache.mesos'.network_info configuration,
 >  for the cni_args it looks e.g. at args.cni.ips (or an environment 
variable)
 >
 >
 >That depends on the CNI plugin you're using. CNI is a spec between CO 
(container orchestration system
 > like K8s, mesos, etc.) and NP (network providers like calico, cisco, 
juniper, etc.).
 >
 >`args` field is the place where CO can inject CO specific information. 
Some CNI plugin might use those CO
 > specific information to perform some special operations. Although I 
don't like it, this is just how the
 > spec has evolved. The use of CNI_ARGS has been deprecated 

 > in favor of using `args` field.
 >
 >
 >  Or is it possible to reference in the cni network json config 
files a key of args.'org.apache.mesos'.network_info?
 >
 >
 >I don't really follow this. Can you state your use case?

Basically I want to assign a static ip via mesos/marathon. The only way 
I can get this to work now is via
 the cni network configuration something like this. But I do not want to 
start creating a cni network
 config file for every app.


{
  "name": "test-macvtap",
  "type": "macvtap",
  "master": "eth1",
  "hostrouteif": "macvtap1",
  "ipam": {
"type": "host-local",
"subnet": "192.168.122.0/24",
"rangeStart": "192.168.122.171",
"rangeEnd": "192.168.122.179",
"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" }]
  },
  "dns": { "nameservers": ["192.168.10.10"] },
  "args": {
"cni": { "ips": ["192.168.122.177"] }
}




Re: How should I pass the cni_args / ip, injecting lables #5592 not working

2019-05-03 Thread Jie Yu
>
> Yet the cni plugin is afaik not even looking at the
> args.'org.apache.mesos'.network_info configuration, for the cni_args it
> looks e.g. at args.cni.ips (or an environment variable)


That depends on the CNI plugin you're using. CNI is a spec between CO
(container orchestration system like K8s, mesos, etc.) and NP (network
providers like calico, cisco, juniper, etc.).

`args` field is the place where CO can inject CO specific information. Some
CNI plugin might use those CO specific information to perform some special
operations. Although I don't like it, this is just how the spec has
evolved. The use of CNI_ARGS has been deprecated
<https://github.com/containernetworking/cni/blob/master/CONVENTIONS.md#cni_args>
in
favor of using `args` field.

Or is it possible to reference in the cni network json config files a key
> of args.'org.apache.mesos'.network_info?


I don't really follow this. Can you state your use case?

- Jie

On Fri, May 3, 2019 at 10:31 AM Marc Roos  wrote:

>
> Hi Jie,
>
> Something like this is injected into the cni json configuration by mesos
>
> "args": {
>   "org.apache.mesos": {
> "network_info": {
>   "ip_addresses": [
> {
>   "protocol": "IPv4"
> }
>   ],
>   "name": "test-macvtap-cniip"
> }
>   }
> },
>
> You can add labels in Marathon with something like this
>
>   "ipAddress": {
> "networkName": "test-macvtap-cniip",
> "labels": {"CNI_ARGS": "192.168.122.172"}
>   },
>
> Then the injected will look something like
>
> "args": {
>   "org.apache.mesos": {
> "network_info": {
>   "ip_addresses": [
> {
>   "protocol": "IPv4"
> }
>   ],
>   "labels": {
> "labels": [
>   {
> "key": "CNI_ARGS",
> "value": "IP=192.168.122.172"
>   }
> ]
>   },
>   "name": "test-macvtap-cniip"
> }
>   }
> },
>
>
> Yet the cni plugin is afaik not even looking at the
> args.'org.apache.mesos'.network_info
>  configuration, for the cni_args it looks e.g. at args.cni.ips (or an
> environment variable)
>
> I have no idea what this org.apache.mesos is even usefull for, unless
> you
>  are customizing plugins. But I guess you rather stick to the cni
> standards.
>
> Or is it possible to reference in the cni network json config files
>  a key of args.'org.apache.mesos'.network_info?
>
>
>
> -Original Message-
> From: Jie Yu
> Sent: vrijdag 3 mei 2019 18:59
> To: user
> Subject: Re: FW: How should I pass the cni_args / ip, injecting lables
> #5592 not working
>
> 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 
> 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 

RE: How should I pass the cni_args / ip, injecting lables #5592 not working

2019-05-03 Thread Marc Roos


Hi Jie,

Something like this is injected into the cni json configuration by mesos

"args": {
  "org.apache.mesos": {
"network_info": {
  "ip_addresses": [
{
  "protocol": "IPv4"
}
  ],
  "name": "test-macvtap-cniip"
}
  }
}, 

You can add labels in Marathon with something like this

  "ipAddress": {
"networkName": "test-macvtap-cniip",
"labels": {"CNI_ARGS": "192.168.122.172"}
  },

Then the injected will look something like 

"args": {
  "org.apache.mesos": {
"network_info": {
  "ip_addresses": [
{
  "protocol": "IPv4"
}
  ],
  "labels": {
"labels": [
  {
"key": "CNI_ARGS",
"value": "IP=192.168.122.172"
  }
]
  },
  "name": "test-macvtap-cniip"
}
  }
},


Yet the cni plugin is afaik not even looking at the 
args.'org.apache.mesos'.network_info
 configuration, for the cni_args it looks e.g. at args.cni.ips (or an 
environment variable)

I have no idea what this org.apache.mesos is even usefull for, unless 
you 
 are customizing plugins. But I guess you rather stick to the cni 
standards.

Or is it possible to reference in the cni network json config files 
 a key of args.'org.apache.mesos'.network_info?



-Original Message-
From: Jie Yu  
Sent: vrijdag 3 mei 2019 18:59
To: user
Subject: Re: FW: How should I pass the cni_args / ip, injecting lables 
#5592 not working

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  
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

Re: FW: How should I pass the cni_args / ip, injecting lables #5592 not working

2019-05-03 Thread Jie Yu
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  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
>
>
>
>


FW: How should I pass the cni_args / ip, injecting lables #5592 not working

2019-05-03 Thread Marc Roos


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