---
apiVersion: v1
kind: Service
metadata:
  name: edoc2
  namespace: edoc2
  labels:
    app: edoc2
spec:
  ports:
  - name: edoc2
    port: 80
    targetPort: 80
    protocol: TCP
  - name: grpc
    port: 5002
    targetPort: 5002
    protocol: TCP
  selector:
    app: edoc2
  type: ClusterIP
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: edoc2
  namespace: edoc2
  labels:
    app: edoc2
    k8s-app: edoc2
spec:
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      app: edoc2
  template:
    metadata:
      labels:
        app: edoc2
    spec:
      hostname: edoc2
      #terminationGracePeriodSeconds: 60
      containers:
      - name: edoc2-container
        image: registry.edoc2.com:5000/edoc2v5/edoc2:inbiz-v6.5.2.0
        imagePullPolicy: IfNotPresent
        envFrom:
        - configMapRef:
            name: ecm-envfile
        - configMapRef:
            name: mid-envfile
        securityContext:
          capabilities:
            add: ["SYS_PTRACE"]
        ports:
        - name: edoc2p80
          containerPort: 80
        - name: grpc5002
          containerPort: 5002
        resources:
          requests:
            cpu: 500m
            memory: 1Gi
          limits:
            cpu: 1200m
            memory: 2Gi
        #livenessProbe:
        #  exec:
        #    command: ["curl","-L","-k","-i","http://edoc2/api/values|grep '200 OK'"]
        #  initialDelaySeconds: 10
        #  periodSeconds: 10
        #  timeoutSeconds: 3         # 检测时间间隔
        #  failureThreshold: 5       # 检测失败5次表示未就绪     
        #  successThreshold: 1       # 检查成功为1次表示就绪
        #volumeMounts:
        #- name: data
        #  mountPath: /home/edoc2/macrowing/edoc2v5/data
        #- name: edoc2docs
        #  mountPath: /edoc2Docs
        #- name: www
        #  mountPath: /app/wwwroot/external/
      restartPolicy: Always
      #volumes:
      #- name: data
      #  hostPath:
      #    path: /home/edoc2/macrowing/edoc2v5/data
      #- name: edoc2docs
      #  hostPath:
      #    path: /home/edoc2/macrowing/edoc2v5/data/edoc2Docs
      #- name: www
      #  hostPath:
      #    path: /home/edoc2/macrowing/edoc2v5/data/www
      nodeSelector:
        node.drive.nodelabels: InDrive
