docs written

Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/062e3871
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/062e3871
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/062e3871

Branch: refs/heads/trunk
Commit: 062e38718c11b8f06aa23437828f0d114d06c878
Parents: 5cd5f9d
Author: Mario Loria <ma...@arroyonetworks.com>
Authored: Thu Oct 6 18:19:36 2016 -0400
Committer: Anthony Shaw <anthonys...@apache.org>
Committed: Sat Oct 8 13:29:22 2016 +1100

----------------------------------------------------------------------
 docs/_static/images/provider_logos/rancher.png  | Bin 0 -> 9386 bytes
 docs/container/drivers/rancher.rst              |  79 +++++++++++++++++++
 .../container/rancher/deploy_container.py       |  13 +++
 .../container/rancher/deploy_service.py         |  17 ++++
 docs/examples/container/rancher/deploy_stack.py |  13 +++
 .../container/rancher/instantiate_driver.py     |   9 +++
 .../container/rancher/search_containers.py      |  12 +++
 7 files changed, 143 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/062e3871/docs/_static/images/provider_logos/rancher.png
----------------------------------------------------------------------
diff --git a/docs/_static/images/provider_logos/rancher.png 
b/docs/_static/images/provider_logos/rancher.png
new file mode 100644
index 0000000..82dde39
Binary files /dev/null and b/docs/_static/images/provider_logos/rancher.png 
differ

http://git-wip-us.apache.org/repos/asf/libcloud/blob/062e3871/docs/container/drivers/rancher.rst
----------------------------------------------------------------------
diff --git a/docs/container/drivers/rancher.rst 
b/docs/container/drivers/rancher.rst
new file mode 100644
index 0000000..63cc8ea
--- /dev/null
+++ b/docs/container/drivers/rancher.rst
@@ -0,0 +1,79 @@
+Rancher Container Service Documentation
+=======================================
+
+Rancher is a container orchestration platform.
+
+.. figure:: /_static/images/provider_logos/rancher.png
+    :align: center
+    :width: 300
+    :target: http://rancher.com/
+
+This driver supports the main top-level interactions for handling containers,
+services, and stacks in a Rancher Environment.
+
+Here are some notes around this driver:
+
+- Does not support user based API credentials, only Environment API
+  credentials (one env, no cluster support)
+- Does not support images other than docker formatted images. ``docker:``
+  prefix is forced!
+- Images follow a standardized format. See deploy_container docstring!
+- ``launchConfig`` options for ``ex_deploy_service`` can all be defined at the
+  top level then get slipstreamed appropriately.
+- Passing your own cert/key of any sort for SSL/TLS is not presently supported.
+- For SSL/TLS (https) support with newer versions of OpenSSL, the following
+  is necessary (in your own code):
+
+  .. code::
+    import ssl
+    import libcloud.security
+    libcloud.security.SSL_VERSION = ssl.PROTOCOL_TLSv1_2
+
+To enable API access, obtain an Environment API Key from your Rancher Server
+for the specific environment you want to control.
+
+Instantiating the driver
+------------------------
+
+.. literalinclude:: /examples/container/rancher/instantiate_driver.py
+   :language: python
+
+Deploying a container
+---------------------
+
+.. literalinclude:: /examples/container/rancher/deploy_container.py
+   :language: python
+
+Deploying a service
+-------------------
+
+.. literalinclude:: /examples/container/rancher/deploy_service.py
+   :language: python
+
+Deploying a stack
+-----------------
+
+.. literalinclude:: /examples/container/rancher/deploy_stack.py
+   :language: python
+
+Searching for a container
+-------------------------
+
+.. literalinclude:: /examples/container/rancher/search_containers.py
+   :language: python
+
+API Docs
+--------
+
+.. autoclass:: libcloud.container.drivers.rancher.RancherContainerDriver
+    :members:
+    :inherited-members:
+
+Contributors
+------------
+
+For the first version of this driver, Mario Loria of Arroyo Networks wrote most
+of the code. He received help from Anthony Shaw, a core libcloud contributor
+and Vincent Fiduccia, software architect at Rancher Labs.
+
+.. _`Rancher`: https://rancher.com/
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/libcloud/blob/062e3871/docs/examples/container/rancher/deploy_container.py
----------------------------------------------------------------------
diff --git a/docs/examples/container/rancher/deploy_container.py 
b/docs/examples/container/rancher/deploy_container.py
new file mode 100644
index 0000000..51b64b2
--- /dev/null
+++ b/docs/examples/container/rancher/deploy_container.py
@@ -0,0 +1,13 @@
+from libcloud.container.types import Provider
+from libcloud.container.providers import get_driver
+
+driver = get_driver(Provider.RANCHER)
+
+connection = driver("MYRANCHERACCESSKEY", "MYRANCHERSECRETKEY",
+                    host="172.30.0.100", port=8080, secure=False)
+
+image = ContainerImage("hastebin", "hastebin", "rlister/hastebin", "latest",
+                       driver=None)
+
+new_container = connection.deploy_container(name="awesomecontainer",
+                                            image=image, networkMode="managed")

