From ed2ad1e210facd8a29483d8e32d6017822135645 Mon Sep 17 00:00:00 2001 From: mickfeech Date: Tue, 12 Feb 2019 15:28:45 -0500 Subject: [PATCH 1/4] update documentation to include kuberentes initContainers --- docs/custom_virtualenvs.md | 42 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/docs/custom_virtualenvs.md b/docs/custom_virtualenvs.md index b89ac670c1..b0d92295ac 100644 --- a/docs/custom_virtualenvs.md +++ b/docs/custom_virtualenvs.md @@ -77,6 +77,48 @@ index d69e2c9..a08bae5 100644 + VENV_BASE=/var/lib/awx/venv make requirements_custom && \ ``` +Kubernetes Custom Virtualenvs +============================= + +You can create custom virtualenvs without updating the awx images by using initContainers and a shared emptydir within Kubernetes. To start create an emptydir volume in the volumes stanza. + + volumes: + - emptyDir: {} + name: custom-venv + +Now create an initContainer stanza. You can subsititute your own custom images for this example we are using centos:7 as the base to build upon. The command stanza is where you will add the python modules you require in your virtualenv. + + initContainers: + - image: 'centos:7' + - name: init-my-custom-venv + - command: + - sh + - '-c' + - >- + yum install -y ansible python-pip curl python-setuptools epel-release openssl openssl-devel gcc python-devel && + curl 'https://bootstrap.pypa.io/get-pip.py' | python && + pip install virtualenv && + virtualenv /var/lib/awx/venv/my-custom-venv && + source /var/lib/awx/venv/my-custom-venv/bin/activate && + /var/lib/awx/venv/my-custom-venv/bin/pip install python-memcached psutil && + /var/lib/awx/venv/my-custom-venv/bin/pip install -U "ansible == X.Y.Z" && + /var/lib/awx/venv/my-custom-venv/bin/pip install -U custom-python-module + - volumeMounts: + - mountPath: /var/lib/awx/venv/my-custom-venv + name: custom-venv + +Fiinally in the awx-celery container stanza add the shared volume as a mount. + + volumeMounts: + - mountPath: /var/lib/awx/venv/my-custom-venv + name: custom-venv + - mountPath: /etc/tower + name: awx-application-config + readOnly: true + - mountPath: /etc/tower/conf.d + name: awx-confd + readOnly: true + Assigning Custom Virtualenvs ============================ Once you've created a custom virtualenv, you can assign it at the Organization, From 0138e92ddcc9b5a7f907354aa2ee7169cad1c647 Mon Sep 17 00:00:00 2001 From: Unknown Date: Thu, 14 Feb 2019 10:12:54 -0500 Subject: [PATCH 2/4] update documentation to include kuberentes initContainers Update documentation to include Kubernetes initContainers in custom virtualenvs --- docs/custom_virtualenvs.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/custom_virtualenvs.md b/docs/custom_virtualenvs.md index b0d92295ac..8bb937d94b 100644 --- a/docs/custom_virtualenvs.md +++ b/docs/custom_virtualenvs.md @@ -90,8 +90,8 @@ Now create an initContainer stanza. You can subsititute your own custom images initContainers: - image: 'centos:7' - - name: init-my-custom-venv - - command: + name: init-my-custom-venv + command: - sh - '-c' - >- @@ -103,11 +103,11 @@ Now create an initContainer stanza. You can subsititute your own custom images /var/lib/awx/venv/my-custom-venv/bin/pip install python-memcached psutil && /var/lib/awx/venv/my-custom-venv/bin/pip install -U "ansible == X.Y.Z" && /var/lib/awx/venv/my-custom-venv/bin/pip install -U custom-python-module - - volumeMounts: + volumeMounts: - mountPath: /var/lib/awx/venv/my-custom-venv name: custom-venv -Fiinally in the awx-celery container stanza add the shared volume as a mount. +Fiinally in the awx-celery and awx-web containers stanza add the shared volume as a mount. volumeMounts: - mountPath: /var/lib/awx/venv/my-custom-venv From 67ca2fa3356e201ebeee4ddd79b695cf045a59f5 Mon Sep 17 00:00:00 2001 From: Unknown Date: Thu, 14 Feb 2019 10:12:54 -0500 Subject: [PATCH 3/4] update documentation to include kuberentes initContainers Update documentation to include Kubernetes initContainers in custom virtualenvs --- docs/custom_virtualenvs.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/custom_virtualenvs.md b/docs/custom_virtualenvs.md index b0d92295ac..8bb937d94b 100644 --- a/docs/custom_virtualenvs.md +++ b/docs/custom_virtualenvs.md @@ -90,8 +90,8 @@ Now create an initContainer stanza. You can subsititute your own custom images initContainers: - image: 'centos:7' - - name: init-my-custom-venv - - command: + name: init-my-custom-venv + command: - sh - '-c' - >- @@ -103,11 +103,11 @@ Now create an initContainer stanza. You can subsititute your own custom images /var/lib/awx/venv/my-custom-venv/bin/pip install python-memcached psutil && /var/lib/awx/venv/my-custom-venv/bin/pip install -U "ansible == X.Y.Z" && /var/lib/awx/venv/my-custom-venv/bin/pip install -U custom-python-module - - volumeMounts: + volumeMounts: - mountPath: /var/lib/awx/venv/my-custom-venv name: custom-venv -Fiinally in the awx-celery container stanza add the shared volume as a mount. +Fiinally in the awx-celery and awx-web containers stanza add the shared volume as a mount. volumeMounts: - mountPath: /var/lib/awx/venv/my-custom-venv From 3c382322b08ed64b42b086ea53948ce0ecacd233 Mon Sep 17 00:00:00 2001 From: mickfeech Date: Wed, 20 Mar 2019 16:33:02 -0400 Subject: [PATCH 4/4] Fix misspelled word --- docs/custom_virtualenvs.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/custom_virtualenvs.md b/docs/custom_virtualenvs.md index 8bb937d94b..397be349c0 100644 --- a/docs/custom_virtualenvs.md +++ b/docs/custom_virtualenvs.md @@ -107,7 +107,7 @@ Now create an initContainer stanza. You can subsititute your own custom images - mountPath: /var/lib/awx/venv/my-custom-venv name: custom-venv -Fiinally in the awx-celery and awx-web containers stanza add the shared volume as a mount. +Finally in the awx-celery and awx-web containers stanza add the shared volume as a mount. volumeMounts: - mountPath: /var/lib/awx/venv/my-custom-venv