kind: Deployment
apiVersion: apps/v1
metadata:
  name: fluent-operator
  namespace: kubesphere-logging-system
  labels:
    app.kubernetes.io/component: operator
    app.kubernetes.io/name: fluent-operator
spec:
  selector:
    matchLabels:
      app.kubernetes.io/component: operator
      app.kubernetes.io/name: fluent-operator
  template:
    metadata:
      labels:
        app.kubernetes.io/component: operator
        app.kubernetes.io/name: fluent-operator
    spec:
      volumes:
      - name: env
        emptyDir: {}
      - name: dockersock
        hostPath:
          path: /var/run/docker.sock
      initContainers:
      - name: setenv
        image: 'docker:19.03'
        command:
        - /bin/sh
        - '-c'
        - set -ex;
          echo CONTAINER_ROOT_DIR=$(docker info -f '{{.DockerRootDir}}' 2> /dev/null) > /fluent-operator/fluent-bit.env
        volumeMounts:
        - name: env
          mountPath: /fluent-operator
        - name: dockersock
          readOnly: true
          mountPath: /var/run/docker.sock
      containers:
      - name: fluent-operator
        image: kubesphere/fluent-operator:latest
        env:
          - name: NAMESPACE
            valueFrom:
              fieldRef:
                apiVersion: v1
                fieldPath: metadata.namespace
        resources:
          limits:
            cpu: 200m
            memory: 60Mi
          requests:
            cpu: 100m
            memory: 20Mi
        volumeMounts:
        - name: env
          mountPath: /fluent-operator
      serviceAccountName: fluent-operator
