> On Aug. 26, 2016, 9:23 a.m., Qian Zhang wrote:
> > src/slave/containerizer/mesos/isolators/network/cni/plugins/port_mapper/port_mapper.hpp,
> >  lines 39-41
> > <https://reviews.apache.org/r/51097/diff/8/?file=1486417#file1486417line39>
> >
> >     I am not sure why we need two classes here, I think we can just have 
> > one class `PortMapper`, and in `PortMapper::execute()`, we can:
> >     1. Execute delegate plugin via `subprocess`.
> >     2. Wait for the execution of delegate plugin to finish.
> >     3. Install port-forwarding rules.
> >     4. Return the result of delegate plugin.

Was following the Isolator interface semantics. The idea being that the 
PortMapper acts a helper class to the libprocess. 

Not sure but this will also simplify Mocking of this CNI plugin, when write the 
unit-test. Would like to keep these interface semantics, since it de-couples 
the calls from libprocess semantics.


- Avinash


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/51097/#review146782
-----------------------------------------------------------


On Aug. 26, 2016, 5:21 a.m., Avinash sridharan wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/51097/
> -----------------------------------------------------------
> 
> (Updated Aug. 26, 2016, 5:21 a.m.)
> 
> 
> Review request for mesos, Jie Yu and Qian Zhang.
> 
> 
> Bugs: MESOS-6023
>     https://issues.apache.org/jira/browse/MESOS-6023
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> This class will embody the logic for implementing the CNI port-mapper
> plugin.
> 
> 
> Diffs
> -----
> 
>   src/Makefile.am 120a715eeeb7fb222d1169500950b5c7643df554 
>   
> src/slave/containerizer/mesos/isolators/network/cni/plugins/port_mapper/main.cpp
>  PRE-CREATION 
>   
> src/slave/containerizer/mesos/isolators/network/cni/plugins/port_mapper/port_mapper.hpp
>  PRE-CREATION 
>   
> src/slave/containerizer/mesos/isolators/network/cni/plugins/port_mapper/port_mapper.cpp
>  PRE-CREATION 
> 
> Diff: https://reviews.apache.org/r/51097/diff/
> 
> 
> Testing
> -------
> 
> Tested the port-mapper with the following CNI config:
> {
>     "name": "mynet",
>     "type": "port-mapper",
>     "chain": "MESOS",
>     "delegate": {
>       "type" : "bridge",
>       "bridge": "cni0",
>       "isGateway": true,
>       "ipMasq": true,
>       "ipam": {
>           "type": "host-local",
>           "subnet": "10.22.0.0/16",
>           "routes": [
>             { "dst": "0.0.0.0/0" }
>           ]
>       }
>     },
>     "args" : {
>       "org.apache.mesos" : {
>         "network_info" : {
>           "port_mappings": {
>             "host_port" : 80,
>             "container_port" : 80
>           }
>         }
>       }
>     }
> }
> 
> and the following environment variables:
> export CNI_COMMAND="ADD"
> export CNI_CONTAINERID="0000000111101110"
> export CNI_PATH="$MESOS_INSTALL:/home/vagrant/dev/go/cni/bin"
> export CNI_IFNAME="eth0"
> export CNI_NETNS="/etc/netns"
> 
> If we remove fields from the above CNI config, or remove certain environment 
> variables the creation of the `PortMapper` correctly fails. However, if 
> config and environment variables are passed as is it will create the 
> `PortMapper` correctly.
> 
> 
> Thanks,
> 
> Avinash sridharan
> 
>

Reply via email to