Merge pull request #226 from fust/fix_postgres_resources

Fix postgres resources
This commit is contained in:
Shane McDonald
2021-04-22 13:33:11 -04:00
committed by GitHub
8 changed files with 92 additions and 41 deletions

View File

@@ -227,7 +227,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` |
@@ -239,10 +240,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
```

View File

@@ -244,6 +244,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:
@@ -253,8 +267,6 @@ spec:
type: string
memory:
type: string
storage:
type: string
type: object
limits:
properties:
@@ -262,8 +274,6 @@ spec:
type: string
memory:
type: string
storage:
type: string
type: object
type: object
tower_postgres_storage_class:

View File

@@ -241,6 +241,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:
@@ -250,8 +264,6 @@ spec:
type: string
memory:
type: string
storage:
type: string
type: object
limits:
properties:
@@ -259,8 +271,6 @@ spec:
type: string
memory:
type: string
storage:
type: string
type: object
type: object
tower_postgres_storage_class:

View File

@@ -239,6 +239,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:
@@ -248,8 +262,6 @@ spec:
type: string
memory:
type: string
storage:
type: string
type: object
limits:
properties:
@@ -257,8 +269,6 @@ spec:
type: string
memory:
type: string
storage:
type: string
type: object
type: object
tower_postgres_storage_class:

View File

@@ -161,12 +161,16 @@ 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)
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:

View File

@@ -146,28 +146,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

View File

@@ -150,10 +150,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'

View File

@@ -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.
---