From a8d2831b1c976c2aa3939c859ea269ff09e4ba35 Mon Sep 17 00:00:00 2001 From: rakesh561 Date: Fri, 23 Jun 2023 14:09:09 -0400 Subject: [PATCH] Update code with capability to set the init container resources instead of using web or task container resources (#1439) --- config/crd/bases/awx.ansible.com_awxs.yaml | 22 +++++++++++++++++++ .../awx-operator.clusterserviceversion.yaml | 5 +++++ roles/installer/defaults/main.yml | 5 +++++ .../templates/deployments/task.yaml.j2 | 4 ++-- .../templates/deployments/web.yaml.j2 | 4 ++-- 5 files changed, 36 insertions(+), 4 deletions(-) diff --git a/config/crd/bases/awx.ansible.com_awxs.yaml b/config/crd/bases/awx.ansible.com_awxs.yaml index 0ed18bb5..05cdfacd 100644 --- a/config/crd/bases/awx.ansible.com_awxs.yaml +++ b/config/crd/bases/awx.ansible.com_awxs.yaml @@ -1489,6 +1489,28 @@ spec: type: string type: object type: object + init_container_resource_requirements: + description: Resource requirements for the init container + properties: + requests: + properties: + cpu: + type: string + memory: + type: string + storage: + type: string + type: object + limits: + properties: + cpu: + type: string + memory: + type: string + storage: + type: string + type: object + type: object service_account_annotations: description: ServiceAccount annotations type: string diff --git a/config/manifests/bases/awx-operator.clusterserviceversion.yaml b/config/manifests/bases/awx-operator.clusterserviceversion.yaml index 3d8bb484..157a6e87 100644 --- a/config/manifests/bases/awx-operator.clusterserviceversion.yaml +++ b/config/manifests/bases/awx-operator.clusterserviceversion.yaml @@ -371,6 +371,11 @@ spec: path: postgres_storage_requirements x-descriptors: - urn:alm:descriptor:com.tectonic.ui:advanced + - description: Init Container resource requirements + path: init_container_resource_requirements + x-descriptors: + - urn:alm:descriptor:com.tectonic.ui:advanced + - urn:alm:descriptor:com.tectonic.ui:resourceRequirements - displayName: Replicas path: replicas x-descriptors: diff --git a/roles/installer/defaults/main.yml b/roles/installer/defaults/main.yml index 0a467df5..da606fdd 100644 --- a/roles/installer/defaults/main.yml +++ b/roles/installer/defaults/main.yml @@ -321,6 +321,11 @@ rsyslog_resource_requirements: cpu: 100m memory: 128Mi +init_container_resource_requirements: + requests: + cpu: 100m + memory: 128Mi + # Add extra environment variables to the AWX task/web containers. Specify as # literal block. E.g.: # task_extra_env: | diff --git a/roles/installer/templates/deployments/task.yaml.j2 b/roles/installer/templates/deployments/task.yaml.j2 index dfdf9d2c..6cb9a0ee 100644 --- a/roles/installer/templates/deployments/task.yaml.j2 +++ b/roles/installer/templates/deployments/task.yaml.j2 @@ -76,7 +76,7 @@ spec: - name: init image: '{{ _init_container_image }}' imagePullPolicy: '{{ image_pull_policy }}' - resources: {{ task_resource_requirements }} + resources: {{ init_container_resource_requirements }} command: - /bin/sh - -c @@ -122,7 +122,7 @@ spec: - name: init-projects image: '{{ _init_projects_container_image }}' imagePullPolicy: '{{ image_pull_policy }}' - resources: {{ task_resource_requirements }} + resources: {{ init_container_resource_requirements }} command: - /bin/sh - -c diff --git a/roles/installer/templates/deployments/web.yaml.j2 b/roles/installer/templates/deployments/web.yaml.j2 index a8206279..642049e2 100644 --- a/roles/installer/templates/deployments/web.yaml.j2 +++ b/roles/installer/templates/deployments/web.yaml.j2 @@ -77,7 +77,7 @@ spec: - name: init image: '{{ _init_container_image }}' imagePullPolicy: '{{ image_pull_policy }}' - resources: {{ web_resource_requirements }} + resources: {{ init_container_resource_requirements }} command: - /bin/sh - -c @@ -106,7 +106,7 @@ spec: - name: init-projects image: '{{ _init_projects_container_image }}' imagePullPolicy: '{{ image_pull_policy }}' - resources: {{ web_resource_requirements }} + resources: {{ init_container_resource_requirements }} command: - /bin/sh - -c