Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
a39ea88
LIBCLOUD-781 shell of a container base driver, API and test harnesses
tonybaloney Dec 22, 2015
ee814b6
WIP driver for docker
tonybaloney Dec 23, 2015
ef18fbd
Tests for the docker engine, based on a 1.91 running instance. Added …
tonybaloney Dec 23, 2015
0dc5573
Docker example and help content updates
tonybaloney Dec 23, 2015
e982273
Updated examples and added logo to docs
tonybaloney Dec 23, 2015
fe7ba5c
Added entry path for dedicated docker doc link
tonybaloney Dec 23, 2015
e61bad5
Added Joyent Triton as a Docker service provider with driver.
tonybaloney Dec 23, 2015
e7665f9
Added Joyent help links
tonybaloney Dec 23, 2015
2450063
Updated example doc with correct syntax. Formatted bash prompt for jo…
tonybaloney Dec 23, 2015
6d83dc0
Added APi docs for Joyent triton driver.
tonybaloney Dec 23, 2015
8e749b5
Added clusters to the specification, for ACS, and Google container se…
tonybaloney Dec 23, 2015
6a4a772
Adding comments and additional explanation to the docker driver.
tonybaloney Dec 23, 2015
f1674de
An additional driver to demonstrate the cluster capabilities. driver …
tonybaloney Dec 28, 2015
c8024ad
Merge commit '6ddd2bd81c8a79fb5456ba857f265ef16ac11910' into LIBCLOUD…
tonybaloney Dec 28, 2015
edb1265
Merge branch 'trunk' into LIBCLOUD-781_containers
tonybaloney Dec 28, 2015
69cd184
Merge branch 'trunk' into LIBCLOUD-781_containers
tonybaloney Dec 28, 2015
7c27da6
Updated all delete methods to destroy to fit with convention of other…
tonybaloney Dec 28, 2015
d51dd3d
corrected indentation
tonybaloney Dec 28, 2015
c82230f
Corrected indentation
tonybaloney Dec 28, 2015
f4c1e2e
Update provider table
tonybaloney Dec 29, 2015
a1adaae
Further implementation details to the ECS driver
tonybaloney Dec 29, 2015
b64d2fa
Extend the API ECS driver to support 'services', updated methods to P…
tonybaloney Dec 30, 2015
5473771
Tell the Mock HTTP object to use the method name 'root' when the path…
tonybaloney Dec 30, 2015
0999e52
Docs for ECS driver
tonybaloney Jan 1, 2016
9507a63
Updated doc warnings, updated AWS request signer to support POST.
tonybaloney Jan 3, 2016
4bde5af
removed local junk from example code, included real fixtures from act…
tonybaloney Jan 3, 2016
57a0ca9
Updated AWS unit tests for the request signing mocks with the new met…
tonybaloney Jan 3, 2016
83c06fe
Use triton PNG instead of SVG image as logo
tonybaloney Jan 3, 2016
c247ea8
Merge branch 'trunk' into LIBCLOUD-781_containers
tonybaloney Jan 3, 2016
9274450
Updated docs to fix warning about duplicate key
tonybaloney Jan 3, 2016
c5edd3a
Updated fixtures for ECS from further field testing. updated docs wit…
tonybaloney Jan 3, 2016
8c01c62
You can't have 2 drivers with the same name. That's really a bug but …
tonybaloney Jan 3, 2016
c188d32
Improved the documentation to better explain the 2 types of drivers (…
tonybaloney Jan 5, 2016
db7d8f0
Added graphviz to the sphinx extensions, added some graphs for the co…
tonybaloney Jan 6, 2016
f909e6b
Merge branch 'trunk' into LIBCLOUD-781_containers
tonybaloney Jan 6, 2016
0aec851
Fixes to docs and merge tags
tonybaloney Jan 6, 2016
88390ae
ask travis to install graphviz
tonybaloney Jan 7, 2016
c6a57a8
install graphviz via easy_install
tonybaloney Jan 7, 2016
5e6b38f
travis containers can't install deps, so had to turn that off
tonybaloney Jan 7, 2016
3280fc3
less-convincing looking secrets
tonybaloney Jan 7, 2016
5aa34e1
removed stray merge tag
tonybaloney Jan 9, 2016
6e4df6d
Added basic ECR support
tonybaloney Jan 9, 2016
223b517
Added a utility class for the Docker Hub (and therefore docker regist…
tonybaloney Jan 10, 2016
104cdb1
Merge branch 'trunk' into LIBCLOUD-781_containers
tonybaloney Jan 10, 2016
d29629d
refactor the docker hub client to inherit from a registry api client,…
tonybaloney Jan 11, 2016
f00a9b7
Extended the ECS driver to support the new container registry API, wi…
tonybaloney Jan 11, 2016
621ec71
Fix the path for the doc example
tonybaloney Jan 11, 2016
a3ed405
Docker hub root paths were incorrect, also include content-type heade…
tonybaloney Jan 11, 2016
8537731
__repr__ for images shows path instead of driver name, fix doc refere…
tonybaloney Jan 11, 2016
f3943ea
updated build configuration with recommendation from travis support team
tonybaloney Jan 12, 2016
936fe42
Start of a kubernetes server running against an unauthenticated host,…
tonybaloney Jan 13, 2016
0b87588
Extended the Kubernetes driver to support deploying containers as sin…
tonybaloney Jan 13, 2016
c8c6c2f
Docs for the kubernetes driver. Fixed provider factory not referencin…
tonybaloney Jan 13, 2016
65bc1dd
Merge branch 'trunk' into LIBCLOUD-781_containers
tonybaloney Jan 19, 2016
a477303
Update the docs with the version numbers. Mark the kubernetes driver …
tonybaloney Jan 19, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .ratignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@ test/storage/fixtures/
test/compute/fixtures/
test/loadbalancer/fixtures/
test/dns/fixtures/
test/container/fixtures/
coverage_html_report/
.coverage
.coveragerc
libcloud/data/pricing.json
libcloud/common/__init__.py
libcloud/compute/__init__.py
libcloud/container/__init__.py
libcloud/storage/__init__.py
libcloud/loadbalancer/__init__.py
libcloud/dns/__init__.py
Expand Down
12 changes: 7 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ python:
- 3.4
- 3.5
- "pypy"
sudo: false
os:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I missed this change.

You use sudo bellow so even if the sudo attribute is removed, it will still result in using legacy (non container) Travis CI infrastructure.

I think they added support for installing debian packages which still allows you to use new container based infrastructure. I will look into it.

- linux
# Note: OS X has been broken on Travis for a long time
Expand All @@ -17,15 +16,18 @@ env:

matrix:
fast_finish: true
allow_failures:
- os: osx
include:
- python: 2.7
- sudo: required
python: 2.7
env: ENV=lint
before_script: TOX_ENV=lint
- python: 2.7
- sudo: required
python: 2.7
env: ENV=docs
before_script: TOX_ENV=docs-travis
before_install:
- sudo apt-get update -qq
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not 100% sure if that's the root cause, but lint and docs jobs / tasks seems to have started getting stuck (https://travis-ci.org/apache/libcloud see build history, current build is stuck as well) after this change was merged (first I thought it might be an issue with Travis).

Will see if my change (17384ca) fixes that.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sadly addons stuff doesn't appear to work (I didn't dig in too much), but at least "jobs getting stuck" part is fixed now.

I believe builds got stuck because "sudo: required" is not a valid syntax or something related to that.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't figure out why the addons stuff is not working (I tried many different things) :/

It seems that it works for all the tasks except the docs one (https://travis-ci.org/apache/libcloud/jobs/104312529).

I checked other projects and they use the same syntax and it works just fine for them.

- sudo apt-get install -y graphviz
# Trigger ReadTheDocs build
after_success: ./contrib/trigger_rtd_build.py 8284

Expand Down
7 changes: 6 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ Changes with current version of Apache Libcloud
General
~~~~~~~

- Introduction of container based drivers for Docker, Rkt and Container-as-a-service
providers
(LIBCLOUD-781, GITHUB-666)
[Anthony Shaw]

- Introduce a new ``libcloud.backup`` API for Backup as a Service projects and
products.
(GITHUB-621)
Expand Down Expand Up @@ -63,7 +68,7 @@ DNS
[Wido den Hollander]

Changes with Apache Libcloud 0.20.0
-----------------------------------
-------------------------------------------

General
~~~~~~~
Expand Down
2 changes: 2 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ Resources you can manage with Libcloud are divided into the following categories
CloudFiles (``libcloud.storage.*``)
* **Load Balancers** - Load Balancers as a Service, LBaaS (``libcloud.loadbalancer.*``)
* **DNS** - DNS as a Service, DNSaaS (``libcloud.dns.*``)
* **Container** - Container virtualization services (``libcloud.container.*``)


Apache Libcloud is an Apache project, see <http://libcloud.apache.org> for
more information.
Expand Down
32 changes: 31 additions & 1 deletion contrib/generate_provider_feature_matrix_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@
from libcloud.dns.providers import DRIVERS as DNS_DRIVERS
from libcloud.dns.types import Provider as DNSProvider

from libcloud.container.base import ContainerDriver
from libcloud.container.providers import get_driver as get_container_driver
from libcloud.container.providers import DRIVERS as CONTAINER_DRIVERS
from libcloud.container.types import Provider as ContainerProvider

from libcloud.backup.base import BackupDriver
from libcloud.backup.providers import get_driver as get_backup_driver
from libcloud.backup.providers import DRIVERS as BACKUP_DRIVERS
Expand Down Expand Up @@ -94,6 +99,11 @@
'dns': ['list_zones', 'list_records', 'iterate_zones', 'iterate_records',
'create_zone', 'update_zone', 'create_record', 'update_record',
'delete_zone', 'delete_record'],
'container': ['install_image', 'list_images', 'deploy_container',
'get_container', 'start_container', 'stop_container',
'restart_container', 'destroy_container', 'list_containers',
'list_locations', 'create_cluster', 'destroy_cluster',
'list_clusters'],
'backup': ['get_supported_target_types', 'list_targets', 'create_target', 'create_target_from_node',
'create_target_from_storage_container', 'update_target', 'delete_target', 'list_recovery_points',
'recover_target', 'recover_target_out_of_place', 'list_target_jobs', 'create_target_job',
Expand Down Expand Up @@ -169,6 +179,21 @@
'delete_zone': 'delete zone',
'delete_record': 'delete record'
},
'container': {
'install_image': 'install image',
'list_images': 'list images',
'deploy_container': 'deploy container',
'get_container': 'get container',
'list_containers': 'list containers',
'start_container': 'start container',
'stop_container': 'stop container',
'restart_container': 'restart container',
'destroy_container': 'destroy container',
'list_locations': 'list locations',
'create_cluster': 'create cluster',
'destroy_cluster': 'destroy cluster',
'list_clusters': 'list clusters'
},
'backup': {
'get_supported_target_types': 'get supported target types',
'list_targets': 'list targets',
Expand All @@ -185,7 +210,7 @@
'resume_target_job': 'resume target job',
'suspend_target_job': 'suspend target job',
'cancel_target_job': 'cancel target job'
},
}
}

