kind: Deployment
apiVersion: apps/v1
metadata:
  name: fluentbit-operator
  namespace: kubesphere-logging-system
  labels:
    app.kubernetes.io/component: operator
    app.kubernetes.io/name: fluentbit-operator
spec:
  selector:
    matchLabels:
      app.kubernetes.io/component: operator
      app.kubernetes.io/name: fluentbit-operator
  template:
    metadata:
      labels:
        app.kubernetes.io/component: operator
        app.kubernetes.io/name: fluentbit-operator
    spec:
      volumes:
        - name: env
          emptyDir: {}
        - name: containerdsock
          hostPath:
            path: /var/run/containerd/containerd.sock
        - name: crictl
          hostPath:
            path: /usr/local/bin/crictl
      initContainers:
        - name: setenv
          image: docker:19.03
          command:
            - /bin/sh
            - '-c'
            - set -ex;
              echo CONTAINER_ROOT_DIR=$(crictl info --output go-template --template '{{`{{.config.containerdRootDir}}`}}') > /fluentbit-operator/fluent-bit.env
          volumeMounts:
            - name: env
              mountPath: /fluentbit-operator
            - name: containerdsock
              readOnly: true
              mountPath: /var/run/containerd/containerd.sock
            - name: crictl
              readOnly: true
              mountPath: /usr/local/bin/crictl
          resources:
            requests:
              cpu: 100m
              memory: 20Mi
      containers:
      - name: fluentbit-operator
        image: 'kubesphere/fluentbit-operator:latest'
        resources:
          limits:
            cpu: 100m
            memory: 30Mi
          requests:
            cpu: 100m
            memory: 20Mi
        volumeMounts:
        - name: env
          mountPath: /fluentbit-operator
      serviceAccountName: fluentbit-operator
