Skip to content

Commit

Permalink
idle_deployment - Scale down deployments to put AWX into an idle state
Browse files Browse the repository at this point in the history
  • Loading branch information
aknochow committed Feb 6, 2025
1 parent 3d1ecc1 commit d2cc378
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 0 deletions.
3 changes: 3 additions & 0 deletions config/crd/bases/awx.ansible.com_awxs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1965,6 +1965,9 @@ spec:
description: Disable web container's nginx ipv6 listener
type: boolean
default: false
idle_deployment:
description: Scale down deployments to put AWX into an idle state
type: boolean
metrics_utility_enabled:
description: Enable metrics utility
type: boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1155,6 +1155,13 @@ spec:
- urn:alm:descriptor:com.tectonic.ui:advanced
- urn:alm:descriptor:com.tectonic.ui:booleanSwitch
- urn:alm:descriptor:com.tectonic.ui:fieldDependency:metrics_utility_enabled:true
- description: Scale down deployments to put AWX into an idle state
displayName: Idle AWX
path: idle_deployment
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:advanced
- urn:alm:descriptor:com.tectonic.ui:booleanSwitch
- urn:alm:descriptor:com.tectonic.ui:hidden
statusDescriptors:
- description: Route to access the instance deployed
displayName: URL
Expand Down
3 changes: 3 additions & 0 deletions roles/installer/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -505,3 +505,6 @@ nginx_worker_cpu_affinity: 'auto'
nginx_listen_queue_size: "{{ uwsgi_listen_queue_size }}"

extra_settings_files: {}

# idle_deployment - Scale down deployments to put AWX into an idle state
idle_deployment: false
31 changes: 31 additions & 0 deletions roles/installer/tasks/idle_deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
- name: Scale down AWX Deployments
kubernetes.core.k8s:
state: present
definition:
apiVersion: apps/v1
kind: Deployment
metadata:
name: "{{ item }}"
namespace: "{{ ansible_operator_meta.namespace }}"
spec:
replicas: 0
loop:
- '{{ ansible_operator_meta.name }}-task'
- '{{ ansible_operator_meta.name }}-web'

- name: Scale down PostgreSQL Statefulset
kubernetes.core.k8s:
state: present
definition:
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: "{{ ansible_operator_meta.name }}-postgres-{{ supported_pg_version }}"
namespace: "{{ ansible_operator_meta.namespace }}"
spec:
replicas: 0
when: managed_database

- name: End Playbook
ansible.builtin.meta: end_play
4 changes: 4 additions & 0 deletions roles/installer/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
---
- name: Idle AWX
include_tasks: idle_deployment.yml
when: idle_deployment | bool

- name: Check for presence of old awx Deployment
k8s_info:
api_version: apps/v1
Expand Down

0 comments on commit d2cc378

Please sign in to comment.