http://git-wip-us.apache.org/repos/asf/libcloud/blob/062e3871/docs/examples/container/rancher/deploy_service.py
----------------------------------------------------------------------
diff --git a/docs/examples/container/rancher/deploy_service.py 
b/docs/examples/container/rancher/deploy_service.py
new file mode 100644
index 0000000..036aa1c
--- /dev/null
+++ b/docs/examples/container/rancher/deploy_service.py
@@ -0,0 +1,17 @@
+from libcloud.container.types import Provider
+from libcloud.container.providers import get_driver
+
+driver = get_driver(Provider.RANCHER)
+
+connection = driver("MYRANCHERACCESSKEY", "MYRANCHERSECRETKEY",
+                    host="17.23.66.4", port=443)
+
+image = ContainerImage("hastebin", "hastebin", "rlister/hastebin", "latest",
+                       driver=None)
+
+new_service = connection.ex_deploy_service(name="excitingservice", image=image,
+                                           environmentid="1e2",
+                                           environment={
+                                               "STORAGE_TYPE": "file"
+                                           })
+

http://git-wip-us.apache.org/repos/asf/libcloud/blob/062e3871/docs/examples/container/rancher/deploy_stack.py
----------------------------------------------------------------------
diff --git a/docs/examples/container/rancher/deploy_stack.py 
b/docs/examples/container/rancher/deploy_stack.py
new file mode 100644
index 0000000..52d5122
--- /dev/null
+++ b/docs/examples/container/rancher/deploy_stack.py
@@ -0,0 +1,13 @@
+from libcloud.container.types import Provider
+from libcloud.container.providers import get_driver
+
+driver = get_driver(Provider.RANCHER)
+
+connection = driver("MYRANCHERACCESSKEY", "MYRANCHERSECRETKEY",
+                    host="172.30.0.100", port=8080, secure=False)
+
+new_stack = connection.ex_deploy_stack(name="GhostBlog",
+                                       description="Contains services for the"
+                                                   "ghost blog.")
+
+id_of_new_stack = new_stack['id']
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/libcloud/blob/062e3871/docs/examples/container/rancher/instantiate_driver.py
----------------------------------------------------------------------
diff --git a/docs/examples/container/rancher/instantiate_driver.py 
b/docs/examples/container/rancher/instantiate_driver.py
new file mode 100644
index 0000000..8472599
--- /dev/null
+++ b/docs/examples/container/rancher/instantiate_driver.py
@@ -0,0 +1,9 @@
+from libcloud.container.types import Provider
+from libcloud.container.providers import get_driver
+
+driver = get_driver(Provider.RANCHER)
+
+connection = driver("MYRANCHERACCESSKEY", "MYRANCHERSECRETKEY",
+                    host="172.30.0.100", port=8080, secure=False)
+
+connection.list_containers()

http://git-wip-us.apache.org/repos/asf/libcloud/blob/062e3871/docs/examples/container/rancher/search_containers.py
----------------------------------------------------------------------
diff --git a/docs/examples/container/rancher/search_containers.py 
b/docs/examples/container/rancher/search_containers.py
new file mode 100644
index 0000000..8e7d632
--- /dev/null
+++ b/docs/examples/container/rancher/search_containers.py
@@ -0,0 +1,12 @@
+from libcloud.container.types import Provider
+from libcloud.container.providers import get_driver
+
+driver = get_driver(Provider.RANCHER)
+
+connection = driver("MYRANCHERACCESSKEY", "MYRANCHERSECRETKEY",
+                    host="172.30.22.1", port=8080, secure=False)
+
+search_results = connection.ex_search_containers(
+    search_params={ "imageUuid": "docker:mysql", "state": "running" })
+
+id_of_first_result = search_results[0]['id']
\ No newline at end of file

Reply via email to