version: 1
kind: stack
meta:
  name: GKE Sandbox Stack
  brief: GKE Sandbox

components:
  - name: gke-gcloud
    source:
      dir: components/gke-gcloud
      git:
        remote: https://github.com/agilestacks/google-components.git
        subDir: gke-gcloud

extensions:
  init:
    - gcp
    - .hub/get-info
  configure:
    - gcp
    - .hub/set-gke-version
    - env

requires:
  - gcp

lifecycle:
  verbs:
    - deploy
    - undeploy
  order:
    - gke-gcloud

parameters:
  - name: hub.sandboxDir
    fromEnv: SANDBOX_DIR
  - name: hub.sandboxCommit
    fromEnv: SANDBOX_COMMIT
  - name: hub.userAccount
    fromEnv: USER_ACCOUNT

  - name: projectId
    fromEnv: GOOGLE_PROJECT
  - name: dns.domain
    fromEnv: HUB_DOMAIN_NAME
  - name: stateBucketName
    fromEnv: HUB_STATE_BUCKET
  - name: hubStackName
    fromEnv: HUB_STACK_NAME

  - name: component.gke
    parameters:
      - name: name
        value: ${hubStackName}
      - name: zone
        fromEnv: GOOGLE_ZONE
      - name: region
        fromEnv: GOOGLE_REGION
      - name: machineType
        value: e2-standard-4
      - name: nodeCount
        value: 1
      - name: version
        fromEnv: GOOGLE_GKE_CLUSTER_VERSION
      - name: releaseChannel
        fromEnv: GOOGLE_GKE_RELEASE_CHANNEL

outputs:
  - name: component.gke.url