IGNORED_PROVIDERS = [
Expand Down Expand Up @@ -229,6 +254,11 @@ def generate_providers_table(api):
drivers = DNS_DRIVERS
provider = DNSProvider
get_driver_method = get_dns_driver
elif api == 'container':
driver = ContainerDriver
drivers = CONTAINER_DRIVERS
provider = ContainerProvider
get_driver_method = get_container_driver
elif api == 'backup':
driver = BackupDriver
drivers = BACKUP_DRIVERS
Expand Down
Binary file added docs/_static/images/provider_logos/docker.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_static/images/provider_logos/kubernetes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_static/images/provider_logos/triton.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.intersphinx',
'sphinx.ext.viewcode']
'sphinx.ext.viewcode', 'sphinx.ext.graphviz']
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice 👍


# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
Expand Down
15 changes: 15 additions & 0 deletions docs/container/_supported_methods.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.. NOTE: This file has been generated automatically using generate_provider_feature_matrix_table.py script, don't manually edit it

=================================== ============= =========== ================ ============= =============== ============== ================= ================= =============== ============== ============== =============== =============
Provider install image list images deploy container get container start container stop container restart container destroy container list containers list locations create cluster destroy cluster list clusters
=================================== ============= =========== ================ ============= =============== ============== ================= ================= =============== ============== ============== =============== =============
`Docker`_ yes yes yes yes yes yes yes yes yes no no no no
`Amazon Elastic Container Service`_ no yes yes yes yes yes yes yes yes no yes yes yes
`Joyent Triton`_ yes yes yes yes yes yes yes yes yes no no no no
`Kubernetes`_ no no yes yes no no no yes yes no yes yes yes
=================================== ============= =========== ================ ============= =============== ============== ================= ================= =============== ============== ============== =============== =============

