From 2f7297f5f557ff126c4761a9405d635f2faf3b43 Mon Sep 17 00:00:00 2001 From: thedoubl3j Date: Tue, 4 Apr 2023 11:20:16 -0400 Subject: [PATCH] revert project persistance so that manual projects have a default path move chmod chgrp for projects_persistence to different init default init container is the awx-ee because and unable to run command chgrp moving it into a different init container note this is not needed for openshift so this is conditional on is_k8s --- .../templates/deployments/web.yaml.j2 | 34 ++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/roles/installer/templates/deployments/web.yaml.j2 b/roles/installer/templates/deployments/web.yaml.j2 index b0ee702a..ee58d90a 100644 --- a/roles/installer/templates/deployments/web.yaml.j2 +++ b/roles/installer/templates/deployments/web.yaml.j2 @@ -62,7 +62,7 @@ spec: priorityClassName: '{{ control_plane_priority_class }}' {% endif %} initContainers: -{% if bundle_ca_crt or init_container_extra_commands %} +{% if bundle_ca_crt or projects_persistence|bool or init_container_extra_commands %} - name: init image: '{{ _init_container_image }}' imagePullPolicy: '{{ image_pull_policy }}' @@ -89,6 +89,25 @@ spec: {% if init_container_extra_volume_mounts -%} {{ init_container_extra_volume_mounts | indent(width=12, first=True) }} {% endif %} +{% 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 %} containers: - image: '{{ _redis_image }}' @@ -172,6 +191,10 @@ spec: mountPath: "/var/run/redis" - name: rsyslog-socket mountPath: "/var/run/awx-rsyslog" +{% if projects_persistence|bool %} + - name: "{{ ansible_operator_meta.name }}-projects" + mountPath: "/var/lib/awx/projects" +{% endif %} - name: "{{ ansible_operator_meta.name }}-receptor-ca" mountPath: "/etc/receptor/tls/ca/receptor-ca.crt" subPath: "tls.crt" @@ -362,11 +385,20 @@ spec: items: - key: receptor_conf path: receptor.conf +{% if projects_persistence|bool %} + - name: "{{ ansible_operator_meta.name }}-projects" + persistentVolumeClaim: +{% if projects_existing_claim %} + claimName: {{ projects_existing_claim }} +{% else %} + claimName: '{{ ansible_operator_meta.name }}-projects-claim' +{% endif %} {% if development_mode | bool %} - name: awx-devel hostPath: path: /awx_devel {% endif %} +{% endif %} {% if extra_volumes -%} {{ extra_volumes | indent(width=8, first=True) }} {% endif %}