From 982a7c2cb9ecdc507cc33ac380e3ea461af34c51 Mon Sep 17 00:00:00 2001 From: Alex Date: Thu, 27 Aug 2026 16:31:52 -0400 Subject: [PATCH] fix: mounts the ca bundle correctly and does some DRY work --- roles/eda/templates/ca-mount-fragment.yaml.j2 | 8 ++++++++ roles/eda/templates/eda-api.deployment.yaml.j2 | 16 ++-------------- 2 files changed, 10 insertions(+), 14 deletions(-) create mode 100644 roles/eda/templates/ca-mount-fragment.yaml.j2 diff --git a/roles/eda/templates/ca-mount-fragment.yaml.j2 b/roles/eda/templates/ca-mount-fragment.yaml.j2 new file mode 100644 index 00000000..7f3792d8 --- /dev/null +++ b/roles/eda/templates/ca-mount-fragment.yaml.j2 @@ -0,0 +1,8 @@ +{% if bundle_ca_crt %} +- name: "ca-trust-extracted" + mountPath: "/etc/pki/ca-trust/extracted" +- name: "{{ ansible_operator_meta.name }}-bundle-cacert" + mountPath: /etc/pki/ca-trust/source/anchors/bundle-ca.crt + subPath: bundle-ca.crt + readOnly: true +{% endif %} \ No newline at end of file diff --git a/roles/eda/templates/eda-api.deployment.yaml.j2 b/roles/eda/templates/eda-api.deployment.yaml.j2 index 74f5178a..3543a837 100644 --- a/roles/eda/templates/eda-api.deployment.yaml.j2 +++ b/roles/eda/templates/eda-api.deployment.yaml.j2 @@ -362,14 +362,7 @@ spec: - name: static-files mountPath: {{ static_path }} {% endif %} -{% if bundle_ca_crt %} - - name: "ca-trust-extracted" - mountPath: "/etc/pki/ca-trust/extracted" - - name: "{{ ansible_operator_meta.name }}-bundle-cacert" - mountPath: /etc/pki/ca-trust/source/anchors/bundle-ca.crt - subPath: bundle-ca.crt - readOnly: true -{% endif %} + {{lookup("template", "ca-mount-fragment.yaml.j2") | indent(width=8) | trim }} {% endif %} - name: daphne image: {{ _image }} @@ -422,12 +415,7 @@ spec: {% endif %} {% if bundle_ca_crt %} volumeMounts: - - name: "ca-trust-extracted" - mountPath: "/etc/pki/ca-trust/extracted" - - name: "{{ ansible_operator_meta.name }}-bundle-cacert" - mountPath: /etc/pki/ca-trust/source/anchors/bundle-ca.crt - subPath: bundle-ca.crt - readOnly: true + {{lookup("template", "ca-mount-fragment.yaml.j2") | indent(width=8) | trim }} {% endif %} - name: nginx image: {{ _image_web }}