.. _`Docker`: http://docker.io
.. _`Amazon Elastic Container Service`: https://aws.amazon.com/ecs/details/
.. _`Joyent Triton`: http://joyent.com
.. _`Kubernetes`: http://kubernetes.io
15 changes: 15 additions & 0 deletions docs/container/_supported_providers.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.. NOTE: This file has been generated automatically using generate_provider_feature_matrix_table.py script, don't manually edit it

=================================== ============================================ ================= ============================================ ==================================
Provider Documentation Provider constant Module Class Name
=================================== ============================================ ================= ============================================ ==================================
`Docker`_ :doc:`Click </container/drivers/docker>` DOCKER :mod:`libcloud.container.drivers.docker` :class:`DockerContainerDriver`
`Amazon Elastic Container Service`_ :doc:`Click </container/drivers/ecs>` ECS :mod:`libcloud.container.drivers.ecs` :class:`ElasticContainerDriver`
`Joyent Triton`_ :doc:`Click </container/drivers/joyent>` JOYENT :mod:`libcloud.container.drivers.joyent` :class:`JoyentContainerDriver`
`Kubernetes`_ :doc:`Click </container/drivers/kubernetes>` KUBERNETES :mod:`libcloud.container.drivers.kubernetes` :class:`KubernetesContainerDriver`
=================================== ============================================ ================= ============================================ ==================================

