Refactor PostgreSQL configuration and deployment to use new patterns.

This commit is contained in:
2025-06-07 16:10:11 -07:00
parent ed57228499
commit d5260307dc
6 changed files with 32 additions and 63 deletions

View File

@@ -1,5 +0,0 @@
POSTGRES_DB=postgres
POSTGRES_USER=postgres
POSTGRES_PASSWORD=OhPostgres!
POSTGRES_STORAGE=10Gi
POSTGRES_IMAGE=pgvector/pgvector:pg15

View File

@@ -1,18 +0,0 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: postgres
labels:
- includeSelectors: true
pairs:
app: postgres
managedBy: kustomize
partOf: wild-cloud
configMapGenerator:
- name: config
envs:
- config.env
secretGenerator:
- name: secrets
envs:
- secrets.env

View File

@@ -15,29 +15,36 @@ spec:
spec: spec:
containers: containers:
- name: postgres - name: postgres
image: pgvector/pgvector:pg15 image: "{{ .config.apps.postgres.image }}"
args: [ args:
"-c", "tcp_keepalives_idle=600", [
"-c", "tcp_keepalives_interval=30", "-c",
"-c", "tcp_keepalives_count=3", "tcp_keepalives_idle=600",
"-c", "statement_timeout=300000", "-c",
"-c", "idle_in_transaction_session_timeout=600000" "tcp_keepalives_interval=30",
"-c",
"tcp_keepalives_count=3",
"-c",
"statement_timeout=300000",
"-c",
"idle_in_transaction_session_timeout=600000",
] ]
ports: ports:
- containerPort: 5432 - containerPort: 5432
envFrom:
- secretRef:
name: secrets
- configMapRef:
name: config
env: env:
- name: PGDATA - name: PGDATA
value: /var/lib/postgresql/data/pgdata value: /var/lib/postgresql/data/pgdata
- name: TZ - name: TZ
value: "{{ .config.apps.postgres.timezone }}"
- name: POSTGRES_DB
value: "{{ .config.apps.postgres.database }}"
- name: POSTGRES_USER
value: "{{ .config.apps.postgres.user }}"
- name: POSTGRES_PASSWORD
valueFrom: valueFrom:
configMapKeyRef: secretKeyRef:
name: config name: postgres-secrets
key: TZ key: password
volumeMounts: volumeMounts:
- name: postgres-data - name: postgres-data
mountPath: /var/lib/postgresql/data mountPath: /var/lib/postgresql/data

View File

@@ -8,30 +8,7 @@ labels:
managedBy: kustomize managedBy: kustomize
partOf: wild-cloud partOf: wild-cloud
resources: resources:
- config
- deployment.yaml - deployment.yaml
- namespace.yaml - namespace.yaml
- service.yaml - service.yaml
- pvc.yaml - pvc.yaml
replacements:
- source:
kind: ConfigMap
name: config
fieldPath: data.POSTGRES_STORAGE
targets:
- fieldPaths:
- spec.resources.requests.storage
select:
kind: PersistentVolumeClaim
name: postgresql-pvc
- source:
kind: ConfigMap
name: config
fieldPath: data.POSTGRES_IMAGE
targets:
- fieldPaths:
- spec.template.spec.containers.0.image
select:
kind: Deployment
name: postgres-deployment

View File

@@ -3,3 +3,11 @@ install: true
description: PostgreSQL is a powerful, open source object-relational database system. description: PostgreSQL is a powerful, open source object-relational database system.
version: 1.0.0 version: 1.0.0
icon: https://www.postgresql.org/media/img/about/press/elephant.png icon: https://www.postgresql.org/media/img/about/press/elephant.png
defaultConfig:
database: postgres
user: postgres
storage: 10Gi
image: pgvector/pgvector:pg15
timezone: UTC
requiredSecrets:
- apps.postgres.password

View File

@@ -9,4 +9,4 @@ spec:
storageClassName: longhorn storageClassName: longhorn
resources: resources:
requests: requests:
storage: 2Gi storage: {{ (ds "config").apps.postgres.storage | default "10Gi" }}