From 8224b0b3543ba0e2d5e7f0dfd81ca5e2443725c7 Mon Sep 17 00:00:00 2001 From: Imed Date: Wed, 24 Jul 2024 20:45:06 +0200 Subject: [PATCH] Adding postgres annotations support (#1829) * Adding postgres annotations support Authored-by: Imed Aouidene --- config/crd/bases/awx.ansible.com_awxs.yaml | 3 +++ .../manifests/bases/awx-operator.clusterserviceversion.yaml | 5 +++++ roles/installer/defaults/main.yml | 6 ++++++ roles/installer/templates/statefulsets/postgres.yaml.j2 | 3 +++ 4 files changed, 17 insertions(+) diff --git a/config/crd/bases/awx.ansible.com_awxs.yaml b/config/crd/bases/awx.ansible.com_awxs.yaml index b69d164e..e7f4019b 100644 --- a/config/crd/bases/awx.ansible.com_awxs.yaml +++ b/config/crd/bases/awx.ansible.com_awxs.yaml @@ -221,6 +221,9 @@ spec: web_annotations: description: Web deployment annotations. This will override the general annotations parameter for the Web deployment. type: string + postgres_annotations: + description: Annotations to add to the Postgres deployment. + type: string tolerations: description: node tolerations for the pods type: string diff --git a/config/manifests/bases/awx-operator.clusterserviceversion.yaml b/config/manifests/bases/awx-operator.clusterserviceversion.yaml index add24901..1859423b 100644 --- a/config/manifests/bases/awx-operator.clusterserviceversion.yaml +++ b/config/manifests/bases/awx-operator.clusterserviceversion.yaml @@ -951,6 +951,11 @@ spec: x-descriptors: - urn:alm:descriptor:com.tectonic.ui:advanced - urn:alm:descriptor:com.tectonic.ui:hidden + - displayName: Postgres Annotations + path: postgres_annotations + x-descriptors: + - urn:alm:descriptor:com.tectonic.ui:advanced + - urn:alm:descriptor:com.tectonic.ui:hidden - displayName: Tolerations path: tolerations x-descriptors: diff --git a/roles/installer/defaults/main.yml b/roles/installer/defaults/main.yml index 277da25c..eecdb368 100644 --- a/roles/installer/defaults/main.yml +++ b/roles/installer/defaults/main.yml @@ -212,6 +212,12 @@ task_annotations: '' # my.web-annotation/2: value2 web_annotations: '' +# Add annotations to postgres pod. Specify as literal block. E.g.: +# postgres_annotations: | +# my.annotation/1: value +# my.annotation/2: value2 +postgres_annotations: '' + admin_user: admin admin_email: test@example.com diff --git a/roles/installer/templates/statefulsets/postgres.yaml.j2 b/roles/installer/templates/statefulsets/postgres.yaml.j2 index 15ce45f7..31b88d20 100644 --- a/roles/installer/templates/statefulsets/postgres.yaml.j2 +++ b/roles/installer/templates/statefulsets/postgres.yaml.j2 @@ -34,6 +34,9 @@ spec: app.kubernetes.io/component: 'database' app.kubernetes.io/part-of: '{{ ansible_operator_meta.name }}' app.kubernetes.io/managed-by: '{{ deployment_type }}-operator' +{% if postgres_annotations %} + {{ postgres_annotations | indent(width=8) }} +{% endif %} spec: {% if image_pull_secret is defined %} imagePullSecrets: