42 lines
1.1 KiB
YAML
42 lines
1.1 KiB
YAML
|
---
|
||
|
apiVersion: v1
|
||
|
kind: Secret
|
||
|
metadata:
|
||
|
name: pgpass-migration
|
||
|
type: Opaque
|
||
|
stringData:
|
||
|
.pgpass: |
|
||
|
default-cluster-primary.postgres.svc:5432:umami:postgres:(g>_lO9v|?(B.4xiYt0}/+m)
|
||
|
app-cluster-pooler-rw.postgres.svc:5432:umami:umami-ciWvqZ:aDvAwEWR7HZz8Ab
|
||
|
---
|
||
|
apiVersion: batch/v1
|
||
|
kind: Job
|
||
|
metadata:
|
||
|
name: migrate
|
||
|
namespace: postgres
|
||
|
spec:
|
||
|
template:
|
||
|
spec:
|
||
|
containers:
|
||
|
- name: postgres
|
||
|
image: postgres:16-alpine
|
||
|
command:
|
||
|
- /bin/ash
|
||
|
- -c
|
||
|
- pg_dump --create --clean --no-owner --no-privileges -h default-cluster-primary.postgres.svc -U postgres "${DB_NAME}" | psql -h app-cluster-pooler-rw.postgres.svc -U "${TARGET_USER}" "${DB_NAME}"
|
||
|
env:
|
||
|
- name: DB_NAME
|
||
|
value: umami
|
||
|
- name: TARGET_USER
|
||
|
value: umami-ciWvqZ
|
||
|
volumeMounts:
|
||
|
- name: pgpass
|
||
|
readOnly: true
|
||
|
mountPath: /root/
|
||
|
restartPolicy: Never
|
||
|
volumes:
|
||
|
- name: pgpass
|
||
|
secret:
|
||
|
defaultMode: 0700
|
||
|
secretName: pgpass-migration
|
||
|
backoffLimit: 4
|