From 43c1f396c30eecd1cdfec1dc51683ccfa832579b Mon Sep 17 00:00:00 2001 From: rakesh561 Date: Wed, 5 Jul 2023 14:39:43 -0400 Subject: [PATCH] Updated image pull policy for backup and restore policy as variable (#1473) --- config/crd/bases/awx.ansible.com_awxbackups.yaml | 11 +++++++++++ config/crd/bases/awx.ansible.com_awxrestores.yaml | 11 +++++++++++ .../bases/awx-operator.clusterserviceversion.yaml | 10 ++++++++++ roles/backup/README.md | 6 ++++++ roles/backup/templates/management-pod.yml.j2 | 2 +- roles/backup/vars/main.yml | 1 + roles/restore/README.md | 6 ++++++ roles/restore/templates/management-pod.yml.j2 | 2 +- roles/restore/vars/main.yml | 1 + 9 files changed, 48 insertions(+), 2 deletions(-) diff --git a/config/crd/bases/awx.ansible.com_awxbackups.yaml b/config/crd/bases/awx.ansible.com_awxbackups.yaml index 0b67bea6..1473a0d8 100644 --- a/config/crd/bases/awx.ansible.com_awxbackups.yaml +++ b/config/crd/bases/awx.ansible.com_awxbackups.yaml @@ -90,6 +90,17 @@ spec: postgres_image_version: description: PostgreSQL container image version to use type: string + image_pull_policy: + description: The image pull policy + type: string + default: IfNotPresent + enum: + - Always + - always + - Never + - never + - IfNotPresent + - ifnotpresent db_management_pod_node_selector: description: nodeSelector for the Postgres pods to backup type: string diff --git a/config/crd/bases/awx.ansible.com_awxrestores.yaml b/config/crd/bases/awx.ansible.com_awxrestores.yaml index 03f12913..d149c3bd 100644 --- a/config/crd/bases/awx.ansible.com_awxrestores.yaml +++ b/config/crd/bases/awx.ansible.com_awxrestores.yaml @@ -94,6 +94,17 @@ spec: postgres_image_version: description: PostgreSQL container image version to use type: string + image_pull_policy: + description: The image pull policy + type: string + default: IfNotPresent + enum: + - Always + - always + - Never + - never + - IfNotPresent + - ifnotpresent db_management_pod_node_selector: description: nodeSelector for the Postgres pods to backup type: string diff --git a/config/manifests/bases/awx-operator.clusterserviceversion.yaml b/config/manifests/bases/awx-operator.clusterserviceversion.yaml index 68f08049..74dc2ae1 100644 --- a/config/manifests/bases/awx-operator.clusterserviceversion.yaml +++ b/config/manifests/bases/awx-operator.clusterserviceversion.yaml @@ -65,6 +65,11 @@ spec: x-descriptors: - urn:alm:descriptor:com.tectonic.ui:advanced - urn:alm:descriptor:com.tectonic.ui:hidden + - displayName: Image Pull Policy + path: image_pull_policy + x-descriptors: + - urn:alm:descriptor:com.tectonic.ui:advanced + - urn:alm:descriptor:com.tectonic.ui:imagePullPolicy - displayName: No Log Configuration path: no_log x-descriptors: @@ -135,6 +140,11 @@ spec: path: postgres_image_version x-descriptors: - urn:alm:descriptor:com.tectonic.ui:hidden + - displayName: Image Pull Policy + path: image_pull_policy + x-descriptors: + - urn:alm:descriptor:com.tectonic.ui:advanced + - urn:alm:descriptor:com.tectonic.ui:imagePullPolicy - displayName: Restore Management Pod Resource Requirements path: restore_resource_requirements x-descriptors: diff --git a/roles/backup/README.md b/roles/backup/README.md index 9d130a2f..580bb351 100644 --- a/roles/backup/README.md +++ b/roles/backup/README.md @@ -82,6 +82,12 @@ It is also possible to tie the lifetime of the backup files to that of the AWXBa clean_backup_on_delete: true ``` +Variable to define Pull policy.You can pass other options like `Always`, `always`, `Never`, `never`, `IfNotPresent`, `ifnotpresent`. + +``` +image_pull_policy: 'IfNotPresent' +``` + Variable to define resources limits and request for backup CR. ``` backup_resource_requirements: diff --git a/roles/backup/templates/management-pod.yml.j2 b/roles/backup/templates/management-pod.yml.j2 index ce2166c6..633d699e 100644 --- a/roles/backup/templates/management-pod.yml.j2 +++ b/roles/backup/templates/management-pod.yml.j2 @@ -10,7 +10,7 @@ spec: containers: - name: {{ ansible_operator_meta.name }}-db-management image: "{{ _postgres_image }}" - imagePullPolicy: Always + imagePullPolicy: "{{ image_pull_policy }}" command: ["sleep", "infinity"] volumeMounts: - name: {{ ansible_operator_meta.name }}-backup diff --git a/roles/backup/vars/main.yml b/roles/backup/vars/main.yml index 4ca8a410..04872867 100644 --- a/roles/backup/vars/main.yml +++ b/roles/backup/vars/main.yml @@ -5,3 +5,4 @@ _postgres_image_version: 13 backup_complete: false database_type: "unmanaged" supported_pg_version: 13 +image_pull_policy: IfNotPresent diff --git a/roles/restore/README.md b/roles/restore/README.md index ace30c9c..aaf94ea4 100644 --- a/roles/restore/README.md +++ b/roles/restore/README.md @@ -101,6 +101,12 @@ backup_pvc: myoldtower-backup-claim backup_dir: /backups/tower-openshift-backup-2021-04-02-03:25:08 ``` +Variable to define Pull policy.You can pass other options like `Always`, `always`, `Never`, `never`, `IfNotPresent`, `ifnotpresent`. + +``` +image_pull_policy: 'IfNotPresent' +``` + Variable to define resources limits and request for restore CR. ``` diff --git a/roles/restore/templates/management-pod.yml.j2 b/roles/restore/templates/management-pod.yml.j2 index 084c5e28..4f30116b 100644 --- a/roles/restore/templates/management-pod.yml.j2 +++ b/roles/restore/templates/management-pod.yml.j2 @@ -10,7 +10,7 @@ spec: containers: - name: {{ ansible_operator_meta.name }}-db-management image: "{{ _postgres_image }}" - imagePullPolicy: Always + imagePullPolicy: "{{ image_pull_policy }}" command: ["sleep", "infinity"] volumeMounts: - name: {{ ansible_operator_meta.name }}-backup diff --git a/roles/restore/vars/main.yml b/roles/restore/vars/main.yml index e425f86e..94ccf9de 100644 --- a/roles/restore/vars/main.yml +++ b/roles/restore/vars/main.yml @@ -13,3 +13,4 @@ admin_password_secret: '{{ deployment_name }}-admin-password' broadcast_websocket_secret: '{{ deployment_name }}-broadcast-websocket' postgres_configuration_secret: '{{ deployment_name }}-postgres-configuration' supported_pg_version: 13 +image_pull_policy: IfNotPresent