---
version: 1
kind: component

requires:
  - kubernetes
  - helm

parameters:
- name: hub.componentName
  env: COMPONENT_NAME
- name: storage.class
  empty: allow
- name: mysql
  empty: allow
  parameters:
  - name: namespace
    value: mysql
    env: NAMESPACE
  - name: port
    value: 3306
  - name: user
    env: DB_USER
  - name: password
    env: DB_PASSWORD
  - name: database
    env: DB_NAME
  - name: rootPassword
    env: MYSQL_ROOT_PASSWORD
  - name: volumeSize
    value: 8Gi
  - name: extra.databases
    empty: allow
    env: EXTRA_DATABASES
- name: helm
  parameters:
  - name: repo
    value: https://charts.bitnami.com/bitnami
    env: HELM_REPO
  - name: chart
    value: mysql
    env: HELM_CHART
  - name: version
    value: 9.4.1
    env: HELM_CHART_VERSION
  - name: valuesFile
    value: values.yaml
    env: CHART_VALUES_FILE
- name: hub.backup.file
  empty: allow
  env: BACKUP_FILE

outputs:
- name: mysql.host
  value: ${hub.componentName}.${mysql.namespace}.svc.cluster.local
- name: mysql.port
- name: mysql.database
- name: mysql.user
- name: mysql.password
  kind: secret
- name: mysql.rootPassword
  kind: secret

templates:
  files:
    - "*.template"

lifecycle:
  verbs:
  - deploy
  - undeploy
  - backup