.. _`Docker`: http://docker.io
.. _`Amazon Elastic Container Service`: https://aws.amazon.com/ecs/details/
.. _`Joyent Triton`: http://joyent.com
.. _`Kubernetes`: http://kubernetes.io
19 changes: 19 additions & 0 deletions docs/container/api.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
:orphan:

Container Base API
==================

.. autoclass:: libcloud.container.base.ContainerDriver
:members:

.. autoclass:: libcloud.container.base.Container
:members:

.. autoclass:: libcloud.container.base.ContainerImage
:members:

.. autoclass:: libcloud.container.base.ContainerCluster
:members:

.. autoclass:: libcloud.container.base.ClusterLocation
:members:
26 changes: 26 additions & 0 deletions docs/container/drivers/docker.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Docker Container Driver Documentation
=====================================

`Docker`_ containers wrap up a piece of software in a complete filesystem that contains everything it needs to run:
code, runtime, system tools, system libraries – anything you can install on a server. This guarantees that it will always run the same,
regardless of the environment it is running in.

.. figure:: /_static/images/provider_logos/docker.png
:align: center
:width: 300
:target: http://docker.io/

Instantiating the driver
------------------------

.. literalinclude:: /examples/container/docker/instantiate_driver.py
:language: python

API Docs
--------

.. autoclass:: libcloud.container.drivers.docker.DockerContainerDriver
:members:
:inherited-members:

.. _`Docker`: https://docker.io/
58 changes: 58 additions & 0 deletions docs/container/drivers/ecs.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
Amazon Elastic Container Service Documentation
==============================================

Elastic Container Service is a container-as-a-service feature of `AWS`_.

.. figure:: /_static/images/provider_logos/aws.png
:align: center
:width: 300
:target: http://aws.amazon.com/

