apiVersion: v1
kind: ConfigMap
metadata:
  name: db-init-barbican
  labels:
    system: openstack
    type: configuration
    component: database

data:
  db-init.sql: |
    CREATE DATABASE {{.Values.db_name}};
    CREATE ROLE {{.Values.db_user}}{{.Values.global.user_suffix}} WITH ENCRYPTED PASSWORD '{{.Values.db_password | default (tuple . .Values.db_user | include "postgres.password_for_user")}}' LOGIN;
    GRANT ALL PRIVILEGES ON DATABASE {{.Values.db_name}} TO {{.Values.db_user}}{{.Values.global.user_suffix}};
