Files
awx-operator/docs/user-guide/advanced-configuration/custom-volume-and-volume-mount-options.md
2023-07-26 17:08:20 -04:00

6.9 KiB

Custom Volume and Volume Mount Options

In a scenario where custom volumes and volume mounts are required to either overwrite defaults or mount configuration files.

Name Description Default
extra_volumes Specify extra volumes to add to the application pod ''
web_extra_volume_mounts Specify volume mounts to be added to Web container ''
task_extra_volume_mounts Specify volume mounts to be added to Task container ''
rsyslog_extra_volume_mounts Specify volume mounts to be added to Rsyslog container ''
ee_extra_volume_mounts Specify volume mounts to be added to Execution container ''
init_container_extra_volume_mounts Specify volume mounts to be added to Init container ''
init_container_extra_commands Specify additional commands for Init container ''

⚠️ The ee_extra_volume_mounts and extra_volumes will only take effect to the globally available Execution Environments. For custom ee, please customize the Pod spec.

Example configuration for ConfigMap

---
apiVersion: v1
kind: ConfigMap
metadata:
  name: <resourcename>-extra-config
  namespace: <target namespace>
data:
  ansible.cfg: |
     [defaults]
     remote_tmp = /tmp
     [ssh_connection]
     ssh_args = -C -o ControlMaster=auto -o ControlPersist=60s
  custom.py:  |
      INSIGHTS_URL_BASE = "example.org"
      AWX_CLEANUP_PATHS = True

Example spec file for volumes and volume mounts

---
    spec:
    ...
      extra_volumes: |
        - name: ansible-cfg
          configMap:
            defaultMode: 420
            items:
              - key: ansible.cfg
                path: ansible.cfg
            name: <resourcename>-extra-config
        - name: custom-py
          configMap:
            defaultMode: 420
            items:
              - key: custom.py
                path: custom.py
            name: <resourcename>-extra-config
        - name: shared-volume
          persistentVolumeClaim:
            claimName: my-external-volume-claim

      init_container_extra_volume_mounts: |
        - name: shared-volume
          mountPath: /shared

      init_container_extra_commands: |
        # set proper permissions (rwx) for the awx user
        chmod 775 /shared
        chgrp 1000 /shared

      ee_extra_volume_mounts: |
        - name: ansible-cfg
          mountPath: /etc/ansible/ansible.cfg
          subPath: ansible.cfg

      task_extra_volume_mounts: |
        - name: custom-py
          mountPath: /etc/tower/conf.d/custom.py
          subPath: custom.py
        - name: shared-volume
          mountPath: /shared

⚠️ Volume and VolumeMount names cannot contain underscores(_)

Custom UWSGI Configuration

We allow the customization of two UWSGI parameters:

  • processes with uwsgi_processes (default 5)
  • listen with uwsgi_listen_queue_size (default 128)

Note: Increasing the listen queue beyond 128 requires that the sysctl setting net.core.somaxconn be set to an equal value or higher. The operator will set the appropriate securityContext sysctl value for you, but it is a required that this sysctl be added to an allowlist on the kubelet level. See kubernetes docs about allowing this sysctl setting.

These vars relate to the vertical and horizontal scalibility of the web service.

Increasing the number of processes allows more requests to be actively handled per web pod, but will consume more CPU and Memory and the resource requests should be increased in tandem. Increasing the listen queue allows uwsgi to queue up requests not yet being handled by the active worker processes, which may allow the web pods to handle more "bursty" request patterns if many requests (more than 128) tend to come in a short period of time, but can all be handled before any other time outs may apply. Also see related nginx configuration.

Custom Nginx Configuration

Using the extra_volumes feature, it is possible to extend the nginx.conf.

  1. Create a ConfigMap with the extra settings you want to include in the nginx.conf
  2. Create an extra_volumes entry in the AWX spec for this ConfigMap
  3. Create an web_extra_volume_mounts entry in the AWX spec to mount this volume

The AWX nginx config automatically includes /etc/nginx/conf.d/*.conf if present.

Additionally there are some global configuration values in the base nginx config that are available for setting with individual variables. These vars relate to the vertical and horizontal scalibility of the web service. Increasing the number of processes allows more requests to be actively handled per web pod, but will consume more CPU and Memory and the resource requests should be increased in tandem. Increasing the listen queue allows nginx to queue up requests not yet being handled by the active worker processes, which may allow the web pods to handle more "bursty" request patterns if many requests (more than 128) tend to come in a short period of time, but can all be handled before any other time outs may apply. Also see related uwsgi configuration.

Custom Favicon

You can use custom volume mounts to mount in your own favicon to be displayed in your AWX browser tab.

First, Create the configmap from a local favicon.ico file.

$ oc create configmap favicon-configmap --from-file favicon.ico

Then specify the extra_volume and web_extra_volume_mounts on your AWX CR spec

spec:
  extra_volumes: |
    - name: favicon
      configMap:
        defaultMode: 420
        items:
          - key: favicon.ico
            path: favicon.ico
        name: favicon-configmap
  web_extra_volume_mounts: |
    - name: favicon
      mountPath: /var/lib/awx/public/static/media/favicon.ico
      subPath: favicon.ico