From 3afe1df55546179ece20bb39c55c8dc7a60d5a0f Mon Sep 17 00:00:00 2001 From: Uros Bajzelj Date: Fri, 30 Jun 2023 04:38:24 +0200 Subject: [PATCH] Enable configuration of rsyslog environmental variables, volume mounts, and entrypoints (#1467) --- README.md | 15 ++++++++----- config/crd/bases/awx.ansible.com_awxs.yaml | 13 +++++++++++ .../awx-operator.clusterserviceversion.yaml | 22 +++++++++++++++++++ roles/installer/defaults/main.yml | 2 ++ .../templates/deployments/task.yaml.j2 | 6 +++++ .../templates/deployments/web.yaml.j2 | 6 +++++ 6 files changed, 59 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 43ab8da4..da19acf7 100644 --- a/README.md +++ b/README.md @@ -998,6 +998,7 @@ In a scenario where custom volumes and volume mounts are required to either over | extra_volumes | Specify extra volumes to add to the application pod | '' | | web_extra_volume_mounts | Specify volume mounts to be added to Web container | '' | | task_extra_volume_mounts | Specify volume mounts to be added to Task container | '' | +| rsyslog_extra_volume_mounts | Specify volume mounts to be added to Rsyslog container | '' | | ee_extra_volume_mounts | Specify volume mounts to be added to Execution container | '' | | init_container_extra_volume_mounts | Specify volume mounts to be added to Init container | '' | | init_container_extra_commands | Specify additional commands for Init container | '' | @@ -1159,11 +1160,12 @@ type: kubernetes.io/dockerconfigjson If you need to export custom environment variables to your containers. -| Name | Description | Default | -| -------------- | --------------------------------------------------- | ------- | -| task_extra_env | Environment variables to be added to Task container | '' | -| web_extra_env | Environment variables to be added to Web container | '' | -| ee_extra_env | Environment variables to be added to EE container | '' | +| Name | Description | Default | +| ----------------- | ------------------------------------------------------ | ------- | +| task_extra_env | Environment variables to be added to Task container | '' | +| web_extra_env | Environment variables to be added to Web container | '' | +| rsyslog_extra_env | Environment variables to be added to Rsyslog container | '' | +| ee_extra_env | Environment variables to be added to EE container | '' | > :warning: The `ee_extra_env` will only take effect to the globally available Execution Environments. For custom `ee`, please [customize the Pod spec](https://docs.ansible.com/ansible-tower/latest/html/administration/external_execution_envs.html#customize-the-pod-spec). @@ -1177,6 +1179,9 @@ Example configuration of environment variables web_extra_env: | - name: MYCUSTOMVAR value: foo + rsyslog_extra_env: | + - name: MYCUSTOMVAR + value: foo ee_extra_env: | - name: MYCUSTOMVAR value: foo diff --git a/config/crd/bases/awx.ansible.com_awxs.yaml b/config/crd/bases/awx.ansible.com_awxs.yaml index 05cdfacd..f97cbd49 100644 --- a/config/crd/bases/awx.ansible.com_awxs.yaml +++ b/config/crd/bases/awx.ansible.com_awxs.yaml @@ -1551,10 +1551,20 @@ spec: type: array items: type: string + rsyslog_args: + type: array + items: + type: string + rsyslog_command: + type: array + items: + type: string task_extra_env: type: string web_extra_env: type: string + rsyslog_extra_env: + type: string ee_extra_env: type: string ee_extra_volume_mounts: @@ -1566,6 +1576,9 @@ spec: web_extra_volume_mounts: description: Specify volume mounts to be added to the Web container type: string + rsyslog_extra_volume_mounts: + description: Specify volume mounts to be added to the Rsyslog container + type: string redis_image: description: Registry path to the redis container to use type: string diff --git a/config/manifests/bases/awx-operator.clusterserviceversion.yaml b/config/manifests/bases/awx-operator.clusterserviceversion.yaml index 157a6e87..68f08049 100644 --- a/config/manifests/bases/awx-operator.clusterserviceversion.yaml +++ b/config/manifests/bases/awx-operator.clusterserviceversion.yaml @@ -648,6 +648,28 @@ spec: x-descriptors: - urn:alm:descriptor:com.tectonic.ui:advanced - urn:alm:descriptor:com.tectonic.ui:hidden + - displayName: Rsyslog Args + path: rsyslog_args + x-descriptors: + - urn:alm:descriptor:com.tectonic.ui:advanced + - urn:alm:descriptor:com.tectonic.ui:hidden + - displayName: Rsyslog Command + path: rsyslog_command + x-descriptors: + - urn:alm:descriptor:com.tectonic.ui:advanced + - urn:alm:descriptor:com.tectonic.ui:hidden + - description: Environment variables to be added to Rsyslog container + displayName: Rsyslog Extra Env + path: rsyslog_extra_env + x-descriptors: + - urn:alm:descriptor:com.tectonic.ui:advanced + - urn:alm:descriptor:com.tectonic.ui:hidden + - description: Specify volume mounts to be added to Rsyslog container + displayName: Rsyslog Extra Volume Mounts + path: rsyslog_extra_volume_mounts + x-descriptors: + - urn:alm:descriptor:com.tectonic.ui:advanced + - urn:alm:descriptor:com.tectonic.ui:hidden - description: Specify extra volumes to add to the application pod displayName: Extra Volumes path: extra_volumes diff --git a/roles/installer/defaults/main.yml b/roles/installer/defaults/main.yml index da606fdd..01a255bd 100644 --- a/roles/installer/defaults/main.yml +++ b/roles/installer/defaults/main.yml @@ -335,6 +335,7 @@ init_container_resource_requirements: # value: bing task_extra_env: '' web_extra_env: '' +rsyslog_extra_env: '' ee_extra_env: '' # Mount extra volumes on the AWX task/web containers. Specify as literal block. @@ -344,6 +345,7 @@ ee_extra_env: '' # mountPath: /some/path task_extra_volume_mounts: '' web_extra_volume_mounts: '' +rsyslog_extra_volume_mounts: '' ee_extra_volume_mounts: '' # Add a nodeSelector for the Postgres pods. diff --git a/roles/installer/templates/deployments/task.yaml.j2 b/roles/installer/templates/deployments/task.yaml.j2 index 6cb9a0ee..fcd1ac48 100644 --- a/roles/installer/templates/deployments/task.yaml.j2 +++ b/roles/installer/templates/deployments/task.yaml.j2 @@ -382,6 +382,9 @@ spec: - name: awx-devel mountPath: "/awx_devel" {% endif %} +{% if rsyslog_extra_volume_mounts -%} + {{ rsyslog_extra_volume_mounts | indent(width=12, first=True) }} +{% endif %} {% if termination_grace_period_seconds is defined %} - name: pre-stop-data mountPath: /var/lib/pre-stop @@ -401,6 +404,9 @@ spec: - name: AWX_KUBE_DEVEL value: "1" {% endif %} +{% if rsyslog_extra_env -%} + {{ rsyslog_extra_env | indent(width=12, first=True) }} +{% endif %} {% if task_node_selector %} nodeSelector: {{ task_node_selector | indent(width=8) }} diff --git a/roles/installer/templates/deployments/web.yaml.j2 b/roles/installer/templates/deployments/web.yaml.j2 index 642049e2..26ce74cc 100644 --- a/roles/installer/templates/deployments/web.yaml.j2 +++ b/roles/installer/templates/deployments/web.yaml.j2 @@ -287,6 +287,9 @@ spec: {% if development_mode | bool %} - name: awx-devel mountPath: "/awx_devel" +{% endif %} +{% if rsyslog_extra_volume_mounts -%} + {{ rsyslog_extra_volume_mounts | indent(width=12, first=True) }} {% endif %} env: - name: SUPERVISOR_CONFIG_PATH @@ -294,6 +297,9 @@ spec: {% if development_mode | bool %} - name: AWX_KUBE_DEVEL value: "1" +{% endif %} +{% if rsyslog_extra_env -%} + {{ rsyslog_extra_env | indent(width=12, first=True) }} {% endif %} resources: {{ rsyslog_resource_requirements }} {% if web_node_selector %}