apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2
kind: Deployment
metadata:
  name: template-flask-react
spec:
  selector:
    matchLabels:
      app: template-flask-react
      tier: backend
  replicas: 3
  template:
    metadata:
      labels:
        app: template-flask-react
        tier: backend
    spec:
      containers:
        - name: template-flask-react
          image: template-flask-react:0.11
          ports:
            - containerPort: 5000
          env:
            - name: FLASK_APP
              value: ./app/backend/server.py
            - name: FLASK_RUN_HOST
              value:  0.0.0.0
            - name: MONGO_HOST
              value: localhost
            - name: MONGO_USERNAME
              value: root
            - name: MONGO_PASSWORD
              value: example
            - name: MONGO_DATABASE
              value: example_dev
            - name: FLASK_ENV
              value: development
        - name: mongo
          image: mongo
          ports:
            - containerPort: 27017
          env:
            - name: MONGO_INITDB_ROOT_USERNAME
              value: root
            - name: MONGO_INITDB_ROOT_PASSWORD
              value: example
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 1
