Skip to content

Commit

Permalink
Add ability to configure postgres keepalives settings
Browse files Browse the repository at this point in the history
Co-Authored-By: Gabriel Muniz <gmuniz@redhat.com>
Co-Authored-By: Rick Elrod <rick@elrod.me>
  • Loading branch information
3 people committed May 9, 2023
1 parent bc04443 commit a649e78
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 0 deletions.
19 changes: 19 additions & 0 deletions config/crd/bases/awx.ansible.com_awxs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1596,6 +1596,25 @@ spec:
type: array
items:
type: string
postgres_keepalives:
description: Controls whether client-side TCP keepalives are used for Postgres connections.
default: true
type: boolean
postgres_keepalives_count:
description: Controls the number of TCP keepalives that can be lost before the client's connection to the server is considered dead.
type: integer
default: 5
format: int32
postgres_keepalives_idle:
description: Controls the number of seconds of inactivity after which TCP should send a keepalive message to the server.
type: integer
default: 5
format: int32
postgres_keepalives_interval:
description: Controls the number of seconds after which a TCP keepalive message that is not acknowledged by the server should be retransmitted.
type: integer
default: 5
format: int32
ca_trust_bundle:
description: Path where the trusted CA bundle is available
type: string
Expand Down
20 changes: 20 additions & 0 deletions config/manifests/bases/awx-operator.clusterserviceversion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,26 @@ spec:
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:advanced
- urn:alm:descriptor:com.tectonic.ui:hidden
- displayName: Enable Postgres Keepalives
path: postgres_keepalives
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:advanced
- urn:alm:descriptor:com.tectonic.ui:hidden
- displayName: Postgres Keepalives Count
path: postgres_keepalives_count
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:advanced
- urn:alm:descriptor:com.tectonic.ui:hidden
- displayName: Postgres Keepalives Idle
path: postgres_keepalives_idle
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:advanced
- urn:alm:descriptor:com.tectonic.ui:hidden
- displayName: Postgres Keepalives Interval
path: postgres_keepalives_interval
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:advanced
- urn:alm:descriptor:com.tectonic.ui:hidden
- displayName: Certificate Authorirty Trust Bundle
path: ca_trust_bundle
x-descriptors:
Expand Down
6 changes: 6 additions & 0 deletions roles/installer/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,12 @@ projects_existing_claim: ''
# Define postgres configuration arguments to use
postgres_extra_args: ''

# Configure postgres connection keepalive
postgres_keepalives: true
postgres_keepalives_idle: 5
postgres_keepalives_interval: 5
postgres_keepalives_count: 5

# Define the storage_class, size and access_mode
# when not using an existing claim
projects_storage_size: 8Gi
Expand Down
6 changes: 6 additions & 0 deletions roles/installer/templates/settings/credentials.py.j2
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ DATABASES = {
'OPTIONS': { 'sslmode': '{{ awx_postgres_sslmode }}',
{% if awx_postgres_sslmode in ['verify-ca', 'verify-full'] %}
'sslrootcert': '{{ ca_trust_bundle }}',
{% endif %}
{% if postgres_keepalives %}
'keepalives': 1,
'keepalives_idle': '{{ postgres_keepalives_idle }}',
'keepalives_interval': '{{ postgres_keepalives_interval }}',
'keepalives_count': '{{ postgres_keepalives_count }}',
{% endif %}
},
}
Expand Down

0 comments on commit a649e78

Please sign in to comment.