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 <m.r...@f1-outsourcing.eu> 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 <m.r...@f1-outsourcing.eu> > 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"] } > } > > > > > >