# This config should be kept as similar as possible to the one at
# cluster/saltbase/salt/fluentd-gcp-gci/fluentd-gcp-gci.yaml
apiVersion: v1
kind: Pod
metadata:
  name: fluentd-cloud-logging
  namespace: kube-system
  labels:
    k8s-app: fluentd-logging
spec:
  dnsPolicy: Default
  containers:
  - name: fluentd-cloud-logging
    image: gcr.io/google_containers/fluentd-gcp:1.28.1
    resources:
      limits:
        memory: 200Mi
      requests:
        # Any change here should be accompanied by a proportional change in CPU
        # requests of other per-node add-ons (e.g. kube-proxy).
        cpu: 100m
        memory: 200Mi
    env:
    - name: FLUENTD_ARGS
      value: -q
    # Jemalloc is a widely used way to decrease memory consumption
    # in Ruby world. It's a better implementation of malloc(3).
    - name: "LD_PRELOAD"
      value: "/opt/td-agent/embedded/lib/libjemalloc.so"
    # This is quite hacky, but forces Ruby GC to be ivoked more often
    # resulting in lower memory consumption, which is important for us.
    - name: "RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR"
      value: "0.9"
    volumeMounts:
    - name: varlog
      mountPath: /var/log
    - name: varlibdockercontainers
      mountPath: /var/lib/docker/containers
      readOnly: true
  terminationGracePeriodSeconds: 30
  volumes:
  - name: varlog
    hostPath:
      path: /var/log
  - name: varlibdockercontainers
    hostPath:
      path: /var/lib/docker/containers

