apiVersion: apps/v1
kind: Deployment
metadata:
  name: inbiz-backend-api
  namespace: edoc2
  labels:
    app: inbiz-backend-api
    k8s-app: inbiz-backend-api
spec:
  replicas: 3
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      app: inbiz-backend-api
  template:
    metadata:
      labels:
        app: inbiz-backend-api
    spec:
      hostname: inbiz-backend-api
      terminationGracePeriodSeconds: 60
      containers:
        - name: inbiz-backend-api
          image: registry.edoc2.com:5000/edoc2v5/inbiz-backend:edrms-v6.5.0.0-arm
          imagePullPolicy: IfNotPresent
          env:
            - name: InBiz_RunTimeType
              value: "0"
          envFrom:
            - configMapRef:
                name: mid-envfile
            - configMapRef:
                name: inbiz-envfile
          securityContext:
            capabilities:
              add: ["SYS_PTRACE"]
          ports:
            - name: backend-http
              containerPort: 5005
            - name: backend-grpc
              containerPort: 15005
          #resources:
          #  requests:
          #    memory: 24
          #    cpu: 8
          #  limits:
          #    memory: 24
          #    cpu: 8
          livenessProbe:
            httpGet:
              path: /api/values
              port: backend-http
            initialDelaySeconds: 60
            periodSeconds: 10
            timeoutSeconds: 3 # 检测时间间隔
            failureThreshold: 5 # 检测失败5次表示未就绪
            successThreshold: 1 # 检查成功为2次表示就绪
      restartPolicy: Always
      nodeSelector:
        node.drive.nodelabels: InDrive
---
apiVersion: v1
kind: Service
metadata:
  name: inbiz-backend-api
  namespace: edoc2
  labels:
    app: inbiz-backend-api
spec:
  ports:
    - name: backend-http
      port: 5005
      targetPort: 5005
      protocol: TCP
    - name: backend-grpc
      port: 15005
      targetPort: 15005
      protocol: TCP
  selector:
    app: inbiz-backend-api
  type: ClusterIP
