mirror of
https://github.com/ansible/awx-operator.git
synced 2026-05-06 05:12:47 +00:00
Scope pvc and management pod to default namespace
- make this configurable via tower_backup_pvc_namespace var - remove redundant k8s task info
This commit is contained in:
@@ -32,6 +32,9 @@ spec:
|
||||
tower_backup_pvc:
|
||||
description: Name of the PVC to be used for storing the backup
|
||||
type: string
|
||||
tower_backup_pvc_namespace:
|
||||
description: Namespace PVC is in
|
||||
type: string
|
||||
tower_backup_size:
|
||||
description: Size of PVC
|
||||
type: string
|
||||
|
||||
@@ -32,6 +32,9 @@ spec:
|
||||
tower_backup_pvc:
|
||||
description: Name of the PVC to be used for storing the backup
|
||||
type: string
|
||||
tower_backup_pvc_namespace:
|
||||
description: Namespace PVC is in
|
||||
type: string
|
||||
tower_backup_dir:
|
||||
description: Backup directory name, a status found on the awxbackup object (towerBackupComplete)
|
||||
type: string
|
||||
|
||||
@@ -560,6 +560,10 @@ spec:
|
||||
tower_backup_pvc:
|
||||
description: Name of the PVC to be used for storing the backup
|
||||
type: string
|
||||
tower_backup_pvc_namespace:
|
||||
default: 'default'
|
||||
description: Namespace PVC is in
|
||||
type: string
|
||||
tower_backup_size:
|
||||
description: Size of PVC
|
||||
type: string
|
||||
@@ -615,6 +619,10 @@ spec:
|
||||
tower_backup_pvc:
|
||||
description: Name of the PVC to be used for storing the backup
|
||||
type: string
|
||||
tower_backup_pvc_namespace:
|
||||
default: 'default'
|
||||
description: Namespace PVC is in
|
||||
type: string
|
||||
tower_backup_size:
|
||||
description: Size of PVC
|
||||
type: string
|
||||
|
||||
@@ -32,6 +32,9 @@ spec:
|
||||
tower_backup_pvc:
|
||||
description: Name of the PVC to be used for storing the backup
|
||||
type: string
|
||||
tower_backup_pvc_namespace:
|
||||
description: Namespace PVC is in
|
||||
type: string
|
||||
tower_backup_size:
|
||||
description: Size of PVC
|
||||
type: string
|
||||
|
||||
@@ -32,6 +32,9 @@ spec:
|
||||
tower_backup_pvc:
|
||||
description: Name of the PVC to be used for storing the backup
|
||||
type: string
|
||||
tower_backup_pvc_namespace:
|
||||
description: Namespace PVC is in
|
||||
type: string
|
||||
tower_backup_dir:
|
||||
description: Backup directory name, a status found on the awxbackup object (towerBackupComplete)
|
||||
type: string
|
||||
|
||||
@@ -4,6 +4,7 @@ tower_name: ''
|
||||
|
||||
# Specify a pre-created PVC (name) to backup to
|
||||
tower_backup_pvc: ''
|
||||
tower_backup_pvc_namespace: 'default'
|
||||
|
||||
# Size of backup PVC if created dynamically
|
||||
tower_backup_size: ''
|
||||
|
||||
@@ -11,6 +11,6 @@
|
||||
community.kubernetes.k8s:
|
||||
name: "{{ meta.name }}-db-management"
|
||||
kind: Pod
|
||||
namespace: "{{ meta.namespace }}"
|
||||
namespace: "{{ tower_backup_pvc_namespace }}"
|
||||
state: absent
|
||||
force: true
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
community.kubernetes.k8s:
|
||||
name: "{{ meta.name }}-db-management"
|
||||
kind: Pod
|
||||
namespace: "{{ meta.namespace }}"
|
||||
namespace: "{{ tower_backup_pvc_namespace }}"
|
||||
state: absent
|
||||
force: true
|
||||
wait: true
|
||||
@@ -14,7 +14,7 @@
|
||||
k8s_info:
|
||||
name: "{{ tower_backup_pvc }}"
|
||||
kind: PersistentVolumeClaim
|
||||
namespace: "{{ meta.namespace }}"
|
||||
namespace: "{{ tower_backup_pvc_namespace }}"
|
||||
register: provided_pvc
|
||||
when:
|
||||
- tower_backup_pvc != ''
|
||||
@@ -48,16 +48,14 @@
|
||||
- name: Create PVC for backup
|
||||
community.kubernetes.k8s:
|
||||
kind: PersistentVolumeClaim
|
||||
namespace: "{{ meta.namespace }}"
|
||||
template: "backup_pvc.yml.j2"
|
||||
when:
|
||||
- tower_backup_pvc == '' or tower_backup_pvc is not defined
|
||||
|
||||
- name: Create management pod from templated deployment config
|
||||
community.kubernetes.k8s:
|
||||
name: "{{ meta.name }}-db-management"
|
||||
name: "{{ tower_backup_pvc_namespace }}-db-management"
|
||||
kind: Deployment
|
||||
namespace: "{{ meta.namespace }}"
|
||||
state: present
|
||||
template: "management-pod.yml.j2"
|
||||
wait: true
|
||||
|
||||
@@ -3,7 +3,7 @@ apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: {{ meta.name }}-backup-claim
|
||||
namespace: {{ meta.namespace}}
|
||||
namespace: {{ tower_backup_pvc_namespace }}
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
|
||||
@@ -3,7 +3,7 @@ apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: {{ meta.name }}-db-management
|
||||
namespace: {{ meta.namespace }}
|
||||
namespace: {{ tower_backup_pvc_namespace }}
|
||||
spec:
|
||||
containers:
|
||||
- name: {{ meta.name }}-db-management
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
---
|
||||
|
||||
deployment_type: "awx"
|
||||
tower_postgres_image: postgres:12
|
||||
|
||||
@@ -29,8 +29,8 @@ metadata:
|
||||
namespace: my-namespace
|
||||
spec:
|
||||
tower_name: mytower
|
||||
tower_backup_pvc: myoldtower-awxbackup-adfx7ciow
|
||||
tower_backup_dir: tower-openshift-backup-2021-04-01-15:49:17
|
||||
tower_backup_pvc: awxbackup1-backup-claim
|
||||
tower_backup_dir: /backups/tower-openshift-backup-2021-04-02-03:25:08
|
||||
```
|
||||
|
||||
Note that the `tower_name` above is the name of the AWX deployment you intend to create and restore to.
|
||||
|
||||
@@ -4,6 +4,7 @@ tower_name: ''
|
||||
|
||||
# Required: specify a pre-created PVC (name) to restore from
|
||||
tower_backup_pvc: ''
|
||||
tower_backup_pvc_namespace: 'default'
|
||||
|
||||
# Required: backup name, found on the awxbackup object
|
||||
tower_backup_dir: ''
|
||||
|
||||
@@ -4,6 +4,6 @@
|
||||
community.kubernetes.k8s:
|
||||
name: "{{ meta.name }}-db-management"
|
||||
kind: Pod
|
||||
namespace: "{{ meta.namespace }}"
|
||||
namespace: "{{ tower_backup_pvc_namespace }}"
|
||||
state: absent
|
||||
force: true
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
community.kubernetes.k8s:
|
||||
name: "{{ meta.name }}-db-management"
|
||||
kind: Pod
|
||||
namespace: "{{ meta.namespace }}"
|
||||
namespace: "{{ tower_backup_pvc_namespace }}"
|
||||
state: absent
|
||||
force: true
|
||||
wait: true
|
||||
@@ -14,7 +14,7 @@
|
||||
k8s_info:
|
||||
name: "{{ tower_backup_pvc }}"
|
||||
kind: PersistentVolumeClaim
|
||||
namespace: "{{ meta.namespace }}"
|
||||
namespace: "{{ tower_backup_pvc_namespace }}"
|
||||
register: provided_pvc
|
||||
when:
|
||||
- tower_backup_pvc != ''
|
||||
@@ -49,7 +49,6 @@
|
||||
community.kubernetes.k8s:
|
||||
name: "{{ meta.name }}-db-management"
|
||||
kind: Deployment
|
||||
namespace: "{{ meta.namespace }}"
|
||||
state: present
|
||||
template: "management-pod.yml.j2"
|
||||
wait: true
|
||||
|
||||
@@ -1,11 +1,17 @@
|
||||
---
|
||||
|
||||
- name: Create namespace for deployment
|
||||
k8s:
|
||||
name: "{{ meta.namespace }}"
|
||||
kind: Namespace
|
||||
state: present
|
||||
|
||||
# Check to make sure provided pvc exists, error loudly if not. Otherwise, the management pod will just stay in pending state forever.
|
||||
- name: Check provided PVC exists
|
||||
k8s_info:
|
||||
name: "{{ tower_backup_pvc }}"
|
||||
kind: PersistentVolumeClaim
|
||||
namespace: "{{ meta.namespace }}"
|
||||
namespace: "{{ tower_backup_pvc_namespace }}"
|
||||
register: provided_pvc
|
||||
when:
|
||||
- tower_backup_pvc != ''
|
||||
|
||||
@@ -3,7 +3,7 @@ apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: {{ meta.name }}-db-management
|
||||
namespace: {{ meta.namespace }}
|
||||
namespace: {{ tower_backup_pvc_namespace }}
|
||||
spec:
|
||||
containers:
|
||||
- name: {{ meta.name }}-db-management
|
||||
|
||||
Reference in New Issue
Block a user