Allow {web_,task_,}replicas to be 0 and split out molecule tests (#1468)

Signed-off-by: Rick Elrod <rick@elrod.me>
This commit is contained in:
Rick Elrod
2023-07-18 16:07:55 -05:00
committed by GitHub
parent ef7703563b
commit c9ab99385a
19 changed files with 186 additions and 23 deletions

View File

@@ -88,6 +88,7 @@
command: >-
bash -c "awx-manage showmigrations | grep -v '[X]' | grep '[ ]' | wc -l"
changed_when: false
when: awx_task_pod_name != ''
register: database_check
- name: Migrate the database if the K8s resources were updated. # noqa 305
@@ -99,11 +100,13 @@
bash -c "awx-manage migrate --noinput"
register: migrate_result
when:
- awx_task_pod_name != ''
- database_check is defined
- (database_check.stdout|trim) != '0'
- name: Initialize Django
include_tasks: initialize_django.yml
when: awx_task_pod_name != ''
- name: Update status variables
include_tasks: update_status.yml

View File

@@ -285,5 +285,7 @@
- name: Verify the resource pod name is populated.
assert:
that: awx_task_pod_name != ''
that:
- awx_task_pod_name != ''
fail_msg: "Could not find the tower pod's name."
when: task_replicas | int > 0 or (task_replicas == '' and replicas > 0)

View File

@@ -53,6 +53,7 @@
bash -c "awx-manage --version"
register: instance_version
changed_when: false
when: awx_task_pod_name != ''
- name: Update version status
operator_sdk.util.k8s_status:
@@ -62,6 +63,7 @@
namespace: "{{ ansible_operator_meta.namespace }}"
status:
version: "{{ instance_version.stdout | trim }}"
when: instance_version is not skipped
- name: Update image status
operator_sdk.util.k8s_status:

View File

@@ -8,9 +8,9 @@ metadata:
{{ lookup("template", "../common/templates/labels/common.yaml.j2") | indent(width=4) | trim }}
{{ lookup("template", "../common/templates/labels/version.yaml.j2") | indent(width=4) | trim }}
spec:
{% if task_replicas %}
{% if task_replicas != '' %}
replicas: {{ task_replicas }}
{% elif replicas %}
{% elif replicas != '' %}
replicas: {{ replicas }}
{% endif %}
selector:

View File

@@ -9,9 +9,9 @@ metadata:
{{ lookup("template", "../common/templates/labels/common.yaml.j2") | indent(width=4) | trim }}
{{ lookup("template", "../common/templates/labels/version.yaml.j2") | indent(width=4) | trim }}
spec:
{% if web_replicas %}
{% if web_replicas != '' %}
replicas: {{ web_replicas }}
{% elif replicas %}
{% elif replicas != '' %}
replicas: {{ replicas }}
{% endif %}
selector: