From e54215863c85412deeb38eefd0646da1b043d152 Mon Sep 17 00:00:00 2001 From: Lila Date: Tue, 11 Apr 2023 14:51:01 -0400 Subject: [PATCH] Add ability to override annotations independently - add web_annotations to override annotations for web pods - add task_annotations to override annotations for task pods --- config/crd/bases/awx.ansible.com_awxs.yaml | 8 +++++++- .../bases/awx-operator.clusterserviceversion.yaml | 10 ++++++++++ roles/installer/defaults/main.yml | 12 ++++++++++++ roles/installer/templates/deployments/task.yaml.j2 | 4 +++- roles/installer/templates/deployments/web.yaml.j2 | 4 +++- 5 files changed, 35 insertions(+), 3 deletions(-) diff --git a/config/crd/bases/awx.ansible.com_awxs.yaml b/config/crd/bases/awx.ansible.com_awxs.yaml index 4f4bda76..53bf64ff 100644 --- a/config/crd/bases/awx.ansible.com_awxs.yaml +++ b/config/crd/bases/awx.ansible.com_awxs.yaml @@ -186,7 +186,13 @@ spec: description: Additional labels to apply to the service type: string annotations: - description: annotations for the pods + description: Common annotations for both Web and Task deployments. + type: string + task_annotations: + description: Task deployment annotations. This will override the general annotations parameter for the Task deployment. + type: string + web_annotations: + description: Web deployment annotations. This will override the general annotations parameter for the Web deployment. type: string tolerations: description: node tolerations for the pods diff --git a/config/manifests/bases/awx-operator.clusterserviceversion.yaml b/config/manifests/bases/awx-operator.clusterserviceversion.yaml index 2afad2ca..7519e04b 100644 --- a/config/manifests/bases/awx-operator.clusterserviceversion.yaml +++ b/config/manifests/bases/awx-operator.clusterserviceversion.yaml @@ -690,6 +690,16 @@ spec: x-descriptors: - urn:alm:descriptor:com.tectonic.ui:advanced - urn:alm:descriptor:com.tectonic.ui:hidden + - displayName: Task Annotations + path: task_annotations + x-descriptors: + - urn:alm:descriptor:com.tectonic.ui:advanced + - urn:alm:descriptor:com.tectonic.ui:hidden + - displayName: Web Annotations + path: web_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 8c97fcff..ad3e98b3 100644 --- a/roles/installer/defaults/main.yml +++ b/roles/installer/defaults/main.yml @@ -188,6 +188,18 @@ web_affinity: {} # my.annotation/2: value2 annotations: '' +# Override annotations to awx task pods. Specify as literal block. E.g.: +# task_annotations: | +# my.task-annotation/1: value +# my.task-annotation/2: value2 +task_annotations: '' + +# Override annotations to awx web pods. Specify as literal block. E.g.: +# web_annotations: | +# my.web-annotation/1: value +# my.web-annotation/2: value2 +web_annotations: '' + admin_user: admin admin_email: test@example.com diff --git a/roles/installer/templates/deployments/task.yaml.j2 b/roles/installer/templates/deployments/task.yaml.j2 index 09ead4e1..ae7dcc37 100644 --- a/roles/installer/templates/deployments/task.yaml.j2 +++ b/roles/installer/templates/deployments/task.yaml.j2 @@ -43,7 +43,9 @@ spec: ] %} checksum-secret-{{ secret }}: "{{ lookup('ansible.builtin.vars', secret, default='')["resources"][0]["data"] | default('') | sha1 }}" {% endfor %} -{% if annotations %} +{% if task_annotations %} + {{ task_annotations | indent(width=8) }} +{% elif annotations %} {{ annotations | indent(width=8) }} {% endif %} spec: diff --git a/roles/installer/templates/deployments/web.yaml.j2 b/roles/installer/templates/deployments/web.yaml.j2 index 3dfa4713..ba814c43 100644 --- a/roles/installer/templates/deployments/web.yaml.j2 +++ b/roles/installer/templates/deployments/web.yaml.j2 @@ -44,7 +44,9 @@ spec: ] %} checksum-secret-{{ secret }}: "{{ lookup('ansible.builtin.vars', secret, default='')["resources"][0]["data"] | default('') | md5 }}" {% endfor %} -{% if annotations %} +{% if web_annotations %} + {{ web_annotations | indent(width=8) }} +{% elif annotations %} {{ annotations | indent(width=8) }} {% endif %} spec: