mirror of
https://github.com/ansible/awx-operator.git
synced 2026-04-27 00:46:37 +00:00
updated
This commit is contained in:
@@ -27,8 +27,6 @@ An [Ansible AWX](https://github.com/ansible/awx) operator for Kubernetes built w
|
||||
* [LDAP Certificate Authority](#ldap-certificate-authority)
|
||||
* [Persisting Projects Directory](#persisting-projects-directory)
|
||||
* [Custom Volume and Volume Mount Options](#custom-volume-and-volume-mount-options)
|
||||
* [Upgrade Notes](#upgrade-notes)
|
||||
* [From Older Versions](#from-older-versions)
|
||||
* [Exporting Environment Variables to Containers](#exporting-environment-variables-to-containers)
|
||||
* [Development](#development)
|
||||
* [Testing](#testing)
|
||||
@@ -482,13 +480,6 @@ Example spec file for volumes and volume mounts
|
||||
|
||||
> :warning: **Volume and VolumeMount names cannot contain underscores(_)**
|
||||
|
||||
## Upgrade Notes
|
||||
|
||||
### From Older Versions
|
||||
|
||||
For `AWX` instances created by the `awx-operator<0.0.8`, it is required both PostgreSQL `statefulset` and AWX `deployment` resources to be deleted and recreated. This is required due to new labels added on both resources and the requirement of the Kubernetes API which enforces `selector.matchLabels` attributes to be `ready-only`.
|
||||
|
||||
The `awx-operator` will handle the upgrading both resources. Note that just the `statefulset` and `deployment` will be recreated. Therefore, any `persistent volume` used on any of these 2 resources, **shall not be deleted**.
|
||||
#### Exporting Environment Variables to Containers
|
||||
|
||||
If you need to export custom environment variables to your containers.
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
---
|
||||
|
||||
- name: Check for presence of Deployment
|
||||
k8s_info:
|
||||
api_version: v1
|
||||
kind: Deployment
|
||||
name: "{{ meta.name }}"
|
||||
namespace: "{{ meta.namespace }}"
|
||||
register: tower_deployment
|
||||
|
||||
- name: Scale down Deployment for migration
|
||||
k8s_scale:
|
||||
api_version: v1
|
||||
kind: Deployment
|
||||
name: "{{ meta.name }}"
|
||||
namespace: "{{ meta.namespace }}"
|
||||
replicas: 0
|
||||
wait: yes
|
||||
when: tower_deployment['resources'] | length
|
||||
@@ -64,40 +64,12 @@
|
||||
set_fact:
|
||||
pg_config: '{{ _generated_pg_config_resources["resources"] | default([]) | length | ternary(_generated_pg_config_resources, _pg_config) }}'
|
||||
|
||||
- name: Check if PostgreSQL statefuset is present
|
||||
k8s_info:
|
||||
api_version: v1
|
||||
kind: StatefulSet
|
||||
namespace: '{{ meta.namespace }}'
|
||||
name: '{{ meta.name }}-postgres'
|
||||
register: _postgres_statefulset_result
|
||||
|
||||
- name: Determine if PostgreSQL statefulset must be recreated
|
||||
set_fact:
|
||||
# yamllint disable-line rule:line-length
|
||||
recreate_statefulset: '{{ _postgres_statefulset_result["resources"][0]["metadata"]["labels"]["app.kubernetes.io/managed-by"] | default("") | ternary("False", "True") }}' # noqa 204
|
||||
when: _postgres_statefulset_result['resources'] | length
|
||||
|
||||
- block:
|
||||
- name: Check and scale down deployment
|
||||
include_tasks: check_and_scale_down_deployment.yml
|
||||
|
||||
- name: Delete PostgreSQL statefulset to ensure expected labels
|
||||
k8s:
|
||||
state: absent
|
||||
api_version: v1
|
||||
kind: StatefulSet
|
||||
namespace: '{{ meta.namespace }}'
|
||||
name: '{{ meta.name }}-postgres'
|
||||
wait: yes
|
||||
when: recreate_statefulset is defined and recreate_statefulset|bool
|
||||
|
||||
- name: Create Database if no database is specified
|
||||
k8s:
|
||||
apply: true
|
||||
definition: "{{ lookup('template', 'tower_postgres.yaml.j2') }}"
|
||||
when:
|
||||
- pg_config['resources'][0]['data']['type'] | default('') | b64decode == 'managed' or recreate_statefulset|bool
|
||||
- pg_config['resources'][0]['data']['type'] | default('') | b64decode == 'managed'
|
||||
|
||||
- name: Store Database Configuration
|
||||
set_fact:
|
||||
|
||||
@@ -24,8 +24,23 @@
|
||||
set_fact:
|
||||
postgres_pod_name: "{{ postgres_pod['resources'][0]['metadata']['name'] }}"
|
||||
|
||||
- name: Check and scale down deployment
|
||||
include_tasks: check_and_scale_down_deployment.yml
|
||||
- name: Check for presence of Deployment
|
||||
k8s_info:
|
||||
api_version: v1
|
||||
kind: Deployment
|
||||
name: "{{ meta.name }}"
|
||||
namespace: "{{ meta.namespace }}"
|
||||
register: tower_deployment
|
||||
|
||||
- name: Scale down Deployment for migration
|
||||
k8s_scale:
|
||||
api_version: v1
|
||||
kind: Deployment
|
||||
name: "{{ meta.name }}"
|
||||
namespace: "{{ meta.namespace }}"
|
||||
replicas: 0
|
||||
wait: yes
|
||||
when: tower_deployment['resources'] | length
|
||||
|
||||
- name: Set pg_dump command
|
||||
set_fact:
|
||||
|
||||
@@ -1,19 +1,5 @@
|
||||
---
|
||||
|
||||
- name: Check if deployment is present
|
||||
k8s_info:
|
||||
api_version: v1
|
||||
kind: Deployment
|
||||
namespace: '{{ meta.namespace }}'
|
||||
name: '{{ meta.name }}'
|
||||
register: _deployment_result
|
||||
|
||||
- name: Determine if deployment must be recreated
|
||||
set_fact:
|
||||
# yamllint disable-line rule:line-length
|
||||
recreate_deployment: '{{ _deployment_result["resources"][0]["metadata"]["labels"]["app.kubernetes.io/managed-by"] | default("") | ternary("False", "True") }}' # noqa 204
|
||||
when: _deployment_result['resources'] | length
|
||||
|
||||
- name: Get the current resource pod information.
|
||||
k8s_info:
|
||||
api_version: v1
|
||||
@@ -26,22 +12,11 @@
|
||||
field_selectors:
|
||||
- status.phase=Running
|
||||
register: tower_pods
|
||||
changed_when: tower_pods["resources"] | length
|
||||
|
||||
- name: Set the resource pod name as a variable.
|
||||
set_fact:
|
||||
tower_pod_name: "{{ tower_pods['resources'][0]['metadata']['name'] | default('') }}"
|
||||
|
||||
- name: Delete deployment to ensure expected labels
|
||||
k8s:
|
||||
state: absent
|
||||
api_version: v1
|
||||
kind: Deployment
|
||||
namespace: '{{ meta.namespace }}'
|
||||
name: '{{ meta.name }}'
|
||||
wait: yes
|
||||
when: recreate_deployment is defined and recreate_deployment|bool
|
||||
|
||||
- name: Apply Resources
|
||||
k8s:
|
||||
apply: yes
|
||||
|
||||
Reference in New Issue
Block a user