From 378a33aaee2dae4a5ee4b56931f4bc5bffe616b6 Mon Sep 17 00:00:00 2001 From: Thom Wijtenburg Date: Tue, 20 Apr 2021 11:14:48 +0200 Subject: [PATCH 1/4] Fix PostgreSQL resource requests --- README.md | 7 ++- ansible/templates/crd.yml.j2 | 18 +++++-- deploy/awx-operator.yaml | 18 +++++-- deploy/crds/awx_v1beta1_crd.yaml | 18 +++++-- .../awx-operator.clusterserviceversion.yaml | 6 +++ .../manifests/awx.ansible.com_awxs_crd.yaml | 54 +++++++++++-------- roles/installer/defaults/main.yml | 4 +- .../templates/tower_postgres.yaml.j2 | 3 +- 8 files changed, 90 insertions(+), 38 deletions(-) diff --git a/README.md b/README.md index f9fd0624..a059bbba 100644 --- a/README.md +++ b/README.md @@ -236,10 +236,15 @@ spec: ... tower_postgres_resource_requirements: requests: + cpu: 500m memory: 2Gi + limits: + cpu: 1 + memory: 4Gi + tower_postgres_storage_requirements: + requests: storage: 8Gi limits: - memory: 4Gi storage: 50Gi tower_postgres_storage_class: fast-ssd ``` diff --git a/ansible/templates/crd.yml.j2 b/ansible/templates/crd.yml.j2 index 17f07c18..34c07baa 100644 --- a/ansible/templates/crd.yml.j2 +++ b/ansible/templates/crd.yml.j2 @@ -235,6 +235,20 @@ spec: tower_postgres_tolerations: description: node tolerations for the Postgres pods type: string + tower_postgres_storage_requirements: + description: Storage requirements for the PostgreSQL container + properties: + requests: + properties: + storage: + type: string + type: object + limits: + properties: + storage: + type: string + type: object + type: object tower_postgres_resource_requirements: description: Resource requirements for the PostgreSQL container properties: @@ -244,8 +258,6 @@ spec: type: string memory: type: string - storage: - type: string type: object limits: properties: @@ -253,8 +265,6 @@ spec: type: string memory: type: string - storage: - type: string type: object type: object tower_postgres_storage_class: diff --git a/deploy/awx-operator.yaml b/deploy/awx-operator.yaml index d3d1c250..d6f423aa 100644 --- a/deploy/awx-operator.yaml +++ b/deploy/awx-operator.yaml @@ -232,6 +232,20 @@ spec: tower_postgres_tolerations: description: node tolerations for the Postgres pods type: string + tower_postgres_storage_requirements: + description: Storage requirements for the PostgreSQL container + properties: + requests: + properties: + storage: + type: string + type: object + limits: + properties: + storage: + type: string + type: object + type: object tower_postgres_resource_requirements: description: Resource requirements for the PostgreSQL container properties: @@ -241,8 +255,6 @@ spec: type: string memory: type: string - storage: - type: string type: object limits: properties: @@ -250,8 +262,6 @@ spec: type: string memory: type: string - storage: - type: string type: object type: object tower_postgres_storage_class: diff --git a/deploy/crds/awx_v1beta1_crd.yaml b/deploy/crds/awx_v1beta1_crd.yaml index f91d7e48..daaaa63d 100644 --- a/deploy/crds/awx_v1beta1_crd.yaml +++ b/deploy/crds/awx_v1beta1_crd.yaml @@ -230,6 +230,20 @@ spec: tower_postgres_tolerations: description: node tolerations for the Postgres pods type: string + tower_postgres_storage_requirements: + description: Storage requirements for the PostgreSQL container + properties: + requests: + properties: + storage: + type: string + type: object + limits: + properties: + storage: + type: string + type: object + type: object tower_postgres_resource_requirements: description: Resource requirements for the PostgreSQL container properties: @@ -239,8 +253,6 @@ spec: type: string memory: type: string - storage: - type: string type: object limits: properties: @@ -248,8 +260,6 @@ spec: type: string memory: type: string - storage: - type: string type: object type: object tower_postgres_storage_class: 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 0fea86e0..a70dad0b 100644 --- a/deploy/olm-catalog/awx-operator/manifests/awx-operator.clusterserviceversion.yaml +++ b/deploy/olm-catalog/awx-operator/manifests/awx-operator.clusterserviceversion.yaml @@ -167,6 +167,12 @@ spec: x-descriptors: - urn:alm:descriptor:com.tectonic.ui:advanced - urn:alm:descriptor:com.tectonic.ui:resourceRequirements + - displayName: PostgreSQL container storage requirements (when using a managed + instance) + path: tower_postgres_storage_requirements + x-descriptors: + - urn:alm:descriptor:com.tectonic.ui:advanced + - urn:alm:descriptor:com.tectonic.ui:resourceRequirements - displayName: Replicas path: tower_replicas x-descriptors: 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 1d684484..91a1ecac 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 @@ -140,28 +140,38 @@ spec: tower_postgres_tolerations: description: node tolerations for the Postgres pods type: string - tower_postgres_resource_requirements: - description: Resource requirements for the PostgreSQL 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 + tower_postgres_storage_requirements: + description: Storage requirements for the PostgreSQL container + properties: + requests: + properties: + storage: + type: string + type: object + limits: + properties: + storage: + type: string + type: object + type: object + tower_postgres_resource_requirements: + description: Resource requirements for the PostgreSQL container + properties: + requests: + properties: + cpu: + type: string + memory: + type: string + type: object + limits: + properties: + cpu: + type: string + memory: + type: string + type: object + type: object tower_postgres_storage_class: description: Storage class to use for the PostgreSQL PVC type: string diff --git a/roles/installer/defaults/main.yml b/roles/installer/defaults/main.yml index d86880cf..a28d357a 100644 --- a/roles/installer/defaults/main.yml +++ b/roles/installer/defaults/main.yml @@ -148,10 +148,10 @@ tower_postgres_selector: '' # value: "AWX" # effect: "NoSchedule" tower_postgres_tolerations: '' - -tower_postgres_resource_requirements: +tower_postgres_storage_requirements: requests: storage: 8Gi +tower_postgres_resource_requirements: [] tower_postgres_storage_class: '' tower_postgres_data_path: '/var/lib/postgresql/data/pgdata' diff --git a/roles/installer/templates/tower_postgres.yaml.j2 b/roles/installer/templates/tower_postgres.yaml.j2 index 18d2ae96..8039619e 100644 --- a/roles/installer/templates/tower_postgres.yaml.j2 +++ b/roles/installer/templates/tower_postgres.yaml.j2 @@ -60,6 +60,7 @@ spec: - name: postgres mountPath: '{{ tower_postgres_data_path | dirname }}' subPath: '{{ tower_postgres_data_path | dirname | basename }}' + resources: {{ tower_postgres_resource_requirements }} {% if tower_postgres_selector %} nodeSelector: {{ tower_postgres_selector | indent(width=8) }} @@ -77,7 +78,7 @@ spec: {% if tower_postgres_storage_class != '' %} storageClassName: '{{ tower_postgres_storage_class }}' {% endif %} - resources: {{ tower_postgres_resource_requirements }} + resources: {{ tower_postgres_storage_requirements }} # Postgres Service. --- From 262b1cca3451a1ef73b1caad409ea0e178934ac7 Mon Sep 17 00:00:00 2001 From: Thom Wijtenburg Date: Tue, 20 Apr 2021 11:33:24 +0200 Subject: [PATCH 2/4] Update variable table for PostgreSQL service --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a059bbba..65ced0a5 100644 --- a/README.md +++ b/README.md @@ -224,7 +224,8 @@ The following variables are customizable for the managed PostgreSQL service | Name | Description | Default | | ------------------------------------ | ------------------------------------------ | --------------------------------- | | tower_postgres_image | Path of the image to pull | postgres:12 | -| tower_postgres_resource_requirements | PostgreSQL container resource requirements | requests: {storage: 8Gi} | +| tower_postgres_resource_requirements | PostgreSQL container resource requirements | Empty object | +| tower_postgres_storage_requirements | PostgreSQL container storage requirements | requests: {storage: 8Gi} | | tower_postgres_storage_class | PostgreSQL PV storage class | Empty string | | tower_postgres_data_path | PostgreSQL data path | `/var/lib/postgresql/data/pgdata` | From 841d1f94f207f076ae96f0d9e98bf97397232b9a Mon Sep 17 00:00:00 2001 From: Thom Wijtenburg Date: Tue, 20 Apr 2021 11:52:56 +0200 Subject: [PATCH 3/4] Change default resource requirement to object --- 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 a28d357a..8eec7922 100644 --- a/roles/installer/defaults/main.yml +++ b/roles/installer/defaults/main.yml @@ -151,7 +151,7 @@ tower_postgres_tolerations: '' tower_postgres_storage_requirements: requests: storage: 8Gi -tower_postgres_resource_requirements: [] +tower_postgres_resource_requirements: {} tower_postgres_storage_class: '' tower_postgres_data_path: '/var/lib/postgresql/data/pgdata' From 4596c30e9d3c08fe08ad4c4299512abb32afae2d Mon Sep 17 00:00:00 2001 From: Thom Wijtenburg Date: Thu, 22 Apr 2021 07:07:51 +0200 Subject: [PATCH 4/4] Make displayName for PostgreSQL parameters single line --- .../manifests/awx-operator.clusterserviceversion.yaml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) 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 a70dad0b..a9ebe7ce 100644 --- a/deploy/olm-catalog/awx-operator/manifests/awx-operator.clusterserviceversion.yaml +++ b/deploy/olm-catalog/awx-operator/manifests/awx-operator.clusterserviceversion.yaml @@ -161,14 +161,12 @@ spec: 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) + - displayName: PostgreSQL container resource requirements (when using a managed instance) path: tower_postgres_resource_requirements x-descriptors: - urn:alm:descriptor:com.tectonic.ui:advanced - urn:alm:descriptor:com.tectonic.ui:resourceRequirements - - displayName: PostgreSQL container storage requirements (when using a managed - instance) + - displayName: PostgreSQL container storage requirements (when using a managed instance) path: tower_postgres_storage_requirements x-descriptors: - urn:alm:descriptor:com.tectonic.ui:advanced