29 lines
968 B
YAML
29 lines
968 B
YAML
# One-off Job to create the "miniflux" database on the shared Postgres
|
|
# instance. Re-run (delete + kubectl apply) whenever a new app needs a
|
|
# database, with a copy of this Job using a different DB name.
|
|
apiVersion: batch/v1
|
|
kind: Job
|
|
metadata:
|
|
name: create-db-miniflux
|
|
namespace: postgres
|
|
spec:
|
|
backoffLimit: 3
|
|
template:
|
|
spec:
|
|
restartPolicy: Never
|
|
containers:
|
|
- name: create-db
|
|
image: postgres:18-alpine
|
|
envFrom:
|
|
- secretRef:
|
|
name: postgres-admin
|
|
command:
|
|
- sh
|
|
- -c
|
|
- |
|
|
set -e
|
|
psql "postgres://$POSTGRES_USER:$POSTGRES_PASSWORD@postgres-postgresql:5432/postgres" \
|
|
-tc "SELECT 1 FROM pg_database WHERE datname = 'miniflux'" | grep -q 1 \
|
|
|| psql "postgres://$POSTGRES_USER:$POSTGRES_PASSWORD@postgres-postgresql:5432/postgres" \
|
|
-c "CREATE DATABASE miniflux"
|