feat(postgres): adding max_conns hydra parameter support for cnpg component #47

Merged
vfebvre merged 1 commits from feat-hydra-pooler into unstable 2024-10-09 10:00:03 +02:00
6 changed files with 35 additions and 36 deletions

View File

@ -7,28 +7,6 @@ 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
patches:
- target:
group: apps

View File

@ -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&max_conns=$(HYDRA_DATABASE_MAX_CONN)"

View File

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

View File

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

View File

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

View File

@ -30,6 +30,7 @@ configMapGenerator:
- URLS_CONSENT=http://hydra-consent-app/consent
- URLS_LOGOUT=http://hydra-logout-app/logout
- HYDRA_SERVE_ALL_ARGS=--dev
- HYDRA_DATABASE_MAX_CONN="10"
- LOG_LEVEL=info
vars: