Files
archived-openlan-cgw/utils/helm/basic/templates/postgresql-cm0-configmap.yaml

20 lines
664 B
YAML

apiVersion: v1
data:
init-db.sh: |
#!/bin/bash
set -e
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" <<-EOSQL
CREATE USER $CGW_DB_USER WITH ENCRYPTED PASSWORD '$CGW_DB_PASSWORD';
CREATE DATABASE $CGW_DB OWNER $CGW_DB_USER;
CREATE TABLE infrastructure_groups ( id INT PRIMARY KEY, reserved_size INT, actual_size INT);
CREATE TABLE infras ( mac MACADDR PRIMARY KEY, infra_group_id INT, FOREIGN KEY(infra_group_id) REFERENCES infrastructure_groups(id) ON DELETE CASCADE);
EOSQL
kind: ConfigMap
metadata:
annotations:
use-subpath: "true"
labels:
io.kompose.service: postgresql
name: postgresql-cm0