---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: business-canary
  labels:
    app.kubernetes.io/name: business-canary
    app.kubernetes.io/part-of: application-layer
    app.kubernetes.io/component: backend-application
    app.kubernetes.io/version: 1.0.0
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: business-canary
  template:
    metadata:
      labels:
        app.kubernetes.io/name: business-canary
        app.kubernetes.io/part-of: application-layer
        app.kubernetes.io/component: backend-application
        app.kubernetes.io/version: 1.0.0
    spec:
      containers:
        - name: business-app
          image: 904333181156.dkr.ecr.sa-east-1.amazonaws.com/business:$ECR_TAG
          ports:
            - containerPort: 8080
          env:
            - name: SERVER_PORT
              value: '8080'
            - name: TYPEORM_HOST
              value: business.cka3r3gokfjc.sa-east-1.rds.amazonaws.com
            - name: TYPEORM_PORT
              value: '5432'
            - name: TYPEORM_DATABASE
              value: business
            - name: TYPEORM_USERNAME
              valueFrom:
                secretKeyRef:
                  name: business-canary
                  key: typeorm-username
            - name: TYPEORM_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: business-canary
                  key: typeorm-password
            - name: AUTHZ_ISSUER
              value: https://auth.getbud.co/
            - name: AUTHZ_AUDIENCE
              value: https://api.getbud.co/business
            - name: AUTHZ_DOMAIN
              value: auth.getbud.co
            - name: AUTHZ_MGMT_DOMAIN
              value: getbud.us.auth0.com
            - name: AUTHZ_CLIENT_ID
              valueFrom:
                secretKeyRef:
                  name: business-canary
                  key: authz-client-id
            - name: AUTHZ_CLIENT_SECRET
              valueFrom:
                secretKeyRef:
                  name: business-canary
                  key: authz-client-secret
            - name: GRAPHQL_SCHEMA_FILE_PATH
              value: './dist/src/interface/graphql/schema.gql'
            - name: SERVER_LOGGING_LEVEL
              value: DEBUG
            - name: SERVER_LOGGING_SERVICE_NAME
              value: business@canary
            - name: SERVER_PREFIX
              value: business
            - name: SERVER_CORS_ALLOWED_ORIGINS
              value: https://app.canary.getbud.co,https://studio.apollographql.com
            - name: TYPEORM_LOGGING_ENABLED
              value: 'true'
            - name: GRAPHQL_DEBUG_ENABLED
              value: 'true'
            - name: GRAPHQL_PLAYGROUND_ENABLED
              value: 'true'
            - name: GRAPHQL_INSTROSPECTION_ENABLED
              value: 'true'
            - name: AWS_REGION
              value: sa-east-1
            - name: AWS_S3_BUCKET_NAME
              value: business.s3.getbud.co
            - name: AMPLITUDE_API_KEY
              value: 9314f6f12a26e6a5989287b16d030c30
            - name: AWS_CREDENTIALS_ACCESS_KEY_ID
              valueFrom:
                secretKeyRef:
                  name: business-canary
                  key: aws-credentials-access-key-id
            - name: AWS_CREDENTIALS_SECRET_ACCESS_KEY
              valueFrom:
                secretKeyRef:
                  name: business-canary
                  key: aws-credentials-secret-access-key
            - name: ANALYTICS_URL
              value: analytics-canary.bud.svc.cluster.local:50051
            - name: ANALYTICS_PACKAGES
              value: keyResult
            - name: TASKS_NATS_SERVERS
              value: nats.nats.svc.cluster.local:4222
