feat(postgres): adding pgbouncer support for cnpg component
Mandatory for large scale deployements
This commit is contained in:
parent
a5cecb385c
commit
8eddcc8fc7
|
@ -6,28 +6,7 @@ configurations:
|
|||
|
||||
resources:
|
||||
- ./resources/hydra-cnpg-cluster.yaml
|
||||
|
||||
secretGenerator:
|
||||
- name: hydra-postgres-admin
|
||||
type: Secret
|
||||
literals:
|
||||
- username=postgres
|
||||
- password=NotSoSecret
|
||||
- name: hydra-postgres-user
|
||||
type: Secret
|
||||
literals:
|
||||
- username=hydra
|
||||
- password=NotSoSecret
|
||||
|
||||
|
||||
vars:
|
||||
- name: HYDRA_DATABASE_SERVICE_NAME
|
||||
objref:
|
||||
name: hydra-postgres
|
||||
kind: Cluster
|
||||
apiVersion: postgresql.cnpg.io/v1
|
||||
fieldref:
|
||||
fieldpath: metadata.name
|
||||
- ./resources/hydra-postgres-pooler-rw.yaml
|
||||
|
||||
patches:
|
||||
- target:
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
name: HYDRA_DATABASE_USER
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: hydra-postgres-user
|
||||
name: hydra-postgres-app
|
||||
key: username
|
||||
- op: add
|
||||
path: "/spec/template/spec/containers/0/env/-"
|
||||
|
@ -12,10 +12,15 @@
|
|||
name: HYDRA_DATABASE_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: hydra-postgres-user
|
||||
name: hydra-postgres-app
|
||||
key: password
|
||||
- op: add
|
||||
path: "/spec/template/spec/containers/0/env/-"
|
||||
value:
|
||||
name: HYDRA_DATABASE_SERVICE_NAME
|
||||
value: hydra-postgres-pooler-rw
|
||||
- op: add
|
||||
path: "/spec/template/spec/containers/0/env/-"
|
||||
value:
|
||||
name: DSN
|
||||
value: "postgres://$(HYDRA_DATABASE_USER):$(HYDRA_DATABASE_PASSWORD)@$(HYDRA_DATABASE_SERVICE_NAME)-rw:5432/hydra?sslmode=disable"
|
||||
value: "postgres://$(HYDRA_DATABASE_USER):$(HYDRA_DATABASE_PASSWORD)@$(HYDRA_DATABASE_SERVICE_NAME):5432/hydra?sslmode=disable"
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
name: HYDRA_DATABASE_USER
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: hydra-postgres-user
|
||||
name: hydra-postgres-app
|
||||
key: username
|
||||
- op: add
|
||||
path: "/spec/jobTemplate/spec/template/spec/containers/0/env/-"
|
||||
|
@ -12,10 +12,18 @@
|
|||
name: HYDRA_DATABASE_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: hydra-postgres-user
|
||||
name: hydra-postgres-app
|
||||
key: password
|
||||
- op: add
|
||||
path: "/spec/jobTemplate/spec/template/spec/containers/0/env/-"
|
||||
value:
|
||||
name: HYDRA_DATABASE_SERVICE_NAME
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: hydra-postgres-app
|
||||
key: host
|
||||
- op: add
|
||||
path: "/spec/jobTemplate/spec/template/spec/containers/0/env/-"
|
||||
value:
|
||||
name: DSN
|
||||
value: "postgres://$(HYDRA_DATABASE_USER):$(HYDRA_DATABASE_PASSWORD)@$(HYDRA_DATABASE_SERVICE_NAME)-rw:5432/hydra?sslmode=disable"
|
||||
value: "postgres://$(HYDRA_DATABASE_USER):$(HYDRA_DATABASE_PASSWORD)@$(HYDRA_DATABASE_SERVICE_NAME):5432/hydra?sslmode=disable"
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
name: HYDRA_DATABASE_USER
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: hydra-postgres-user
|
||||
name: hydra-postgres-app
|
||||
key: username
|
||||
- op: add
|
||||
path: "/spec/template/spec/containers/0/env/-"
|
||||
|
@ -12,10 +12,18 @@
|
|||
name: HYDRA_DATABASE_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: hydra-postgres-user
|
||||
name: hydra-postgres-app
|
||||
key: password
|
||||
- op: add
|
||||
path: "/spec/template/spec/containers/0/env/-"
|
||||
value:
|
||||
name: HYDRA_DATABASE_SERVICE_NAME
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: hydra-postgres-app
|
||||
key: host
|
||||
- op: add
|
||||
path: "/spec/template/spec/containers/0/env/-"
|
||||
value:
|
||||
name: DSN
|
||||
value: "postgres://$(HYDRA_DATABASE_USER):$(HYDRA_DATABASE_PASSWORD)@$(HYDRA_DATABASE_SERVICE_NAME)-rw:5432/hydra?sslmode=disable"
|
||||
value: "postgres://$(HYDRA_DATABASE_USER):$(HYDRA_DATABASE_PASSWORD)@$(HYDRA_DATABASE_SERVICE_NAME):5432/hydra?sslmode=disable"
|
||||
|
|
|
@ -5,13 +5,9 @@ metadata:
|
|||
spec:
|
||||
instances: 3
|
||||
primaryUpdateStrategy: unsupervised
|
||||
superuserSecret:
|
||||
name: hydra-postgres-admin
|
||||
bootstrap:
|
||||
initdb:
|
||||
database: hydra
|
||||
owner: hydra
|
||||
secret:
|
||||
name: hydra-postgres-user
|
||||
storage:
|
||||
size: 2Gi
|
||||
size: 2Gi
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
apiVersion: postgresql.cnpg.io/v1
|
||||
kind: Pooler
|
||||
metadata:
|
||||
name: hydra-postgres-pooler-rw
|
||||
spec:
|
||||
cluster:
|
||||
name: hydra-postgres
|
||||
instances: 3
|
||||
type: rw
|
||||
pgbouncer:
|
||||
poolMode: session
|
||||
parameters:
|
||||
max_client_conn: "1000"
|
||||
default_pool_size: "50"
|
Loading…
Reference in New Issue