From 25b163dfe5b23e10ecb951e86eb1b392f054e14a Mon Sep 17 00:00:00 2001 From: Imed Aouidene Date: Wed, 17 Apr 2024 10:42:47 +0200 Subject: [PATCH 1/2] Adding postgres annotations support --- 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 34e441d13..7375f50eb 100644 --- a/config/crd/bases/awx.ansible.com_awxs.yaml +++ b/config/crd/bases/awx.ansible.com_awxs.yaml @@ -218,6 +218,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 d7c9fa2de..65805819d 100644 --- a/config/manifests/bases/awx-operator.clusterserviceversion.yaml +++ b/config/manifests/bases/awx-operator.clusterserviceversion.yaml @@ -922,6 +922,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 db9d586f6..7bff42c2f 100644 --- a/roles/installer/defaults/main.yml +++ b/roles/installer/defaults/main.yml @@ -211,6 +211,12 @@ task_annotations: '' # my.web-annotation/2: value2 web_annotations: '' +# Add annotations to postgres pod. Specify as literal block. E.g.: +# 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 15ce45f75..31b88d208 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: From 55496014ae1ab3b0ff86673cfc009b7ee60881eb Mon Sep 17 00:00:00 2001 From: Imed Date: Thu, 23 May 2024 09:55:29 +0200 Subject: [PATCH 2/2] Update roles/installer/defaults/main.yml Co-authored-by: Christian Adams --- roles/installer/defaults/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/installer/defaults/main.yml b/roles/installer/defaults/main.yml index 7bff42c2f..69374b0c0 100644 --- a/roles/installer/defaults/main.yml +++ b/roles/installer/defaults/main.yml @@ -212,7 +212,7 @@ task_annotations: '' web_annotations: '' # Add annotations to postgres pod. Specify as literal block. E.g.: -# annotations: | +# postgres_annotations: | # my.annotation/1: value # my.annotation/2: value2 postgres_annotations: ''