From c7b370d889e2f37adc5f88d932ff230a613f9356 Mon Sep 17 00:00:00 2001 From: Rub21 Date: Thu, 18 Apr 2024 15:06:37 -0500 Subject: [PATCH] Pass API database configuration through environment variables --- osm-seed/templates/db/db-statefulset.yaml | 24 ++++++++++++++++++++--- osm-seed/values.yaml | 11 ++++++++++- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/osm-seed/templates/db/db-statefulset.yaml b/osm-seed/templates/db/db-statefulset.yaml index a8fc04a0..e2d17b98 100644 --- a/osm-seed/templates/db/db-statefulset.yaml +++ b/osm-seed/templates/db/db-statefulset.yaml @@ -36,15 +36,33 @@ spec: - name: POSTGRES_HOST value: {{ .Release.Name }}-db - name: POSTGRES_DB - value: {{ .Values.db.env.POSTGRES_DB }} + value: {{ .Values.db.env.POSTGRES_DB | quote }} - name: POSTGRES_PASSWORD - value: {{ quote .Values.db.env.POSTGRES_PASSWORD }} + value: {{ quote .Values.db.env.POSTGRES_PASSWORD | quote }} - name: POSTGRES_USER value: {{ default "postgres" .Values.db.env.POSTGRES_USER | quote }} - name: PGUSER value: {{ default "postgres" .Values.db.env.POSTGRES_USER | quote }} - name: PGDATA - value: {{ .Values.db.persistenceDisk.mountPath }} + value: {{ .Values.db.persistenceDisk.mountPath | quote }} + - name: POSTGRES_DB_MAX_CONNECTIONS + value: {{ default 100 .Values.db.env.POSTGRES_DB_MAX_CONNECTIONS | quote }} + - name: POSTGRES_DB_SHARED_BUFFERS + value: {{ default "128MB" .Values.db.env.POSTGRES_DB_SHARED_BUFFERS | quote }} + - name: POSTGRES_DB_TEMP_BUFFERS + value: {{ default "8MB" .Values.db.env.POSTGRES_DB_TEMP_BUFFERS | quote }} + - name: POSTGRES_DB_WORK_MEM + value: {{ default "4MB" .Values.db.env.POSTGRES_DB_WORK_MEM | quote }} + - name: POSTGRES_DB_MAINTENANCE_WORK_MEM + value: {{ default "128MB" .Values.db.env.POSTGRES_DB_MAINTENANCE_WORK_MEM | quote }} + - name: POSTGRES_DB_EFFECTIVE_CACHE_SIZE + value: {{ default "4GB" .Values.db.env.POSTGRES_DB_EFFECTIVE_CACHE_SIZE | quote }} + - name: POSTGRES_DB_MAX_WAL_SIZE + value: {{ default "16MB" .Values.db.env.POSTGRES_DB_MAX_WAL_SIZE | quote }} + - name: POSTGRES_DB_MIN_WAL_SIZE + value: {{ default "5MB" .Values.db.env.POSTGRES_DB_MIN_WAL_SIZE | quote }} + - name: POSTGRES_DB_RANDOM_PAGE_COST + value: {{ default "4.0" .Values.db.env.POSTGRES_DB_RANDOM_PAGE_COST | quote }} - name: POD_IP valueFrom: { fieldRef: { fieldPath: status.podIP } } livenessProbe: diff --git a/osm-seed/values.yaml b/osm-seed/values.yaml index b1500840..a1578a8e 100644 --- a/osm-seed/values.yaml +++ b/osm-seed/values.yaml @@ -73,7 +73,16 @@ db: env: POSTGRES_DB: openstreetmap POSTGRES_USER: postgres - POSTGRES_PASSWORD: "1234" + POSTGRES_PASSWORD: "abc" + POSTGRES_DB_MAX_CONNECTIONS: 100 + POSTGRES_DB_SHARED_BUFFERS: 128MB + POSTGRES_DB_TEMP_BUFFERS: 8MB + POSTGRES_DB_WORK_MEM: 4MB + POSTGRES_DB_MAINTENANCE_WORK_MEM: 128MB + POSTGRES_DB_EFFECTIVE_CACHE_SIZE: 4GB + POSTGRES_DB_MAX_WAL_SIZE: 16MB + POSTGRES_DB_MIN_WAL_SIZE: 5MB + POSTGRES_DB_RANDOM_PAGE_COST: 4.0 persistenceDisk: enabled: false mountPath: /var/lib/postgresql/data