apiVersion: apps/v1
kind: Deployment
metadata:
  name: searchengine
  namespace: edoc2
  labels:
    app: searchengine
    k8s-app: searchengine
spec:
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      app: searchengine
  template:
    metadata:
      labels:
        app: searchengine
    spec:
      hostname: searchengine
      terminationGracePeriodSeconds: 60
      containers:
        - name: searchengine
          image: registry.edoc2.com:5000/edoc2v5/searchengine:inbiz-v6.5.3.3-arm
          imagePullPolicy: IfNotPresent
          envFrom:
            - configMapRef:
                name: mid-envfile
            - configMapRef:
                name: inbiz-envfile
          securityContext:
            privileged: true
          ports:
            - containerPort: 5009
              name: search-http
              protocol: TCP
            - containerPort: 15009
              name: search-grpc
              protocol: TCP
          livenessProbe:
            httpGet:
              path: /api/values
              port: search-http
            initialDelaySeconds: 300
            periodSeconds: 10
            timeoutSeconds: 3 # 检测时间间隔
            failureThreshold: 5 # 检测失败5次表示未就绪
            successThreshold: 1 # 检查成功为2次表示就绪
      restartPolicy: Always
      nodeSelector:
        node.drive.nodelabels: InDrive
---
apiVersion: v1
kind: Service
metadata:
  name: searchengine
  namespace: edoc2
  labels:
    app: searchengine
spec:
  ports:
    - name: search-http
      port: 5009
      targetPort: 5009
    - name: search-grpc
      port: 15009
      targetPort: 15009
      protocol: TCP
  selector:
    app: searchengine
  type: ClusterIP
