apiVersion: apps/v1 
kind: Deployment 
metadata: 
  name: response-server-ws 
  labels: 
    app: response-server-ws 
spec: 
  replicas: 1 
  selector: 
    matchLabels: 
      app: response-server 
  template: 
    metadata: 
      labels: 
        app: response-server 
    spec: 
      containers: 
        - name: response-server-ws 
          image: gcr.io/heroes-hat-dev/response-server-ws:latest
          env: 
            - name: DB_USER 
              valueFrom: 
                secretKeyRef: 
                  name: response-server-cloudsql-db-credentials 
                  key: username 
            - name: DB_PASS 
              valueFrom: 
                secretKeyRef: 
                  name: response-server-cloudsql-db-credentials 
                  key: password 
            - name: DB_NAME 
              valueFrom: 
                secretKeyRef: 
                  name: response-server-cloudsql-db-credentials 
                  key: dbname 
            - name: FIRESTORE_PROJECT_ID
              value: "heroes-hat-dev"
            - name: AUTH_SERVER_NP_URL
              value: "auth-server-np:50000"
            - name: REGISTRATION_CLIENT_ID
              valueFrom:
                secretKeyRef:
                  key: REGISTRATION_CLIENT_ID
                  name: response-server-secrets
            - name: REGISTRATION_CLIENT_SECRET
              valueFrom:
                secretKeyRef:
                  key: REGISTRATION_CLIENT_SECRET
                  name: response-server-secrets
            - name: WCP_USER
              valueFrom:
                secretKeyRef:
                  key: WCP_USER
                  name: response-server-secrets
            - name: WCP_PASS
              valueFrom:
                secretKeyRef:
                  key: WCP_PASS
                  name: response-server-secrets
            - name: WCP_STUDY_METADATA_SERVER_URL
              value: "study-meta-data-np:50000"
            - name: REGISTRATION_SERVER_URL
              value: "user-registration-server-np:50000"
            - name: GOOGLE_APPLICATION_CREDENTIALS
              value: "/secrets/gcloud_key/key.json"
          ports:
          - containerPort: 8080
          readinessProbe:
            httpGet:
              path: /mystudies-response-server/health
              port: 8080
          volumeMounts:
            - name: gcloud-key-volume
              mountPath: /secrets/gcloud_key
              readOnly: true
        - name: cloudsql-proxy 
          image: gcr.io/cloudsql-docker/gce-proxy:latest 
          command: ["/cloud_sql_proxy", 
            "-instances=heroes-hat-dev:us-east1:my-studies2=tcp:3306", 
            "-credential_file=/secrets/cloudsql/key.json"] 
          volumeMounts: 
            - name: gcloud-key-volume 
              mountPath: /secrets/cloudsql 
              readOnly: true 
      volumes: 
        - name: gcloud-key-volume
          secret:
            secretName: response-server-ws-gcloud-key
