mirror of
https://github.com/ansible/awx-operator.git
synced 2026-03-26 21:33:14 +00:00
Compare gating version against existing deployment versions (#1972)
* Compare gating version against existing deployment versions and set upgradeFrom status * Add quotes to default version Co-authored-by: Dimitri Savineau <savineau.dimitri@gmail.com>
This commit is contained in:
19
roles/installer/tasks/check_existing.yml
Normal file
19
roles/installer/tasks/check_existing.yml
Normal file
@@ -0,0 +1,19 @@
|
||||
---
|
||||
|
||||
- name: Check for existing deployment
|
||||
k8s_info:
|
||||
api_version: "{{ api_version }}"
|
||||
kind: "{{ kind }}"
|
||||
namespace: "{{ ansible_operator_meta.namespace }}"
|
||||
name: "{{ ansible_operator_meta.name }}"
|
||||
register: existing_deployment
|
||||
|
||||
- name: Set previous_version version based on AWX CR version status
|
||||
ansible.builtin.set_fact:
|
||||
previous_version: "{{ existing_deployment.resources[0].status.version | default('0.0.0') }}"
|
||||
when: existing_deployment['resources'] | length
|
||||
|
||||
- name: If previous_version is less than or equal to gating_version, set upgraded_from to previous_version
|
||||
ansible.builtin.set_fact:
|
||||
upgraded_from: "{{ previous_version }}"
|
||||
when: previous_version is version_compare(gating_version, '<')
|
||||
@@ -23,6 +23,10 @@
|
||||
namespace: "{{ ansible_operator_meta.namespace }}"
|
||||
register: awx_web_deployment
|
||||
|
||||
- name: Check for existing deployment for previous version
|
||||
include_tasks: check_existing.yml
|
||||
when: gating_version | length
|
||||
|
||||
- name: Start installation if auto_upgrade is true
|
||||
include_tasks: install.yml
|
||||
when:
|
||||
|
||||
@@ -55,6 +55,16 @@
|
||||
changed_when: false
|
||||
when: awx_web_pod_name != ''
|
||||
|
||||
- name: Update upgradedFrom status
|
||||
operator_sdk.util.k8s_status:
|
||||
api_version: '{{ api_version }}'
|
||||
kind: "{{ kind }}"
|
||||
name: "{{ ansible_operator_meta.name }}"
|
||||
namespace: "{{ ansible_operator_meta.namespace }}"
|
||||
status:
|
||||
upgradedFrom: "{{ upgraded_from }}"
|
||||
when: upgraded_from is defined
|
||||
|
||||
- name: Update version status
|
||||
operator_sdk.util.k8s_status:
|
||||
api_version: '{{ api_version }}'
|
||||
|
||||
@@ -21,3 +21,6 @@ _metrics_utility_pvc_claim: "{{ metrics_utility_pvc_claim | default(deployment_t
|
||||
_metrics_utility_pvc_claim_size: "{{ metrics_utility_pvc_claim_size | default('5Gi') }}"
|
||||
_metrics_utility_cronjob_gather_schedule: "{{ metrics_utility_cronjob_gather_schedule | default('@hourly') }}"
|
||||
_metrics_utility_cronjob_report_schedule: "{{ metrics_utility_cronjob_report_schedule | default('@monthly') }}"
|
||||
|
||||
# version check
|
||||
gating_version: ''
|
||||
|
||||
Reference in New Issue
Block a user