Skip to content

Commit

Permalink
Support pgbouncer's client_tls_sslmode using a SelfSigned Certifica…
Browse files Browse the repository at this point in the history
…te (#65)

* first pass at pgbouncer client cert support

* switch to cluster_issuer

* enable validate

* create cert outside of this role
  • Loading branch information
copelco authored Oct 24, 2023
1 parent dce0d47 commit 5742eb1
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
10 changes: 10 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@ caktus.django-k8s

Changes
-------

v1.8.0 on October 24, 2023
~~~~~~~~~~~~~~~~~~~~~

* `k8s_pgbouncer_selfsigned_certificate_name`: add support mounting a
Certificate from the `k8s_na````¡mespace` to pgBouncer's `/etc/pgbouncer/ssl/`
directory to enable TLS mode to use for connections from clients
(`client_tls_sslmode`).


v1.7.0 on September 27th, 2023
~~~~~~~~~~~~~~~~~~~~~

Expand Down
4 changes: 4 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ k8s_pgbouncer_enabled: false
k8s_pgbouncer_repo: "edoburu/pgbouncer"
k8s_pgbouncer_version: "1.18.0"
k8s_pgbouncer_replicas: 1
# Mount a Certificate from the k8s_namespace to pgBouncer's /etc/pgbouncer/ssl/
# directory to enable TLS mode to use for connections from clients
# (client_tls_sslmode)
k8s_pgbouncer_selfsigned_certificate_name: ""
k8s_pgbouncer_service_type: ClusterIP
# If service_type is LoadBalancer, you can optionally assign a fixed IP for your
# load balancer (if suppported by the provider):
Expand Down
12 changes: 12 additions & 0 deletions templates/pgbouncer.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,20 @@ spec:
envFrom:
- secretRef:
name: "pgbouncer-secrets"
{% if k8s_pgbouncer_selfsigned_certificate_name %}
volumeMounts:
- mountPath: "/etc/pgbouncer/ssl"
name: {{ k8s_pgbouncer_selfsigned_certificate_name }}
readOnly: true
{% endif %}
ports:
- containerPort: 5432
{% if k8s_pgbouncer_selfsigned_certificate_name %}
volumes:
- name: {{ k8s_pgbouncer_selfsigned_certificate_name }}
secret:
secretName: {{ k8s_pgbouncer_selfsigned_certificate_name }}
{% endif %}
---
apiVersion: v1
kind: Service
Expand Down

0 comments on commit 5742eb1

Please sign in to comment.