update documentation to include kuberentes initContainers

This commit is contained in:
mickfeech 2019-02-12 15:28:45 -05:00 committed by mcfeech
parent 808ed74700
commit ed2ad1e210

View File

@ -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,