apiVersion: v1
kind: ConfigMap
metadata:
  name: datahub-initdb
  namespace: datahub
  labels:
    system: openstack
    type: database
    component: datahubdb

data:
  init.sh: |
    export TERM=dumb

    mysql -u root --password={{.Values.mariadb.root_password}} <<- EOSQL
      CREATE DATABASE {{.Values.mariadb.dbName}} CHARACTER SET utf8 COLLATE utf8_general_ci;
     #CREATE USER '{{.Values.mariadb.ronly_user}}' IDENTIFIED BY '{{.Values.global.datahub_ronly_password}}';
      GRANT SELECT on {{.Values.mariadb.dbName}}.* to '{{.Values.global.datahub.user}}'@'%' identified by '{{.Values.global.datahub.password}}';

    EOSQL
