apiVersion: apps/v1
kind: Deployment
metadata:
  name: project-app
spec:
  selector:
    matchLabels:
      app: project
  template:
    metadata:
      labels:
        app: project
    spec:
      serviceAccountName: parse
      containers:
      - name: project
        image: eu.gcr.io/reitan-denv/project
        env:
        - name: DB_USER
          valueFrom:
            secretKeyRef:
              name: reitan-secret
              key: DB_USER
        - name: DB_PASS
          valueFrom:
            secretKeyRef:
              name: reitan-secret
              key: DB_PASS
        - name: DB_PORT
          valueFrom:
            secretKeyRef:
              name: reitan-secret
              key: DB_PORT
        - name: DB_PATH
          valueFrom:
            secretKeyRef:
              name: reitan-secret
              key: DB_PATH
        - name: DB_NAME
          valueFrom:
            secretKeyRef:
              name: reitan-secret
              key: DB_NAME
      - name: cloud-sql-proxy
        # It is recommended to use the latest version of the Cloud SQL proxy
        # Make sure to update on a regular schedule!
        image: gcr.io/cloudsql-docker/gce-proxy:1.17
        command:
          - "/cloud_sql_proxy"

          # If connecting from a VPC-native GKE cluster, you can use the
          # following flag to have the proxy connect over private IP
          # - "-ip_address_types=PRIVATE"

          # Replace DB_PORT with the port the proxy should listen on
          # Defaults: MySQL: 3306, Postgres: 5432, SQLServer: 1433
          - "-instances=reitan-denv:europe-north1:database=tcp:5432"
        securityContext:
          # The default Cloud SQL proxy image runs as the
          # "nonroot" user and group (uid: 65532) by default.
          runAsNonRoot: true
        # Resource configuration depends on an application's requirements. You
        # should adjust the following values based on what your application
        # needs. For details, see https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
