mesos-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Avinash sridharan <avin...@mesosphere.io>
Subject Re: Review Request 60600: Set container DNS with `--default_container_dns` in CNI isolator.
Date Fri, 28 Jul 2017 00:44:47 GMT

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




src/slave/containerizer/mesos/isolators/network/cni/cni.cpp
Lines 1011 (patched)
<https://reviews.apache.org/r/60600/#comment257255>

    We are missing the `*` wildcard match option here,.i.e, if the `network_mode = CNI` and
the `network_name` is not set it means it is the default DNS config for all the CNI networks.
While setting up DNS we want to setup the DNS for the most specific match.


- Avinash sridharan


On July 25, 2017, 6:06 a.m., Qian Zhang wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/60600/
> -----------------------------------------------------------
> 
> (Updated July 25, 2017, 6:06 a.m.)
> 
> 
> Review request for mesos, Avinash sridharan and Jie Yu.
> 
> 
> Bugs: MESOS-7709
>     https://issues.apache.org/jira/browse/MESOS-7709
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> Set container DNS with `--default_container_dns` in CNI isolator.
> 
> 
> Diffs
> -----
> 
>   src/slave/containerizer/mesos/isolators/network/cni/cni.cpp 831bc7d0774a0ad3c8cbd7f42d4a3f8bd34d3243

> 
> 
> Diff: https://reviews.apache.org/r/60600/diff/4/
> 
> 
> Testing
> -------
> 
> sudo make check
> 
> 1. Start Mesos master.
> ```
> $ sudo ./bin/mesos-master.sh --work_dir=/opt/mesos
> ```
> 
> 2. Start Mesos agent.
> ```
> $ sudo ./bin/mesos-slave.sh --master=192.168.122.216:5050 --containerizers=mesos,docker
--image_providers=docker --image_provisioner_backend=aufs --isolation=filesystem/linux,docker/runtime,network/cni,cgroups/cpu,cgroups/mem
--network_cni_config_dir=/opt/cni/net_configs --network_cni_plugins_dir=/opt/cni/plugins --work_dir=/opt/mesos
--docker_store_dir=/opt/mesos/store/docker --executor_registration_timeout=60mins --default_container_dns=file:///home/stack/dns.json
> 
> $ cat /opt/cni/net_configs/net1 
> {
>     "name": "net1",
>     "type": "bridge",
>     "bridge": "br1",
>     "isGateway": true,
>     "ipMasq": true,
>     "ipam": {
>         "type": "host-local",
>         "subnet": "192.168.1.0/24",
>         "routes": [
>             { "dst": "0.0.0.0/0" }
>         ]
>     }
> }
> 
> $ cat /opt/cni/net_configs/net2 
> {
>     "name": "net2",
>     "type": "bridge",
>     "bridge": "br2",
>     "isGateway": true,
>     "ipMasq": true,
>     "ipam": {
>         "type": "host-local",
>         "subnet": "192.168.2.0/24",
>         "routes": [
>             { "dst": "0.0.0.0/0" }
>         ]
>     },
>     "dns": {
>         "nameservers": [ "8.8.4.4" ],
>         "domain": "net2.com",
>         "search": [ "yyy.com" ],
>         "options": [ "attempts:3" ]
>     }
> }
> 
> $ cat /home/stack/dns.json
> {
>   "mesos": [
>     {
>       "network_mode": "CNI",
>       "network_name": "net1",
>       "dns": {
>         "nameservers": [ "8.8.8.8" ],
>         "search": [ "xxx.com" ],
>         "options": [ "timeout:4" ]
>       }
>     }
>   ]
> }
> ```
> 
> 3. Launch a unified container with `mesos-execute`.
> ```
> $ sudo src/mesos-execute --master=192.168.122.216:5050 --task=file:///home/stack/task.json
> 
> $ cat /home/stack/task.json 
> {
>   "name": "test",
>   "task_id": {"value" : "test"},
>   "agent_id": {"value" : ""},
>   "resources": [
>     {
>       "name": "cpus",
>       "type": "SCALAR",
>       "scalar": {
>         "value": 0.1
>       }
>     },
>     {
>       "name": "mem",
>       "type": "SCALAR",
>       "scalar": {
>         "value": 32
>       }
>     }
>   ],
>   "command": {
>     "value": "sleep 300"
>   },
>   "container": {
>     "type": "MESOS",
>     "mesos": {
>       "image": {
>         "type": "DOCKER",
>         "docker": {
>           "name": "busybox"
>         }
>       }
>     },
>     "network_infos": [
>       {
>         "name": "net1"
>       },
>       {
>         "name": "net2"
>       }
>     ]
>   }
> }
> ```
> 
> 4. Check the DNS configuration of the unified container.
> ```
> $ ps -ef | grep sleep 
> root     20060 20037  2 21:45 ?        00:00:00 sh -c sleep 300
> root     20074 20060  0 21:45 ?        00:00:00 sleep 300
> 
> $ sudo nsenter -t 20060 -m -u -n cat /etc/resolv.conf           
> domain net2.com
> search yyy.com xxx.com
> options attempts:3 timeout:4
> nameserver 8.8.4.4
> nameserver 8.8.8.8
> ```
> 
> 
> Thanks,
> 
> Qian Zhang
> 
>


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message