To provide API key access, you should apply one of the roles:
* AmazonEC2ContainerServiceFullAccess
* AmazonEC2ContainerServiceReadOnlyAccess

Instantiating the driver
------------------------

.. literalinclude:: /examples/container/ecs/instantiate_driver.py
:language: python

Deploying a container
---------------------

.. literalinclude:: /examples/container/ecs/deploy_container.py
:language: python

Deploying a container from Docker Hub
-------------------------------------

Docker Hub Client :class:`~libcloud.container.utils.docker.HubClient` is a shared utility class for interfacing to the public Docker Hub Service.

You can use this class for fetching images to deploy to services like ECS

.. literalinclude:: /examples/container/docker_hub.py
:language: python

Deploying a container from Amazon Elastic Container Registry (ECR)
------------------------------------------------------------------

Amazon ECR is a combination of the Docker Registry V2 API and a proprietary API. The ECS driver includes methods for talking to both APIs.

Docker Registry API Client :class:`~libcloud.container.utils.docker.RegistryClient` is a shared utility class for interfacing to the public Docker Hub Service.

You can use a factory method to generate an instance of RegsitryClient from the ECS driver. This will request a 12 hour token from the Amazon API and instantiate a :class:`~libcloud.container.utils.docker.RegistryClient`
object with those credentials.

.. literalinclude:: /examples/container/ecs/container_registry.py
:language: python

API Docs
--------

.. autoclass:: libcloud.container.drivers.ecs.ElasticContainerDriver
:members:
:inherited-members:


.. _`AWS`: https://aws.amazon.com/
12 changes: 12 additions & 0 deletions docs/container/drivers/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
:orphan:

Container Drivers Documentation
===============================

This chapter includes links to driver (provider) specific documentation pages.

.. toctree::
:glob:
:maxdepth: 1

*
64 changes: 64 additions & 0 deletions docs/container/drivers/joyent.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
Joyent Triton Container Driver Documentation
============================================

`Joyent Triton`_ is a Docker hosting service, provided by service provider Joyent.
Docker-native tools and elastic hosts make deploying on Triton as easy as running Docker on your laptop.
There is no special software to install or configure.
Mix Docker containers with container-native Linux to extend the benefits of containerization to legacy applications and stateful services.

.. figure:: /_static/images/provider_logos/triton.png
:align: center
:width: 300
:target: http://joyent.com/

Instantiating the driver
------------------------

Download the script::

curl -O https://raw.githubusercontent.com/joyent/sdc-docker/master/tools/sdc-docker-setup.sh

Now execute the script, substituting the correct values::

bash sdc-docker-setup.sh <CLOUDAPI_URL> <ACCOUNT_USERNAME> ~/.ssh/<PRIVATE_KEY_FILE>

This should output something similar to the following::

Setting up Docker client for SDC using:
CloudAPI: https://us-east-1.api.joyent.com
Account: jill
Key: /Users/localuser/.ssh/sdc-docker.id_rsa

If you have a pass phrase on your key, the openssl command will
prompt you for your pass phrase now and again later.

Verifying CloudAPI access.
CloudAPI access verified.

Generating client certificate from SSH private key.
writing RSA key
Wrote certificate files to /Users/localuser/.sdc/docker/jill

Get Docker host endpoint from cloudapi.
Docker service endpoint is: tcp://us-east-1.docker.joyent.com:2376

* * *
Success. Set your environment as follows:

export DOCKER_CERT_PATH=/Users/localuser/.sdc/docker/jill
export DOCKER_HOST=tcp://us-east-1.docker.joyent.com:2376
export DOCKER_CLIENT_TIMEOUT=300
export DOCKER_TLS_VERIFY=1

.. literalinclude:: /examples/container/joyent/instantiate_driver.py
:language: python

API Docs
--------

.. autoclass:: libcloud.container.drivers.joyent.JoyentContainerDriver
:members:
:inherited-members:


.. _`Joyent Triton`: https://www.joyent.com/blog/understanding-triton-containers
Loading