# 1、修改 namespace 中的 addon id
# 2、修改 N0_ZOOKEEPER_ADDR、N0_BOOTSTRAP_SERVERS、N0_MONITOR_LOG_COLLECTOR、N0_ES_URLS、DICE_NAMESPACE

apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: log-exporter
  namespace: group-addon-log-es--n92cd743acded41a086688961d0f3bb98
spec:
  podManagementPolicy: OrderedReady
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      app: log-exporter
  serviceName: log-exporter
  template:
    metadata:
      labels:
        app: log-exporter
      namespace: group-addon-log-es--n92cd743acded41a086688961d0f3bb98
    spec:
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
            - matchExpressions:
              - key: dice/locked
                operator: DoesNotExist
              - key: dice/location-cluster-service
                operator: Exists
              - key: dice/stateful-service
                operator: Exists
        podAntiAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
          - podAffinityTerm:
              labelSelector:
                matchExpressions:
                - key: app
                  operator: In
                  values:
                  - log-exporter
              topologyKey: dice/topology-zone
            weight: 100
          - podAffinityTerm:
              labelSelector:
                matchExpressions:
                - key: app
                  operator: In
                  values:
                  - log-exporter
              topologyKey: kubernetes.io/hostname
            weight: 100
      containers:
      - env:
        - name: N0_DICE_ADDON
          value: n92cd743acded41a086688961d0f3bb98
        - name: N0_ZOOKEEPER_ADDR
          value: zk-1.group-addon-monitor-zk--p01a4b49dd78d45d98fcc3a40ae412b42.svc.cluster.local:2181/kafka,zk-3.group-addon-monitor-zk--p01a4b49dd78d45d98fcc3a40ae412b42.svc.cluster.local:2181/kafka,zk-2.group-addon-monitor-zk--p01a4b49dd78d45d98fcc3a40ae412b42.svc.cluster.local:2181/kafka
        - name: N0_ADDON_NODE_ID
          value: tca56e69eec71432sa013f3deae4ce3d3
        - name: N0_ADDON_GROUPS
          value: "1"
        - name: N0_MONITOR_LOG_OUTPUT
          value: elasticsearch-rollover
        - name: N0_SERVICE_TYPE
          value: ADDONS
        - name: N0_LOCATION-CLUSTER-SERVICE
        - name: N0_ADDON_ID
          value: n92cd743acded41a086688961d0f3bb98
        - name: N0_MONITOR_LOG_OUTPUT_CONFIG
          value: '-'
        - name: N0_ADDON_GROUP_ID
          value: log-exporter
        - name: N0_ADDON_TYPE
          value: log-es
        - name: N0_BOOTSTRAP_SERVERS
          value: kafka-1.group-addon-monitor-kafka--hda994a5c4fbf4900ac0faed19989889a.svc.cluster.local:9092,kafka-2.group-addon-monitor-kafka--hda994a5c4fbf4900ac0faed19989889a.svc.cluster.local:9092,kafka-3.group-addon-monitor-kafka--hda994a5c4fbf4900ac0faed19989889a.svc.cluster.local:9092
        - name: N0_LOG_EXPORTER_ENABLE
          value: "true"
        - name: N0_DICE_ADDON_TYPE
          value: log-es
        - name: N0_MONITOR_LOG_COLLECTOR
          value: http://fc617427744324536a945430831b3a543.addon-monitor-collector--fc617427744324536a945430831b3a543.svc.cluster.local:7076/collect/logs/container
        - name: N0_ES_URLS
          value: http://log-elasticsearch-1-0.log-elasticsearch-1.group-addon-log-es--n92cd743acded41a086688961d0f3bb98.svc.cluster.local:9200,http://log-elasticsearch-2-0.log-elasticsearch-2.group-addon-log-es--n92cd743acded41a086688961d0f3bb98.svc.cluster.local:9200,http://log-elasticsearch-3-0.log-elasticsearch-3.group-addon-log-es--n92cd743acded41a086688961d0f3bb98.svc.cluster.local:9200
        - name: IS_K8S
          value: "true"
        - name: DICE_NAMESPACE
          value: group-addon-log-es--n92cd743acded41a086688961d0f3bb98
        - name: SELF_PORT
          value: "7096"
        - name: SELF_PORT0
          value: "7096"
        - name: SELF_PORT1
          value: "9200"
        - name: DICE_CPU_ORIGIN
          value: "0.2"
        - 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: POD_IP
          valueFrom:
            fieldRef:
              apiVersion: v1
              fieldPath: status.podIP
        - name: HOST_IP
          valueFrom:
            fieldRef:
              apiVersion: v1
              fieldPath: status.hostIP
        - name: SELF_HOST
          valueFrom:
            fieldRef:
              apiVersion: v1
              fieldPath: status.podIP
        image: registry.cn-hangzhou.aliyuncs.com/terminus/dice-loghub:3.20.0-20201210-8adca88
        imagePullPolicy: IfNotPresent
        livenessProbe:
          failureThreshold: 28
          periodSeconds: 15
          successThreshold: 1
          tcpSocket:
            port: 7096
          timeoutSeconds: 10
        name: log-exporter
        readinessProbe:
          failureThreshold: 3
          initialDelaySeconds: 10
          periodSeconds: 10
          successThreshold: 1
          tcpSocket:
            port: 7096
          timeoutSeconds: 10
        resources:
          limits:
            cpu: 1000m
            memory: 1Gi
          requests:
            cpu: 200m
            memory: 1Gi
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
      dnsPolicy: ClusterFirst
      enableServiceLinks: false
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      shareProcessNamespace: false
      terminationGracePeriodSeconds: 30
  updateStrategy:
    rollingUpdate:
      partition: 0
    type: RollingUpdate