version: 1
kind: component

requires:
  - gcp
  - terraform

provides:
  - kubernetes

parameters:
  - name: dns.domain
  - name: hub.componentName

  - name: composer
    parameters:
      - name: envName
        value: ${dns.name}-${hub.componentName}

      - name: version
        value: v1
        brief: Version of composer environment (v1 or v2)

      - name: python.version
        value: 3
        breif: The major version of Python used to run the Apache Airflow scheduler, worker, and webserver processes. Can be set to '2' or '3'.

      - name: python.requirementsFile
        brief: |
          Path (relative to component directory or absolute) to the requirements.txt

          Additional packages defined in this file and will be applied during composer deployment

          If you modify file after composer has been deployed, run: `hub stack deploy -c composer` again
        value: requirements.txt
        env: REQUIREMENTS_TXT

      - name: airflow.imageVersion
        empty: allow

      - name: endpoint
        value: public
        brief: "Type of Composer endpoint. Value can be: public or private"

      - name: projectId
        brief: GCP Project ID where Composer environment will be deployed

      - name: network.subnetwork
        brief: The subnetwork to host the composer cluster.

      - name: network.projectId
        value: ${composer.projectId}

  - name: gke.node
    parameters:
      - name: count
        brief: The number of nodes in the Kubernetes Engine cluster of the environment.
        value: 3

      - name: machineType
        breif: The Compute Engine machine type used for cluster instances, specified as a name or relative resource name.
        value: "n1-standard-1"

      - name: diskSize
        brief: The disk size in GB used for node VMs.
        value: 100

outputs:
  - name: composer.airflow.url
    fromTfVar: airflow_uri
  - name: composer.gcs.bucket
    fromTfVar: gcs_bucket
  - name: composer.id
    fromTfVar: env_id
  - name: dns.domain
  - name: kubernetes.gke.cluster
    fromTfVar: gke_cluster
  - name: kubernetes.api.endpoint
    fromTfVar: hub_kubernetes_api_endpoint

templates:
  files:
    - "*.template"
