2021-09-14 08:32:10 +02:00
|
|
|
kind: ConfigMap
|
|
|
|
|
apiVersion: v1
|
|
|
|
|
metadata:
|
|
|
|
|
name: shared-postgres
|
|
|
|
|
data:
|
|
|
|
|
DB_HOST: "postgres-postgresql"
|
|
|
|
|
DB_PORT: "5432"
|
|
|
|
|
DB_USER: "postgres"
|
|
|
|
|
---
|
2023-05-29 21:04:04 +02:00
|
|
|
apiVersion: v1
|
|
|
|
|
kind: ConfigMap
|
|
|
|
|
metadata:
|
|
|
|
|
name: postgres-init
|
|
|
|
|
data:
|
|
|
|
|
initdb.sh: |-
|
|
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
|
|
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
|
|
|
|
|
CREATE DATABASE schemas WITH OWNER postgres ENCODING utf8;
|
|
|
|
|
CREATE DATABASE accounting WITH OWNER postgres ENCODING utf8;
|
|
|
|
|
CREATE DATABASE authz WITH OWNER postgres ENCODING utf8;
|
|
|
|
|
CREATE DATABASE company WITH OWNER postgres ENCODING utf8;
|
|
|
|
|
CREATE DATABASE consumer WITH OWNER postgres ENCODING utf8;
|
|
|
|
|
CREATE DATABASE employee WITH OWNER postgres ENCODING utf8;
|
|
|
|
|
CREATE DATABASE invoice WITH OWNER postgres ENCODING utf8;
|
|
|
|
|
CREATE DATABASE notification WITH OWNER postgres ENCODING utf8;
|
|
|
|
|
CREATE DATABASE salary WITH OWNER postgres ENCODING utf8;
|
|
|
|
|
CREATE DATABASE time WITH OWNER postgres ENCODING utf8;
|
|
|
|
|
CREATE DATABASE dancefinder WITH OWNER postgres ENCODING utf8;
|
|
|
|
|
CREATE DATABASE hifi WITH OWNER postgres ENCODING utf8;
|
|
|
|
|
EOSQL
|
|
|
|
|
---
|
2021-09-14 08:32:10 +02:00
|
|
|
apiVersion: apps/v1
|
|
|
|
|
kind: Deployment
|
|
|
|
|
metadata:
|
|
|
|
|
name: postgres
|
|
|
|
|
spec:
|
|
|
|
|
selector:
|
|
|
|
|
matchLabels:
|
|
|
|
|
app: postgres
|
|
|
|
|
replicas: 1
|
|
|
|
|
template:
|
|
|
|
|
metadata:
|
|
|
|
|
labels:
|
|
|
|
|
app: postgres
|
|
|
|
|
spec:
|
|
|
|
|
containers:
|
2021-11-20 08:44:50 +01:00
|
|
|
- name: postgres
|
2023-05-29 21:04:04 +02:00
|
|
|
image: argoyle/postgres-sv_se:15
|
2021-11-20 08:44:50 +01:00
|
|
|
imagePullPolicy: "IfNotPresent"
|
|
|
|
|
resources:
|
|
|
|
|
requests:
|
|
|
|
|
memory: 200Mi
|
|
|
|
|
limits:
|
|
|
|
|
memory: 300Mi
|
|
|
|
|
ports:
|
|
|
|
|
- containerPort: 5432
|
|
|
|
|
env:
|
|
|
|
|
- name: POSTGRES_DB
|
|
|
|
|
value: postgres
|
|
|
|
|
- name: POSTGRES_USER
|
|
|
|
|
value: postgres
|
|
|
|
|
- name: POSTGRES_PASSWORD
|
|
|
|
|
value: postgres
|
|
|
|
|
volumeMounts:
|
2021-09-14 08:32:10 +02:00
|
|
|
- name: data
|
2021-11-20 08:44:50 +01:00
|
|
|
mountPath: /var/lib/postgresql/data
|
2023-05-29 21:04:04 +02:00
|
|
|
- mountPath: /docker-entrypoint-initdb.d/initdb.sh
|
|
|
|
|
name: initdb
|
|
|
|
|
subPath: initdb.sh
|
2021-11-20 08:44:50 +01:00
|
|
|
volumes:
|
|
|
|
|
- name: data
|
|
|
|
|
hostPath:
|
|
|
|
|
path: /data/postgres
|
2023-05-29 21:04:04 +02:00
|
|
|
- name: initdb
|
|
|
|
|
configMap:
|
|
|
|
|
name: postgres-init
|
2021-09-14 08:32:10 +02:00
|
|
|
---
|
|
|
|
|
apiVersion: v1
|
|
|
|
|
kind: Service
|
|
|
|
|
metadata:
|
|
|
|
|
name: postgres
|
|
|
|
|
labels:
|
|
|
|
|
app: postgres
|
|
|
|
|
spec:
|
|
|
|
|
ports:
|
2021-11-20 08:44:50 +01:00
|
|
|
- port: 5432
|
|
|
|
|
nodePort: 5432
|
2021-09-14 08:32:10 +02:00
|
|
|
selector:
|
|
|
|
|
app: postgres
|
|
|
|
|
type: NodePort
|