apiVersion: apps/v1
kind: Deployment 
metadata: 
  name: bpg-controller-dep 
  namespace: ballerina-playground 
  labels: 
    app: bpg-controller 
spec: 
  replicas: 1
  selector: 
    matchLabels: 
      app: bpg-controller 
  template: 
    metadata: 
      labels: 
        app: bpg-controller 
    spec: 
      serviceAccount: bpg-controller-sa 
      serviceAccountName: bpg-controller-sa 
      containers: 
      - name: bpg-controller-container 
        imagePullPolicy: Always 
        image: gcr.io/${BPG_GCP_PROJECT_ID}/controller:v0.1-20180425-1754
        # resources: 
        #   requests: 
        #     cpu: 100m 
        #     memory: 100Mi 
        env:
        -
          name: BPG_REDIS_WRITE_HOST
          value: "redis-master"
        -
          name: BPG_REDIS_WRITE_PORT
          value: "6379"
        -
          name: BPG_REDIS_READ_HOST
          value: "redis-slave"
        -
          name: BPG_REDIS_READ_PORT
          value: "6379"
        -
          name: BPG_NAMESPACE
          value: "ballerina-playground"
        -
          name: BPG_LAUNCHER_IMAGE_NAME
          value: "gcr.io/${BPG_GCP_PROJECT_ID}/launcher:v0.1-20180714-0855"
        -
          name: BPG_MIN_CONCURRENT_USERS
          value: "10"
        -
          name: BPG_MAX_CONCURRENT_USERS
          value: "40"
        -
          name: BPG_SCALING_STEP_UP
          value: "2"
        -
          name: BPG_SCALING_STEP_DOWN
          value: "1"
        -
          name: BPG_SCALING_FREE_BUFFER
          value: "2"
        -
          name: BGP_NFS_SERVER_IP
          value: "10.142.0.5"
        -
          name: ROOT_DOMAIN_NAME
          value: "playground.preprod.ballerina.io"
        -
          name: BPG_CONTROLLER_INTERNAL_URL
          value: "bpg-controller-internal"
        -
          name: BPG_LAUNCHER_HTTPS_PORT
          value: "8443"
        -
          name: BPG_CONTROLLER_ROLE
          value: "API_SERVER"
        ports:
        -
          name: http-port
          containerPort: 8080
        -
          name: https-port
          containerPort: 8443
        readinessProbe: 
          tcpSocket: 
            port: https-port
          initialDelaySeconds: 3 
          periodSeconds: 10 
        livenessProbe: 
          tcpSocket: 
            port: https-port
          initialDelaySeconds: 5 
          periodSeconds: 20 