apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    io.sourceloop.service: postgres-orchestrator
  name: postgres-orchestrator
  namespace: sourceloop-sandbox
spec:
  replicas: 1
  selector:
    matchLabels:
      io.sourceloop.service: postgres-orchestrator
  strategy: {}
  template:
    metadata:
      labels:
#        network/sourceloop-sanbox: "true"
        io.sourceloop.service: postgres-orchestrator
    spec:
      containers:
        - args:
            - bash
            - -c
            - |-
              export PGPASSWORD=${POSTGRES_PASSWORD:-changeme}; sleep 30;
              psql -U ${POSTGRES_USER:-postgres} -d postgres -h postgres -c 'create database authentication_db' 2>&1;
              psql -U ${POSTGRES_USER:-postgres} -d postgres -h postgres -c 'create database notification_db' 2>&1;
              psql -U ${POSTGRES_USER:-postgres} -d postgres -h postgres -c 'create database workflow_db' 2>&1;
              psql -U ${POSTGRES_USER:-postgres} -d postgres -h postgres -c 'create database audit_db' 2>&1;
              psql -U ${POSTGRES_USER:-postgres} -d postgres -h postgres -c 'create database scheduler_db' 2>&1;
              psql -U ${POSTGRES_USER:-postgres} -d postgres -h postgres -c 'create database in_mail_db' 2>&1;
              exit 0
          env:
            - name: PGDATA
              value: /data/postgres
            - name: PGPASSWORD
              value: changeme
            - name: POSTGRES_PASSWORD
              value: changeme
            - name: POSTGRES_USER
              value: postgres
          image: postgres
          name: postgres-orchestrator
          ports:
            - containerPort: 5433
          resources: {}
      restartPolicy: Always
status: {}
