###################################
# Copied from https://github.com/kubernetes/kubernetes/blob/f85649c6cd203263cead3098f7a11137852a9277/cluster/addons/fluentd-gcp/fluentd-gcp-ds.yaml
# Modifications:
# - changed namespace to `default`
# - changed apiVersion to apps/v1
# - removed `-q` to change log level to INFO
# - removed all the default parameters
# - removed liveness probe
# - removed the prometheus-to-sd-exporter container
# - removed the scheduling annotations, selectors & tolerations
# - removed `terminationGracePeriodSeconds: 30`
# - modified the path to local libs (/usr/lib) because it's different on MIR
# - set the fluentd-gcp-config volume mode to 420
#
# License: Apache 2.0
# https://github.com/kubernetes/kubernetes/blob/master/LICENSE
apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: fluentd-gcp-v2.0.10
  namespace: default
  labels:
    k8s-app: fluentd-gcp
    version: v2.0.10
spec:
  selector:
    matchLabels:
      k8s-app: fluentd-gcp
      version: v2.0.10
  template:
    metadata:
      labels:
        k8s-app: fluentd-gcp
        version: v2.0.10
    spec:
      containers:
      - name: fluentd-gcp
        image: gcr.io/google-containers/fluentd-gcp:2.0.10
        env:
        - name: FLUENTD_ARGS
          value: --no-supervisor
        resources:
          limits:
            memory: 300Mi
          requests:
            cpu: 100m
            memory: 200Mi
        volumeMounts:
        - mountPath: /var/log
          name: varlog
        - mountPath: /var/lib/docker/containers
          name: varlibdockercontainers
          readOnly: true
        - mountPath: /host/lib
          name: libsystemddir
          readOnly: true
        - mountPath: /etc/fluent/config.d
          name: config-volume
      volumes:
      - name: varlog
        hostPath:
          path: /var/log
      - name: varlibdockercontainers
        hostPath:
          path: /var/lib/docker/containers
      - name: libsystemddir
        hostPath:
          path: /usr/lib
      - name: config-volume
        configMap:
          name: fluentd-gcp-config-v1.2.3
          defaultMode: 420
