---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: yapi-yapi
  namespace: yapi-dev
spec:
  progressDeadlineSeconds: 600
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      app: yapi-yapi
  strategy:
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 0
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: yapi-yapi
    spec:
      containers:
      - env:
        - name: YAPI_ACOUNT
          value: yapi@icmdb.vip
        - name: YAPI_DB_AUTH
          value: admin
        - name: YAPI_DB_HOST
          value: yapi-mongo
        - name: YAPI_DB_NAME
          value: yapi
        - name: YAPI_DB_PASS
          value: YapiMongoPassw0rd
        - name: YAPI_DB_PORT
          value: "27017"
        - name: YAPI_DB_USER
          value: root
        - name: YAPI_DEBUG
          value: "0"
        - name: YAPI_DELAY
          value: "5"
        - name: YAPI_MAIL_ENABLE
          value: "true"
        - name: YAPI_MAIL_FROM
          value: notice@mail.icmdb.vip
        - name: YAPI_MAIL_HOST
          value: smtpdm.aliyun.com
        - name: YAPI_MAIL_PASS
          value: bm90aWNlQG1haWwuaWNt
        - name: YAPI_MAIL_PORT
          value: "465"
        - name: YAPI_MAIL_USER
          value: Yapi
        - name: YAPI_PORT
          value: "3000"
        image: icmdb/yapi:1.8.3
        livenessProbe:
          failureThreshold: 6
          httpGet:
            path: /
            port: http
            scheme: HTTP
          initialDelaySeconds: 20
          periodSeconds: 10
          successThreshold: 1
          timeoutSeconds: 5
        imagePullPolicy: Always
        name: yapi
        ports:
        - containerPort: 3000
          name: http
          protocol: TCP
        readinessProbe:
          failureThreshold: 6
          httpGet:
            path: /
            port: http
            scheme: HTTP
          initialDelaySeconds: 30
          periodSeconds: 10
          successThreshold: 1
          timeoutSeconds: 5
        volumeMounts:
        - mountPath: /app/yapi/log
          name: yapi-yapi-log
        resources:
          requests:
            cpu: 300m
            memory: 512Mi
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      volumes:
      - emptyDir: {}
        name: yapi-yapi-log
