Add development mode for AWX

This commit is contained in:
Shane McDonald
2021-01-25 12:26:49 -05:00
parent 0d7e047df3
commit 48ba257f67
7 changed files with 41 additions and 23 deletions

View File

@@ -46,11 +46,10 @@ After a few minutes, your new AWX instance will be accessible at `http://awx.myc
### Deploying a specific version of AWX ### Deploying a specific version of AWX
You can pass AWX Task and Web Container images to control which version of AWX is to be deployed. To achieve this, please add following to variables under spec within your CR (Custom Resource) file: To achieve this, please add the following variable under spec within your CR (Custom Resource) file:
```yaml ```yaml
tower_task_image: ansible/awx:15.0.0 # replace this with desired image tower_image: ansible/awx:15.0.0 # replace this with desired image
tower_web_image: ansible/awx:15.0.0 # replace this with desired image
``` ```
You may also override any default variables from `roles/awx/defaults/main.yml` using the same process, i.e. by adding those variables within your CR spec. You may also override any default variables from `roles/awx/defaults/main.yml` using the same process, i.e. by adding those variables within your CR spec.

View File

@@ -9,7 +9,7 @@
- name: Deploy AWX - name: Deploy AWX
k8s: k8s:
state: "{{ state | default('present') }}" state: "{{ state | default('present') }}"
namespace: awx namespace: default
apply: yes apply: yes
wait: yes wait: yes
definition: definition:
@@ -22,4 +22,7 @@
tower_admin_email: test@example.com tower_admin_email: test@example.com
tower_admin_password: changeme tower_admin_password: changeme
tower_broadcast_websocket_secret: changeme tower_broadcast_websocket_secret: changeme
tower_ingress_type: Route tower_ingress_type: "{{ tower_ingress_type | default(omit) }}" # Either Route or Ingress
tower_image: "{{ tower_image | default(omit) }}"
development_mode: "{{ development_mode | default(omit) }}"
tower_image_pull_policy: "{{ tower_image_pull_policy | default(omit) }}"

View File

@@ -15,8 +15,7 @@ spec:
tower_admin_email: test@example.com tower_admin_email: test@example.com
tower_admin_password: changeme tower_admin_password: changeme
tower_task_image: ansible/awx:15.0.0 tower_image: ansible/awx:15.0.0
tower_web_image: ansible/awx:15.0.0
tower_task_mem_request: 1Gi tower_task_mem_request: 1Gi
tower_task_cpu_request: 500m tower_task_cpu_request: 500m

View File

@@ -15,8 +15,7 @@ spec:
tower_admin_email: test@example.com tower_admin_email: test@example.com
tower_admin_password: changeme tower_admin_password: changeme
tower_task_image: ansible/awx:15.0.0 tower_image: ansible/awx:15.0.0
tower_web_image: ansible/awx:15.0.0
tower_task_mem_request: 128M tower_task_mem_request: 128M
tower_task_cpu_request: 500m tower_task_cpu_request: 500m

View File

@@ -25,11 +25,10 @@ metadata:
"tower_postgres_storage_request": "8Gi", "tower_postgres_storage_request": "8Gi",
"tower_redis_image": "redis:latest", "tower_redis_image": "redis:latest",
"tower_task_cpu_request": "500m", "tower_task_cpu_request": "500m",
"tower_task_image": "ansible/awx:15.0.0", "tower_image": "ansible/awx:15.0.0",
"tower_task_mem_request": "1Gi", "tower_task_mem_request": "1Gi",
"tower_task_privileged": false, "tower_task_privileged": false,
"tower_web_cpu_request": "1000m", "tower_web_cpu_request": "1000m"
"tower_web_image": "ansible/awx:15.0.0",
"tower_web_mem_request": "2Gi" "tower_web_mem_request": "2Gi"
} }
}, },
@@ -55,11 +54,10 @@ metadata:
"tower_postgres_storage_request": "8Gi", "tower_postgres_storage_request": "8Gi",
"tower_redis_image": "redis:latest", "tower_redis_image": "redis:latest",
"tower_task_cpu_request": "500m", "tower_task_cpu_request": "500m",
"tower_task_image": "ansible/awx:15.0.0", "tower_image": "ansible/awx:15.0.0",
"tower_task_mem_request": "128M", "tower_task_mem_request": "128M",
"tower_task_privileged": false, "tower_task_privileged": false,
"tower_web_cpu_request": "500m", "tower_web_cpu_request": "500m",
"tower_web_image": "ansible/awx:15.0.0",
"tower_web_mem_request": "128M" "tower_web_mem_request": "128M"
} }
} }

View File

@@ -27,14 +27,9 @@ tower_broadcast_websocket_secret: changeme
# emptyDir: {} # emptyDir: {}
tower_extra_volumes: '' tower_extra_volumes: ''
# Use these image versions for Ansible Tower.
# tower_task_image: registry.redhat.io/ansible-tower-37/ansible-tower-rhel7:3.7.0
# tower_web_image: registry.redhat.io/ansible-tower-37/ansible-tower-rhel7:3.7.0
# Use these image versions for Ansible AWX. # Use these image versions for Ansible AWX.
tower_task_image: ansible/awx:15.0.0 tower_image: ansible/awx:15.0.0
tower_web_image: ansible/awx:15.0.0
tower_image_pull_policy: IfNotPresent tower_image_pull_policy: IfNotPresent
tower_create_preload_data: true tower_create_preload_data: true
@@ -83,3 +78,5 @@ tower_postgres_data_path: '/var/lib/postgresql/data/pgdata'
tower_postgres_port: 5432 tower_postgres_port: 5432
ca_trust_bundle: "/etc/pki/tls/certs/ca-bundle.crt" ca_trust_bundle: "/etc/pki/tls/certs/ca-bundle.crt"
development_mode: false

View File

@@ -39,7 +39,7 @@ spec:
readOnly: true readOnly: true
- name: {{ meta.name }}-redis-socket - name: {{ meta.name }}-redis-socket
mountPath: "/var/run/redis" mountPath: "/var/run/redis"
- image: '{{ tower_web_image }}' - image: '{{ tower_image }}'
name: '{{ meta.name }}-web' name: '{{ meta.name }}-web'
{% if tower_web_command %} {% if tower_web_command %}
command: {{ tower_web_command }} command: {{ tower_web_command }}
@@ -74,18 +74,28 @@ spec:
mountPath: "/var/run/awx-rsyslog" mountPath: "/var/run/awx-rsyslog"
- name: rsyslog-dir - name: rsyslog-dir
mountPath: "/var/lib/awx/rsyslog" mountPath: "/var/lib/awx/rsyslog"
{% if development_mode | bool %}
- name: awx-devel
mountPath: "/awx_devel"
{% endif %}
{% if tower_web_extra_volume_mounts -%} {% if tower_web_extra_volume_mounts -%}
{{ tower_web_extra_volume_mounts | indent(width=12, indentfirst=True) }} {{ tower_web_extra_volume_mounts | indent(width=12, indentfirst=True) }}
{% endif %} {% endif %}
{% if tower_task_extra_env %} {% if (development_mode | bool) or (tower_task_extra_env | bool) %}
env: env:
{% endif %}
{% if development_mode | bool %}
- name: AWX_KUBE_DEVEL
value: "1"
{% endif %}
{% if tower_task_extra_env %}
{{ tower_web_extra_env | indent(width=12, indentfirst=True) }} {{ tower_web_extra_env | indent(width=12, indentfirst=True) }}
{% endif %} {% endif %}
resources: resources:
requests: requests:
memory: '{{ tower_web_mem_request }}' memory: '{{ tower_web_mem_request }}'
cpu: '{{ tower_web_cpu_request }}' cpu: '{{ tower_web_cpu_request }}'
- image: '{{ tower_task_image }}' - image: '{{ tower_image }}'
name: '{{ meta.name }}-task' name: '{{ meta.name }}-task'
imagePullPolicy: '{{ tower_image_pull_policy }}' imagePullPolicy: '{{ tower_image_pull_policy }}'
{% if tower_task_privileged == true %} {% if tower_task_privileged == true %}
@@ -118,6 +128,10 @@ spec:
mountPath: "/var/run/awx-rsyslog" mountPath: "/var/run/awx-rsyslog"
- name: rsyslog-dir - name: rsyslog-dir
mountPath: "/var/lib/awx/rsyslog" mountPath: "/var/lib/awx/rsyslog"
{% if development_mode | bool %}
- name: awx-devel
mountPath: "/awx_devel"
{% endif %}
{% if tower_task_extra_volume_mounts -%} {% if tower_task_extra_volume_mounts -%}
{{ tower_task_extra_volume_mounts | indent(width=12, indentfirst=True) }} {{ tower_task_extra_volume_mounts | indent(width=12, indentfirst=True) }}
{% endif %} {% endif %}
@@ -134,6 +148,10 @@ spec:
valueFrom: valueFrom:
fieldRef: fieldRef:
fieldPath: status.podIP fieldPath: status.podIP
{% if development_mode | bool %}
- name: AWX_KUBE_DEVEL
value: "1"
{% endif %}
{% if tower_task_extra_env -%} {% if tower_task_extra_env -%}
{{ tower_task_extra_env | indent(width=12, indentfirst=True) }} {{ tower_task_extra_env | indent(width=12, indentfirst=True) }}
{% endif %} {% endif %}
@@ -182,6 +200,11 @@ spec:
emptyDir: {} emptyDir: {}
- name: rsyslog-dir - name: rsyslog-dir
emptyDir: {} emptyDir: {}
{% if development_mode | bool %}
- name: awx-devel
hostPath:
path: /awx_devel
{% endif %}
{% if tower_extra_volumes -%} {% if tower_extra_volumes -%}
{{ tower_extra_volumes | indent(width=8, indentfirst=True) }} {{ tower_extra_volumes | indent(width=8, indentfirst=True) }}
{% endif %} {% endif %}