---
apiVersion: v1
kind: Service
metadata:
  name: import
  namespace: edoc2
  labels:
    app: import
spec:
  ports:
  - name: import
    port: 6630
    targetPort: 6630
    #当type: NodePort的时候，如果nodePort的值注释掉，K8S会默认随机一个端口对外
    #nodePort: 36630
    protocol: TCP
  selector:
    app: import
  type: NodePort
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: import
  namespace: edoc2
  labels:
    app: import
    k8s-app: import
spec:
  replicas: 1
  selector:
    matchLabels:
      app: import
  template:
    metadata:
      labels:
        app: import
    spec:
      hostname: import
      terminationGracePeriodSeconds: 30
      containers:
      - name: import-container
        image: registry.edoc2.com:5000/edoc2v5/import:ecm-v6.6.2.0
        imagePullPolicy: IfNotPresent
        #env:
        #- name: isWriteLog 
        #  value: true
        #- name: pageSize
        #  value: 100
        #- name: ESURL 
        #  value: http://es:9200
        #- name: ESNAME
        #  value: elastic
        #- name: ESPASSWORD
        #  value: fY9aLwahqCG06tmYYU2E
        #- name: DatabaseType 
        #  value: 1
        #- name: DatabaseServerName
        #  value: sqlserver
        #- name: DatabaseServerPort
        #  value: 1433
        #- name: DatabaseUserName
        #  valueFrom:
        #    secretKeyRef:
        #      name: edoc2-secret
        #      key: DBUSER
        #- name: DatabasePassword 
        #  valueFrom:
        #    secretKeyRef:
        #      name: edoc2-secret
        #      key: DBPASSWD
        envFrom:
        - configMapRef:
            name: ecm-envfile
        - configMapRef:
            name: mid-envfile
        volumeMounts:
          - mountPath: /edoc2Docs
            name: owner-import-volume
        ports:
        - name: import
          containerPort: 6630
        # resources:
          # requests:
            # cpu: 800m
            # memory: 1.5Gi
          # limits:
            # cpu: 900m
            # memory: 1.6Gi
        securityContext:
          capabilities:
            add: ["SYS_PTRACE"]
      volumes:
        - name: owner-import-volume
          hostPath:
            path: /home/data/edoc2Docs
            type: DirectoryOrCreate
      restartPolicy: Always
      nodeSelector:
        "node.drive.nodelabels": InDrive
