From 0f4cc52e7123750344728e16a10a716bd169b6f7 Mon Sep 17 00:00:00 2001 From: Yanis Guenane Date: Thu, 17 Jun 2021 11:28:24 +0200 Subject: [PATCH] EE: Allow one to specify resource requirements --- README.md | 16 ++++++++++---- ansible/templates/crd.yml.j2 | 22 +++++++++++++++++++ deploy/awx-operator.yaml | 22 +++++++++++++++++++ deploy/crds/awx_v1beta1_crd.yaml | 22 +++++++++++++++++++ deploy/crds/awx_v1beta1_molecule.yaml | 4 ++++ .../awx-operator.clusterserviceversion.yaml | 11 ++++++++++ .../manifests/awx.ansible.com_awxs_crd.yaml | 22 +++++++++++++++++++ roles/installer/defaults/main.yml | 5 +++++ roles/installer/templates/deployment.yaml.j2 | 1 + 9 files changed, 121 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index e1e1c7cd..a17c2606 100644 --- a/README.md +++ b/README.md @@ -428,10 +428,11 @@ Again, this is the most relaxed SCC that is provided by OpenShift, so be sure to The resource requirements for both, the task and the web containers are configurable - both the lower end (requests) and the upper end (limits). -| Name | Description | Default | -| -------------------------------- | ------------------------------------ | ----------------------------------- | -| web_resource_requirements | Web container resource requirements | requests: {cpu: 1000m, memory: 2Gi} | -| task_resource_requirements | Task container resource requirements | requests: {cpu: 500m, memory: 1Gi} | +| Name | Description | Default | +| -------------------------------- | ------------------------------------------------ | ----------------------------------- | +| web_resource_requirements | Web container resource requirements | requests: {cpu: 1000m, memory: 2Gi} | +| task_resource_requirements | Task container resource requirements | requests: {cpu: 500m, memory: 1Gi} | +| ee_resource_requirements | EE control plane container resource requirements | requests: {cpu: 500m, memory: 1Gi} | Example of customization could be: @@ -453,6 +454,13 @@ spec: limits: cpu: 1000m memory: 2Gi + ee_resource_requirements: + requests: + cpu: 500m + memory: 1Gi + limits: + cpu: 1000m + memory: 2Gi ``` #### Assigning AWX pods to specific nodes diff --git a/ansible/templates/crd.yml.j2 b/ansible/templates/crd.yml.j2 index 3ac77c1e..2a56eb10 100644 --- a/ansible/templates/crd.yml.j2 +++ b/ansible/templates/crd.yml.j2 @@ -210,6 +210,28 @@ spec: type: string type: object type: object + ee_resource_requirements: + description: Resource requirements for the ee 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/deploy/awx-operator.yaml b/deploy/awx-operator.yaml index 93821614..d1360383 100644 --- a/deploy/awx-operator.yaml +++ b/deploy/awx-operator.yaml @@ -212,6 +212,28 @@ spec: type: string type: object type: object + ee_resource_requirements: + description: Resource requirements for the ee 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/deploy/crds/awx_v1beta1_crd.yaml b/deploy/crds/awx_v1beta1_crd.yaml index 3ac77c1e..2a56eb10 100644 --- a/deploy/crds/awx_v1beta1_crd.yaml +++ b/deploy/crds/awx_v1beta1_crd.yaml @@ -210,6 +210,28 @@ spec: type: string type: object type: object + ee_resource_requirements: + description: Resource requirements for the ee 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/deploy/crds/awx_v1beta1_molecule.yaml b/deploy/crds/awx_v1beta1_molecule.yaml index 73baaf1e..133c4814 100644 --- a/deploy/crds/awx_v1beta1_molecule.yaml +++ b/deploy/crds/awx_v1beta1_molecule.yaml @@ -17,3 +17,7 @@ spec: requests: cpu: 500m memory: 128M + ee_resource_requirements: + requests: + cpu: 200m + memory: 64M diff --git a/deploy/olm-catalog/awx-operator/manifests/awx-operator.clusterserviceversion.yaml b/deploy/olm-catalog/awx-operator/manifests/awx-operator.clusterserviceversion.yaml index 1204c776..c73ecd51 100644 --- a/deploy/olm-catalog/awx-operator/manifests/awx-operator.clusterserviceversion.yaml +++ b/deploy/olm-catalog/awx-operator/manifests/awx-operator.clusterserviceversion.yaml @@ -15,6 +15,12 @@ metadata: "deployment_type": "awx", "ingress_type": "ingress", "service_account_annotations": "foo: bar\n", + "ee_resource_requirements": { + "requests": { + "cpu": "200m", + "memory": "64M" + } + }, "task_resource_requirements": { "requests": { "cpu": "500m", @@ -263,6 +269,11 @@ spec: x-descriptors: - urn:alm:descriptor:com.tectonic.ui:advanced - urn:alm:descriptor:com.tectonic.ui:resourceRequirements + - displayName: EE Control Plane container resource requirements + path: ee_resource_requirements + x-descriptors: + - urn:alm:descriptor:com.tectonic.ui:advanced + - urn:alm:descriptor:com.tectonic.ui:resourceRequirements - displayName: PostgreSQL container resource requirements (when using a managed instance) path: postgres_resource_requirements diff --git a/deploy/olm-catalog/awx-operator/manifests/awx.ansible.com_awxs_crd.yaml b/deploy/olm-catalog/awx-operator/manifests/awx.ansible.com_awxs_crd.yaml index b97a0469..d6d2e6a6 100644 --- a/deploy/olm-catalog/awx-operator/manifests/awx.ansible.com_awxs_crd.yaml +++ b/deploy/olm-catalog/awx-operator/manifests/awx.ansible.com_awxs_crd.yaml @@ -62,6 +62,28 @@ spec: type: string type: object type: array + ee_resource_requirements: + description: Resource requirements for the ee control plane container + properties: + limits: + properties: + cpu: + type: string + memory: + type: string + storage: + type: string + type: object + requests: + properties: + cpu: + type: string + memory: + type: string + storage: + type: string + type: object + type: object ee_extra_env: type: string ee_pull_credentials_secret: diff --git a/roles/installer/defaults/main.yml b/roles/installer/defaults/main.yml index ffd21427..5675237b 100644 --- a/roles/installer/defaults/main.yml +++ b/roles/installer/defaults/main.yml @@ -140,6 +140,11 @@ web_resource_requirements: cpu: 1000m memory: 2Gi +ee_resource_requirements: + requests: + cpu: 500m + memory: 1Gi + # 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/deployment.yaml.j2 b/roles/installer/templates/deployment.yaml.j2 index 173bfa2e..293fda1a 100644 --- a/roles/installer/templates/deployment.yaml.j2 +++ b/roles/installer/templates/deployment.yaml.j2 @@ -208,6 +208,7 @@ spec: - image: '{{ control_plane_ee_image }}' name: '{{ meta.name }}-ee' imagePullPolicy: '{{ image_pull_policy }}' + resources: {{ ee_resource_requirements }} args: ['receptor', '--config', '/etc/receptor.conf'] volumeMounts: - name: "{{ meta.name }}-receptor-config"