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,