---
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: 1
  revisionHistoryLimit: 5
  selector:
    matchLabels:
      app: perm
  template:
    metadata:
      labels:
        app: perm
    spec:
      hostname: perm
      terminationGracePeriodSeconds: 30
      containers:
      - name: perm-container
        image: registry.edoc2.com:5000/edoc2v5/perm:v6.3.0.0
        imagePullPolicy: IfNotPresent
        name: perm
        env:
        - name: CONTAINER_PLATFORM
          valueFrom:
            configMapKeyRef:
              name: envfile
              key: CONTAINER_PLATFORM
        - name: LOGGER_ISDEBUG
          valueFrom:
            configMapKeyRef:
              name: envfile
              key: LOGGER_ISDEBUG
        - name: LOGGER_MINCALLTIMESPAN
          valueFrom:
            configMapKeyRef:
              name: envfile
              key: LOGGER_MINCALLTIMESPAN
        - name: ContainerContent
          valueFrom:
            configMapKeyRef:
              name: envfile
              key: ContainerContent
        - name: PUBLISH_EXTERNAL_ADDRESS
          valueFrom:
            configMapKeyRef:
              name: envfile
              key: PUBLISH_EXTERNAL_ADDRESS
        - name: ContainerType
          valueFrom:
            configMapKeyRef:
              name: envfile
              key: ContainerType
        - name: STORAGEPLATFORM
          valueFrom:
            configMapKeyRef:
              name: envfile
              key: STORAGEPLATFORM
        - name: HTTP_PROTOCOL_TYPE
          valueFrom:
            configMapKeyRef:
              name: envfile
              key: HTTP_PROTOCOL_TYPE
        - name: S3_Url
          valueFrom:
            configMapKeyRef:
              name: envfile
              key: S3_Url
        - name: S3_SecretKey
          valueFrom:
            configMapKeyRef:
              name: envfile
              key: S3_SecretKey
        - name: S3_AccessKey
          valueFrom:
            configMapKeyRef:
              name: envfile
              key: S3_AccessKey
        - name: S3_Bucket
          valueFrom:
            configMapKeyRef:
              name: envfile
              key: S3_Bucket
        - name: S3_SignatureVersion
          valueFrom:
            configMapKeyRef:
              name: envfile
              key: S3_SignatureVersion
        - name: Ceph_HealthUrl
          valueFrom:
            configMapKeyRef:
              name: envfile
              key: Ceph_HealthUrl
        - name: OSS_ISCNAME
          valueFrom:
            configMapKeyRef:
              name: envfile
              key: OSS_ISCNAME
        - name: ESURL
          valueFrom:
            configMapKeyRef:
              name: envfile
              key: ESURL
        - name: CACHEMODULE
          valueFrom:
            configMapKeyRef:
              name: envfile
              key: CACHEMODULE
        - name: ISUDC
          valueFrom:
            configMapKeyRef:
              name: envfile
              key: ISUDC
        - name: PRODUCTION
          valueFrom:
            configMapKeyRef:
              name: envfile
              key: PRODUCTION
        - name: INBIZ
          valueFrom:
            configMapKeyRef:
              name: envfile
              key: INBIZ
        - name: INBIZURL
          valueFrom:
            configMapKeyRef:
              name: envfile
              key: INBIZURL
        - name: INBIZGRPCURL
          valueFrom:
            configMapKeyRef:
              name: envfile
              key: INBIZGRPCURL
        ports:
        - name: perm-6330
          containerPort: 6330
        - name: perm-16330
          containerPort: 16330
        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
