-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/60600/
-----------------------------------------------------------
(Updated July 25, 2017, 2:06 p.m.)
Review request for mesos, Avinash sridharan and Jie Yu.
Changes
-------
Rebased.
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 (updated)
-----
src/slave/containerizer/mesos/isolators/network/cni/cni.cpp
831bc7d0774a0ad3c8cbd7f42d4a3f8bd34d3243
Diff: https://reviews.apache.org/r/60600/diff/4/
Changes: https://reviews.apache.org/r/60600/diff/3-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