aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCédric Ollivier <cedric.ollivier@orange.com>2017-10-10 15:44:00 +0200
committerCédric Ollivier <cedric.ollivier@orange.com>2017-10-11 16:33:04 +0200
commitcb52dd523c58a6567b53ea5b79169295e1471117 (patch)
treed11e915ff27950d550965f9ff0d4c2af498685f3
parentb020adb0c47f5d85b5cc1b3b3927e689698499ff (diff)
Publish Docker Slicing Presentation
It published the presentation done in the Functest Breakout during last OPNFV Summit (2017 in Beijing) [1]. Minor changes are planned to update it in a second change. Git now ignores pdf which may be generated via reveal.js. [1] http://testresults.opnfv.org/functest/dockerslicing/ Change-Id: I2b6cf113c672320bf1bc34442bb267fd99012546 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
-rw-r--r--.gitignore1
-rw-r--r--docs/com/pres/dockerslicing/dockerslicing.md170
-rw-r--r--docs/com/pres/dockerslicing/index.html52
3 files changed, 223 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index f6e40620..81ebca89 100644
--- a/.gitignore
+++ b/.gitignore
@@ -17,3 +17,4 @@ functest.egg-info
*venv
.tox
*.out
+*.pdf
diff --git a/docs/com/pres/dockerslicing/dockerslicing.md b/docs/com/pres/dockerslicing/dockerslicing.md
new file mode 100644
index 00000000..55fb2557
--- /dev/null
+++ b/docs/com/pres/dockerslicing/dockerslicing.md
@@ -0,0 +1,170 @@
+# Docker slicing
+
+[Cédric Ollivier](mailto:cedric.ollivier@orange.com)
+
+OPNVF Summit 2017 (Beijing)
+
+
+
+## Current issues
+
+
+### Dockerfile
+
+- it copies all the files hosted by the third-party projects (eg docs, .git...)
+- several requirements are downgraded/upgraded when building the container as they are managed one after the other
+- it could download packages from [PyPI](https://pypi.python.org/pypi) (e.g. [rally](https://pypi.python.org/pypi/rally/)...) instead of cloning git repository
+- build dependencies can't be removed to save space as it creates multiple layers (>70)
+
+
+### setup.py
+
+- no requirement is installed when calling *python setup.py install* as none of the next keys are set:
+ - install_requires
+ - tests_require
+ - dependency_links
+- shell scripts are not installed neither in $PATH nor in dist-packages
+
+
+### setup.py
+
+- master is considered as an incorrect version
+- empty package_data seems useless
+- zip_safe flag could be set as False as \__file__ would prevent functest from working in a zipfile
+- py_modules should not list cli_base as it was moved into functest package
+
+
+
+## Proposals
+
+
+### why not relying on [pbr](https://docs.openstack.org/developer/pbr/)?
+
+- pbr injects requirements into the install_requires, tests_require and/or dependency_links arguments to setup
+- it supports conditional dependencies which can be added to the requirements (e.g. subprocess32; python_version=='2.7')
+
+
+### setup.py
+
+```python
+#!/usr/bin/env python
+
+from setuptools import setup
+
+setup(
+ setup_requires=['pbr>=1.9', 'setuptools>=17.1'],
+ pbr=True,
+)
+```
+
+
+### setup.cfg
+
+```ini
+[metadata]
+name = functest
+version = 5
+home-page = https://wiki.opnfv.org/display/functest
+
+[files]
+packages = functest
+scripts =
+ docker/docker_remote_api/enable_remote_api.sh
+ docker/add_images.sh
+ docker/config_install_env.sh
+
+[entry_points]
+console_scripts =
+ functest = functest.cli.cli_base:cli
+```
+
+
+### Split requirements into (at least) 3 files
+
+- **requirements.txt** which could list all abstract (i.e. [not associated with any particular index](https://packaging.python.org/requirements/)) dependencies of the functest package
+- **test-requirements.txt** which could list all abstract dependencies required for testing the functest package
+- **thirdparty-requirements.txt** which could list all abstract and concrete dependencies required by the full functest docker container
+
+
+### tox.ini
+
+```ini
+[testenv]
+usedevelop = True
+deps =
+ -r{toxinidir}/requirements.txt
+ -r{toxinidir}/test-requirements.txt
+ git+https://gerrit.opnfv.org/gerrit/releng#egg=opnfv&subdirectory=modules
+ git+https://gerrit.opnfv.org/gerrit/barometer#egg=baro_tests
+ git+https://gerrit.opnfv.org/gerrit/snaps#egg=snaps
+
+```
+
+
+### Dockerfile
+
+```
+RUN pip install \
+ git+https://gerrit.opnfv.org/gerrit/functest@$BRANCH#egg=functest \
+ git+https://gerrit.opnfv.org/gerrit/releng@$BRANCH#egg=opnfv\&subdirectory=modules \
+ git+https://gerrit.opnfv.org/gerrit/barometer@$BRANCH#egg=baro_tests \
+ git+https://gerrit.opnfv.org/gerrit/snaps@$BRANCH#egg=snaps
+```
+
+
+### Switch to Alpine
+
+```
+FROM alpine:3.5
+
+RUN apk --no-cache add --update \
+ python libffi libssl1.0 libjpeg-turbo py-pip && \
+ apk --no-cache add --virtual .build-deps --update \
+ python-dev build-base linux-headers libffi-dev \
+ openssl-dev libjpeg-turbo-dev git && \
+ pip install git+https://gerrit.opnfv.org/gerrit/releng#egg=opnfv\&subdirectory=modules \
+ git+https://gerrit.opnfv.org/gerrit/barometer#egg=baro_tests \
+ git+https://gerrit.opnfv.org/gerrit/snaps#egg=snaps \
+ git+https://gerrit.opnfv.org/gerrit/functest@$BRANCH#egg=functest && \
+ apk del .build-deps
+```
+
+
+### Status
+
+ - the change [**"leveraging on pbr"**](https://gerrit.opnfv.org/gerrit/#/c/35813/) can be merged
+ - docker containers have been published (any test is welcome):
+ - [ollivier/functest-pbr](https://hub.docker.com/r/ollivier/functest-pbr/)
+ - [ollivier/functest-alpine](https://hub.docker.com/r/ollivier/functest-alpine/)
+ - the Dockerfile switching to Alpine can be published too
+
+
+
+## Next steps
+
+
+### docker slicing
+
+the previous alpine example could be the base image and we could simply create other images from it (see [FROM](https://docs.docker.com/engine/reference/builder/#from)) by installing all third party python packages
+
+
+### PyPI
+
+functest could be published to the [Python Package Index](https://pypi.python.org/pypi) and then we would stop listing urls
+
+
+
+## on the road
+
+
+### We could be faced with issues
+
+- several test cases can fail if their requirements are incomplete in setup.py (we should help them to fix it)
+- all conditions for requirements may not be compatible (OpenStack requirements as a guideline?)
+- we should fix lots of hardcoded paths hidden by the previous design
+- some files could be outside the python package (e.g. functest ci scripts)
+
+
+
+## Thank You!
+
diff --git a/docs/com/pres/dockerslicing/index.html b/docs/com/pres/dockerslicing/index.html
new file mode 100644
index 00000000..1c65e4fa
--- /dev/null
+++ b/docs/com/pres/dockerslicing/index.html
@@ -0,0 +1,52 @@
+<html>
+<head>
+<title>Docker slicing</title>
+<meta name="author" content="Cédric Ollivier">
+<meta name="viewport"
+ content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
+<link rel="stylesheet" href="../reveal.js/css/reveal.css">
+<link rel="stylesheet" href="../reveal.js/css/theme/white.css">
+<link rel="stylesheet" href="../reveal.js/lib/css/zenburn.css">
+<script>
+var link = document.createElement( 'link' );
+link.rel = 'stylesheet';
+link.type = 'text/css';
+link.href = window.location.search.match( /print-pdf/gi ) ? '../reveal.js/css/print/pdf.css' : '../reveal.js/css/print/paper.css';
+document.getElementsByTagName( 'head' )[0].appendChild( link );
+</script>
+</head>
+<body>
+ <div class="reveal">
+ <div class="slides">
+ <section data-markdown="dockerslicing.md" data-separator="^\n\n\n"
+ data-separator-vertical="^\n\n" data-separator-notes="^Note:"></section>
+ </div>
+ </div>
+ <script src="../reveal.js/lib/js/head.min.js"></script>
+ <script src="../reveal.js/js/reveal.js"></script>
+ <script>
+ Reveal.initialize({
+ dependencies : [ {
+ src : '../reveal.js/plugin/markdown/marked.js',
+ condition : function() {
+ return !!document.querySelector('[data-markdown]');
+ }
+ }, {
+ src : '../reveal.js/plugin/markdown/markdown.js',
+ condition : function() {
+ return !!document.querySelector('[data-markdown]');
+ }
+ }, {
+ src: '../reveal.js/plugin/highlight/highlight.js',
+ async: true,
+ callback: function() {
+ hljs.initHighlightingOnLoad();
+ }
+ }, {
+ src: '../reveal.js/plugin/notes/notes.js',
+ async: true
+ } ]
+ });
+ </script>
+</body>
+</html>