apiVersion: apps/v1
kind: Deployment
metadata:
  name: cloud-flask
  labels:
    app: cloud-flask
  namespace: default
spec:
  replicas: 1
  selector:
    matchLabels:
      app: cloud-flask
  strategy:
    rollingUpdate:
      maxSurge: 20%
      maxUnavailable: 20%
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: cloud-flask
    spec:
      containers:
      - image: cloudacode/cloudflask:v1.0.4
        imagePullPolicy: Always
        name: cloud-flask
        ports:
        - containerPort: 5000
          protocol: TCP
        env:
        - name: DB_USER
          valueFrom:
            secretKeyRef:
              name: secret-basic-auth
              key: username
        - name: DB_PASSWORD
          valueFrom:
            secretKeyRef:
              name: secret-basic-auth
              key: password
        - name: DB_NAME
          value: cloud_user
        - name: DB_HOST
          value: database-2.cxm6fgejlg3y.ap-northeast-2.rds.amazonaws.com
