apiVersion: apps/v1
kind: Deployment
metadata:
  name: tarsstat
spec:
  replicas: 1
  selector:
    matchLabels:
      app: tarsstat
  template:
    metadata:
      labels:
        app: tarsstat
    spec:
      containers:
      - name: tarsstat
        image: ccr.ccs.tencentyun.com/tarsbase/tarsstat:v1.1.0
        env:
        - name: DB_HOST
          valueFrom:
            configMapKeyRef:
              name: tars-db-config
              key: DB_HOST
        - name: DB_PORT
          valueFrom:
            configMapKeyRef:
              name: tars-db-config
              key: DB_PORT
        - name: DB_USER
          valueFrom:
            configMapKeyRef:
              name: tars-db-config
              key: DB_USER
        - name: DB_PASS
          valueFrom:
            configMapKeyRef:
              name: tars-db-config
              key: DB_PASS
        readinessProbe:
            exec:
              command: ["tarscli", "hzcheck"]
            failureThreshold: 10
            initialDelaySeconds: 5
            periodSeconds: 10
            successThreshold: 1
            timeoutSeconds: 5
        lifecycle:
          preStop:
            exec:
              command: ["tarscli", "prestop"]
      terminationGracePeriodSeconds: 90
