From 6dfb430dc301e858250d9b0aa7381d265895e662 Mon Sep 17 00:00:00 2001
From: Eduardo Gonzalez <dabarren@gmail.com>
Date: Thu, 13 Apr 2017 13:10:37 +0100
Subject: [PATCH] Add zun startup guide documentation

Zun need some changes in the docker daemon prior
to deploy.
Add some verification steps after deployment.

This change add a global deploy and verification steps.

Change-Id: Id02e5c32bc92c51bff04b2c5bc81f234f25bc5ca
---
 doc/index.rst     |  1 +
 doc/zun-guide.rst | 99 +++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 100 insertions(+)
 create mode 100644 doc/zun-guide.rst

diff --git a/doc/index.rst b/doc/index.rst
index 27dcc60984..5a99fdfccd 100644
--- a/doc/index.rst
+++ b/doc/index.rst
@@ -70,6 +70,7 @@ Services
    bifrost
    networking-guide
    kuryr-guide
+   zun-guide
 
 Developer Docs
 ==============
diff --git a/doc/zun-guide.rst b/doc/zun-guide.rst
new file mode 100644
index 0000000000..7eb067e04e
--- /dev/null
+++ b/doc/zun-guide.rst
@@ -0,0 +1,99 @@
+Zun in Kolla
+============
+
+"Zun is an OpenStack Container service. It aims to provide an
+OpenStack API for provisioning and managing containerized
+workload on OpenStack." [1].
+
+Preparation and Deployment
+--------------------------
+
+To allow Zun Compute connect to the Docker Daemon, add the following in the
+``docker.service` file on each zun-compute node.
+
+::
+
+  ExecStart= -H tcp://<DOCKER_SERVICE_IP>:2375 -H unix:///var/run/docker.sock
+
+.. note::
+
+  ``DOCKER_SERVICE_IP`` is zun-compute host IP address. ```2375``` is port that
+  allows Docker daemon to be accessed remotely.
+
+By default zun is disabled in the ``group_vars/all.yml``.
+In order to enable it, you need to edit the file globals.yml and set the
+following variable:
+
+::
+
+  enable_zun: "yes"
+
+Deploy the OpenStack cloud and zun.
+
+::
+
+  $ kolla-ansible deploy
+
+Verify
+------
+
+Generate the credentials file.
+
+::
+
+  $ kolla-ansible post-deploy
+
+Source credentials file.
+
+::
+
+  $ source /etc/kolla/admin-openrc.sh
+
+Download and create a glance container image.
+
+::
+
+  $ docker pull cirros
+  $ docker save cirros | openstack image create cirros --public \
+    --container-format docker --disk-format raw
+
+Create zun container.
+
+::
+
+  $ zun create --name test --command "ping -c 4 8.8.8.8" cirros
+
+Verify container is created.
+
+::
+
+  $ zun list
+  +--------------------------------------+------+---------------+---------+------------+------------+-------+
+  | uuid                                 | name | image         | status  | task_state | addresses  | ports |
+  +--------------------------------------+------+---------------+---------+------------+------------+-------+
+  | 3719a73e-5f86-47e1-bc5f-f4074fc749f2 | test | cirros        | Created | None       | 172.17.0.3 | []    |
+  +--------------------------------------+------+---------------+---------+------------+------------+-------+
+
+Start container.
+
+::
+
+  $ zun start test
+  Request to start container test has been accepted.
+
+Verify container.
+
+::
+
+  $ zun logs test
+  PING 8.8.8.8 (8.8.8.8): 56 data bytes
+  64 bytes from 8.8.8.8: seq=0 ttl=45 time=96.396 ms
+  64 bytes from 8.8.8.8: seq=1 ttl=45 time=96.504 ms
+  64 bytes from 8.8.8.8: seq=2 ttl=45 time=96.721 ms
+  64 bytes from 8.8.8.8: seq=3 ttl=45 time=95.884 ms
+
+  --- 8.8.8.8 ping statistics ---
+  4 packets transmitted, 4 packets received, 0% packet loss
+  round-trip min/avg/max = 95.884/96.376/96.721 ms
+
+[1] https://github.com/openstack/zun
-- 
GitLab