apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: middleware
  name: middleware
  namespace: edoc2
spec:
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      app: middleware
  template:
    metadata:
      labels:
        app: middleware
    spec:
      hostname: middleware
      terminationGracePeriodSeconds: 60
      containers:
      - image: registry.edoc2.com:5000/edoc2v5/metricmiddle:ecm-apm-v6.3.0.0
        imagePullPolicy: IfNotPresent
        name: middleware
        env:
        # - name: LOGGER_ISDEBUG
        #   value: "false"
        - name: ELASTICSEARCH_HOSTS
          value: "middle-proxy"
        - name: APM_ESURL
          value: "http://middle-proxy:9200"
        - name: ELASTICSEARCH_PORT
          value: "9200"
        - name: ES_HOSTS
          value: "[ http://middle-proxy:9200 ]"
        - name: ECM_ESURL
          value: "http://middle-proxy:9200"
        #- name: APM_ESURL
        #  valueFrom:
        #    configMapKeyRef:
        #      name: envfile
        #      key: APM_ESURL
        #- name: ELASTICSEARCH_HOSTS
        #  valueFrom:
        #    configMapKeyRef:
        #      name: envfile
        #      key: ELASTICSEARCH_HOSTS
        #- name: ELASTICSEARCH_PORT
        #  valueFrom:
        #    configMapKeyRef:
        #      name: envfile
        #      key: ELASTICSEARCH_PORT
        livenessProbe:
          exec:
            command: ["curl","-L","-k","-i","http://apm/apm/env | grep '200 OK'"]
          initialDelaySeconds: 10
          periodSeconds: 10
          timeoutSeconds: 3         # 检测时间间隔
          failureThreshold: 5       # 检测失败5次表示未就绪     
          successThreshold: 1       # 检查成功为2次表示就绪
        # ports:
        # - name: transport
        #   containerPort: 6261
      restartPolicy: Always
# ---
# apiVersion: v1
# kind: Service
# metadata:
#   labels:
#     app: middleware
#   name: middleware
#   namespace: edoc2
# spec:
#   ports:
#   - name: middleware
#     port: 6261
#     protocol: TCP
#     targetPort: 6261
#   selector:
#     app: middleware
#   #sessionAffinity: ClientIP
#   #sessionAffinityConfig:
#   #  clientIP:
#   #    timeoutSeconds: 5
#   type: ClusterIP
