From c708cef4dcb770fdd98b505a0e3901ba89cf54bf Mon Sep 17 00:00:00 2001 From: Florian LAUNAY Date: Thu, 6 Oct 2022 17:58:12 +0200 Subject: [PATCH] use dedicated image for projects persistence PVC init tasks --- roles/installer/defaults/main.yml | 2 ++ .../templates/deployments/deployment.yaml.j2 | 25 +++++++++++++------ 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/roles/installer/defaults/main.yml b/roles/installer/defaults/main.yml index 767c5892d..fd9792239 100644 --- a/roles/installer/defaults/main.yml +++ b/roles/installer/defaults/main.yml @@ -164,6 +164,8 @@ _control_plane_ee_image: quay.io/ansible/awx-ee:latest _init_container_image: "{{ _control_plane_ee_image.split(':')[0] }}" _init_container_image_version: "{{ _control_plane_ee_image.split(':')[1] }}" +_init_projects_container_image: quay.io/centos/centos:stream9 + create_preload_data: true replicas: "1" diff --git a/roles/installer/templates/deployments/deployment.yaml.j2 b/roles/installer/templates/deployments/deployment.yaml.j2 index 395cc3185..2b67dcdad 100644 --- a/roles/installer/templates/deployments/deployment.yaml.j2 +++ b/roles/installer/templates/deployments/deployment.yaml.j2 @@ -54,10 +54,6 @@ spec: mkdir -p /etc/pki/ca-trust/extracted/{java,pem,openssl,edk2} update-ca-trust {% endif %} -{% if projects_persistence|bool and is_k8s|bool %} - chmod 775 /var/lib/awx/projects - chgrp 1000 /var/lib/awx/projects -{% endif %} {% if init_container_extra_commands %} {{ init_container_extra_commands | indent(width=14) }} {% endif %} @@ -85,12 +81,27 @@ spec: subPath: bundle-ca.crt readOnly: true {% endif %} +{% if init_container_extra_volume_mounts -%} + {{ init_container_extra_volume_mounts | indent(width=12, first=True) }} +{% endif %} {% if projects_persistence|bool and is_k8s|bool %} + - name: init-projects + image: '{{ _init_projects_container_image }}' + imagePullPolicy: '{{ image_pull_policy }}' + command: + - /bin/sh + - -c + - | + chmod 775 /var/lib/awx/projects + chgrp 1000 /var/lib/awx/projects + env: + - name: MY_POD_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name + volumeMounts: - name: "{{ ansible_operator_meta.name }}-projects" mountPath: "/var/lib/awx/projects" -{% endif %} -{% if init_container_extra_volume_mounts -%} - {{ init_container_extra_volume_mounts | indent(width=12, first=True) }} {% endif %} containers: - image: '{{ _redis_image }}'