# 1、修改 MYSQL_HOST、MYSQL_PORT、MYSQL_USERNAME、MYSQL_PASSWORD、MYSQL_DATABASE
# 2、修改 BOOTSTRAP_SERVERS、ZOOKEEPER_ADDR（暂时用不到）
# 3、修改（暂时用不到） COLLECTOR_PUBLIC_URL、COLLECTOR_PUBLIC_ADDR、COLLECTOR_ADDR、COLLECTOR_AUTH_USERNAME、COLLECTOR_AUTH_PASSWORD
# 4、修改 name、addonID、LOG_METRICS_GROUP_ID
# 5、修改 MONITOR_LOG_KEY、DICE_CLUSTER_NAME、DICE_IS_EDGE(是否为边缘集群)
# 6、cpu和mem如果调整，也对应调整 DICE_MEM_*、DICE_CPU_*
# 7、更新最新镜像地址

apiVersion: apps/v1
kind: Deployment
metadata:
  name: addon-loghub-tab43de2040794e32a76ffe0c03c7aaa2
  namespace: default
spec:
  progressDeadlineSeconds: 600
  replicas: 1
  revisionHistoryLimit: 3
  selector:
    matchLabels:
      addonID: addon-loghub-tab43de2040794e32a76ffe0c03c7aaa2
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      labels:
        addonID: addon-loghub-tab43de2040794e32a76ffe0c03c7aaa2
    spec:
      affinity:
        nodeAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
          - preference:
              matchExpressions:
              - key: dice/master
                operator: DoesNotExist
            weight: 100
          - preference:
              matchExpressions:
              - key: node-role.kubernetes.io/master
                operator: DoesNotExist
            weight: 100
          - preference:
              matchExpressions:
              - key: dice/lb
                operator: DoesNotExist
            weight: 80
          - preference:
              matchExpressions:
              - key: node-role.kubernetes.io/lb
                operator: DoesNotExist
            weight: 80
      containers:
      - env:
        - name: LOG_LEVEL
          value: debug
        - name: DICE_CLUSTER_TYPE
          value: kubernetes
        - name: DICE_CLUSTER_NAME
          value: terminus-test
        - name: KUBERNETES_VENDOR
          value: dice
        - name: BOOTSTRAP_SERVERS
          value: addon-kafka.default.svc.cluster.local:9092
        - name: ZOOKEEPER_ADDR
          value: addon-zookeeper.default.svc.cluster.local:2181
        - name: MYSQL_HOST
          value: rm-bp17ar40w6824r8m0o.mysql.rds.aliyuncs.com
        - name: MYSQL_PORT
          value: "3306"
        - name: MYSQL_USERNAME
          value: terminus_test
        - name: MYSQL_PASSWORD
          value: bWgvqJqI6vGQp4W5KS00Qr92C8I1UV
        - name: MYSQL_DATABASE
          value: test_dice
        - name: COLLECTOR_PUBLIC_URL
          value: https://collector.test.terminus.io
        - name: COLLECTOR_PUBLIC_ADDR
          value: collector.test.terminus.io
        - name: COLLECTOR_ADDR
          value: collector.default.svc.cluster.local:7076
        - name: COLLECTOR_AUTH_USERNAME
          value: collector
        - name: COLLECTOR_AUTH_PASSWORD
          value: G$9767bP32drYFPWrK4XMLRMTatiM6cU
        - name: LOG_METRICS_GROUP_ID
          value: spot-log-metrics-tab43de2040794e32a76ffe0c03c7aaa2
        - name: MONITOR_LOG_KEY
          value: tab43de2040794e32a76ffe0c03c7aaa2
        - name: CONF_NAME
          value: log-metrics
        - name: DICE_IS_EDGE
          value: "false"
        - name: DICE_VERSION
          value: "3.20"
        - name: DICE_CPU_ORIGIN
          value: "1"
        - name: DICE_MEM_ORIGIN
          value: "1024"
        - name: DICE_CPU_REQUEST
          value: "0.2"
        - name: DICE_MEM_REQUEST
          value: "1024"
        - name: DICE_CPU_LIMIT
          value: "1"
        - name: DICE_MEM_LIMIT
          value: "1024"
        - name: DICE_CLUSTER
          valueFrom:
            configMapKeyRef:
              key: DICE_CLUSTER_NAME
              name: dice-cluster-info
        - name: POD_IP
          valueFrom:
            fieldRef:
              apiVersion: v1
              fieldPath: status.podIP
        - name: HOST_IP
          valueFrom:
            fieldRef:
              apiVersion: v1
              fieldPath: status.hostIP
        - name: POD_NAME
          valueFrom:
            fieldRef:
              apiVersion: v1
              fieldPath: metadata.name
        - name: POD_UUID
          valueFrom:
            fieldRef:
              apiVersion: v1
              fieldPath: metadata.uid
        envFrom:
        - configMapRef:
            name: dice-cluster-info
        - configMapRef:
            name: dice-addons-info
        image: registry.cn-hangzhou.aliyuncs.com/terminus/dice-loghub:3.20.0-20201210-8adca88
        imagePullPolicy: Always
        livenessProbe:
          failureThreshold: 9
          httpGet:
            path: /api/health
            port: 7096
            scheme: HTTP
          initialDelaySeconds: 1
          periodSeconds: 15
          successThreshold: 1
          timeoutSeconds: 10
        name: addon-loghub-tab43de2040794e32a76ffe0c03c7aaa2
        ports:
        - containerPort: 7096
          protocol: TCP
        - containerPort: 7098
          protocol: TCP
        readinessProbe:
          failureThreshold: 12
          httpGet:
            path: /api/health
            port: 7096
            scheme: HTTP
          initialDelaySeconds: 10
          periodSeconds: 10
          successThreshold: 1
          timeoutSeconds: 10
        resources:
          limits:
            cpu: "1"
            memory: 1Gi
          requests:
            cpu: 200m
            memory: 1Gi
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
      dnsPolicy: ClusterFirst
      imagePullSecrets:
      - name: aliyun-registry
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      serviceAccount: dice-operator
      serviceAccountName: dice-operator
      terminationGracePeriodSeconds: 30
