---
apiVersion: v1
kind: Service
metadata:
  name: perm
  namespace: edoc2
  labels:
    app: perm
spec:
  ports:
  - name: perm-6330
    port: 6330
    targetPort: 6330
    protocol: TCP
  - name: perm-16330
    port: 16330
    targetPort: 16330
    protocol: TCP
  selector:
    app: perm
  type: ClusterIP
---
apiVersion: apps/v1
kind: Deployment 
metadata:
  name: perm
  namespace: edoc2
  labels:
    app: perm
    k8s-app: perm
spec:
  replicas: 3
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      app: perm
  template:
    metadata:
      labels:
        app: perm
    spec:
      hostname: perm
      terminationGracePeriodSeconds: 60
      containers:
      - name: perm-container
        image: registry.edoc2.com:5000/edoc2v5/perm:inbiz-v6.6.0.0-beta
        imagePullPolicy: IfNotPresent
        envFrom:
        - configMapRef:
            name: mid-envfile
        - configMapRef:
            name: ecm-envfile
        ports:
        - name: perm-6330
          containerPort: 6330
        - name: perm-16330
          containerPort: 16330
        resources:
          requests:
            cpu: 1450m
            memory: 2.4Gi
          limits:
            cpu: 1500m
            memory: 2.5Gi
        securityContext:
          capabilities:
            add: ["SYS_PTRACE"]
        livenessProbe:
          exec:
            command: ["curl","-L","-k","-i","http://localhost:6330/api/values|grep '200 OK'"]
          initialDelaySeconds: 10
          periodSeconds: 10
          timeoutSeconds: 3         # 检测时间间隔
          failureThreshold: 5       # 检测失败5次表示未就绪     
          successThreshold: 1       # 检查成功为2次表示就绪
      restartPolicy: Always
      nodeSelector:
        node.drive.nodelabels: InDrive
