Refactor PostgreSQL configuration and deployment to use new patterns.
This commit is contained in:
@@ -1,5 +0,0 @@
|
||||
POSTGRES_DB=postgres
|
||||
POSTGRES_USER=postgres
|
||||
POSTGRES_PASSWORD=OhPostgres!
|
||||
POSTGRES_STORAGE=10Gi
|
||||
POSTGRES_IMAGE=pgvector/pgvector:pg15
|
@@ -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
|
@@ -15,29 +15,36 @@ spec:
|
||||
spec:
|
||||
containers:
|
||||
- name: postgres
|
||||
image: pgvector/pgvector:pg15
|
||||
args: [
|
||||
"-c", "tcp_keepalives_idle=600",
|
||||
"-c", "tcp_keepalives_interval=30",
|
||||
"-c", "tcp_keepalives_count=3",
|
||||
"-c", "statement_timeout=300000",
|
||||
"-c", "idle_in_transaction_session_timeout=600000"
|
||||
image: "{{ .config.apps.postgres.image }}"
|
||||
args:
|
||||
[
|
||||
"-c",
|
||||
"tcp_keepalives_idle=600",
|
||||
"-c",
|
||||
"tcp_keepalives_interval=30",
|
||||
"-c",
|
||||
"tcp_keepalives_count=3",
|
||||
"-c",
|
||||
"statement_timeout=300000",
|
||||
"-c",
|
||||
"idle_in_transaction_session_timeout=600000",
|
||||
]
|
||||
ports:
|
||||
- containerPort: 5432
|
||||
envFrom:
|
||||
- secretRef:
|
||||
name: secrets
|
||||
- configMapRef:
|
||||
name: config
|
||||
env:
|
||||
- name: PGDATA
|
||||
value: /var/lib/postgresql/data/pgdata
|
||||
- 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:
|
||||
configMapKeyRef:
|
||||
name: config
|
||||
key: TZ
|
||||
secretKeyRef:
|
||||
name: postgres-secrets
|
||||
key: password
|
||||
volumeMounts:
|
||||
- name: postgres-data
|
||||
mountPath: /var/lib/postgresql/data
|
||||
|
@@ -8,30 +8,7 @@ labels:
|
||||
managedBy: kustomize
|
||||
partOf: wild-cloud
|
||||
resources:
|
||||
- config
|
||||
- deployment.yaml
|
||||
- namespace.yaml
|
||||
- service.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
|
||||
|
@@ -3,3 +3,11 @@ install: true
|
||||
description: PostgreSQL is a powerful, open source object-relational database system.
|
||||
version: 1.0.0
|
||||
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
|
||||
|
@@ -9,4 +9,4 @@ spec:
|
||||
storageClassName: longhorn
|
||||
resources:
|
||||
requests:
|
||||
storage: 2Gi
|
||||
storage: {{ (ds "config").apps.postgres.storage | default "10Gi" }}
|
||||
|
Reference in New Issue
Block a user