mirror of
https://github.com/ansible/awx-operator.git
synced 2026-05-08 06:12:54 +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)
|
* [LDAP Certificate Authority](#ldap-certificate-authority)
|
||||||
* [Persisting Projects Directory](#persisting-projects-directory)
|
* [Persisting Projects Directory](#persisting-projects-directory)
|
||||||
* [Custom Volume and Volume Mount Options](#custom-volume-and-volume-mount-options)
|
* [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)
|
* [Exporting Environment Variables to Containers](#exporting-environment-variables-to-containers)
|
||||||
* [Development](#development)
|
* [Development](#development)
|
||||||
* [Testing](#testing)
|
* [Testing](#testing)
|
||||||
@@ -482,13 +480,6 @@ Example spec file for volumes and volume mounts
|
|||||||
|
|
||||||
> :warning: **Volume and VolumeMount names cannot contain underscores(_)**
|
> :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
|
#### Exporting Environment Variables to Containers
|
||||||
|
|
||||||
If you need to export custom environment variables to your 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:
|
set_fact:
|
||||||
pg_config: '{{ _generated_pg_config_resources["resources"] | default([]) | length | ternary(_generated_pg_config_resources, _pg_config) }}'
|
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
|
- name: Create Database if no database is specified
|
||||||
k8s:
|
k8s:
|
||||||
apply: true
|
apply: true
|
||||||
definition: "{{ lookup('template', 'tower_postgres.yaml.j2') }}"
|
definition: "{{ lookup('template', 'tower_postgres.yaml.j2') }}"
|
||||||
when:
|
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
|
- name: Store Database Configuration
|
||||||
set_fact:
|
set_fact:
|
||||||
|
|||||||
@@ -24,8 +24,23 @@
|
|||||||
set_fact:
|
set_fact:
|
||||||
postgres_pod_name: "{{ postgres_pod['resources'][0]['metadata']['name'] }}"
|
postgres_pod_name: "{{ postgres_pod['resources'][0]['metadata']['name'] }}"
|
||||||
|
|
||||||
- name: Check and scale down deployment
|
- name: Check for presence of Deployment
|
||||||
include_tasks: check_and_scale_down_deployment.yml
|
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
|
- name: Set pg_dump command
|
||||||
set_fact:
|
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.
|
- name: Get the current resource pod information.
|
||||||
k8s_info:
|
k8s_info:
|
||||||
api_version: v1
|
api_version: v1
|
||||||
@@ -26,22 +12,11 @@
|
|||||||
field_selectors:
|
field_selectors:
|
||||||
- status.phase=Running
|
- status.phase=Running
|
||||||
register: tower_pods
|
register: tower_pods
|
||||||
changed_when: tower_pods["resources"] | length
|
|
||||||
|
|
||||||
- name: Set the resource pod name as a variable.
|
- name: Set the resource pod name as a variable.
|
||||||
set_fact:
|
set_fact:
|
||||||
tower_pod_name: "{{ tower_pods['resources'][0]['metadata']['name'] | default('') }}"
|
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
|
- name: Apply Resources
|
||||||
k8s:
|
k8s:
|
||||||
apply: yes
|
apply: yes
|
||||||
|
|||||||
Reference in New Issue
Block a user