apiVersion: apps/v1
kind: Deployment
metadata:
  name: katib-db-manager
  namespace: kubeflow
spec:
  template:
    spec:
      containers:
        - name: katib-db-manager
          env:
            - name: DB_NAME
              value: mysql

            ## ===============
            ## MySQL Configs
            ## ===============
            - name: KATIB_MYSQL_DB_HOST
              valueFrom:
                configMapKeyRef:
                  name: katib-mysql-config
                  key: dbHost
            - name: KATIB_MYSQL_DB_PORT
              valueFrom:
                configMapKeyRef:
                  name: katib-mysql-config
                  key: dbPort
            - name: KATIB_MYSQL_DB_DATABASE
              valueFrom:
                configMapKeyRef:
                  name: katib-mysql-config
                  key: dbName

            ## ===============
            ## MySQL Secrets
            ## ===============
            - name: DB_USER
              valueFrom:
                secretKeyRef:
                  name: {{< tmpl.Exec "kubeflow_katib.mysql.auth.secret_name" . | quote >}}
                  key: {{< tmpl.Exec "kubeflow_katib.mysql.auth.secret_username_key" . | quote >}}
            - name: DB_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: {{< tmpl.Exec "kubeflow_katib.mysql.auth.secret_name" . | quote >}}
                  key: {{< tmpl.Exec "kubeflow_katib.mysql.auth.secret_password_key" . | quote >}}
