apiVersion: apps/v1
kind: Deployment
metadata:
  name: django-boilerplate-deployment
  labels:
    app: django-app
spec:
  replicas: 1
  selector:
    matchLabels:
      app: django-app
  template:
    metadata:
      labels:
        app: django-app
    spec:
      containers:
        - name: django-app
          image: django-image
          resources:
            requests:
              memory: "128Mi"
              cpu: "50m"
            limits:
              memory: "256Mi"
              cpu: "500m"
          ports:
            - containerPort: 8080
          env:
            - name: APP_DEBUG
              value: "True"
            - name: APP_ENVIRONMENT
              value: "staging"
            - name: APP_POSTGRES_HOST
              valueFrom:
                secretKeyRef:
                  name: django-boilerplate-secret
                  key: postgres_host
            - name: APP_POSTGRES_PORT
              valueFrom:
                configMapKeyRef:
                  name: django-boilerplate-configmap
                  key: postgres_port
            - name: APP_POSTGRES_NAME
              valueFrom:
                secretKeyRef:
                  name: django-boilerplate-secret
                  key: postgres_name
            - name: APP_POSTGRES_USER
              valueFrom:
                secretKeyRef:
                  name: django-boilerplate-secret
                  key: postgres_user
            - name: APP_POSTGRES_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: django-boilerplate-secret
                  key: postgres_password
            - name: APP_EMAIL_HOST_USER
              valueFrom:
                secretKeyRef:
                  name: django-boilerplate-secret
                  key: email_host_user
            - name: APP_EMAIL_HOST_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: django-boilerplate-secret
                  key: email_host_password
