# Copyright 2018 The Knative Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: fluent-bit
  namespace: knative-observability
  labels:
    app: fluent-bit
    version: v1
    logs: "true"
    safeToDelete: "true"
spec:
  updateStrategy:
    type: RollingUpdate
  selector:
    matchLabels:
      app: fluent-bit
      version: v1
  template:
    metadata:
      labels:
        app: fluent-bit
        version: v1
    spec:
      serviceAccountName: fluent-bit
      containers:
      - name: fluent-bit
        image: oratos/fluent-bit-out-syslog:v0.19
        imagePullPolicy: IfNotPresent
        ports:
        - name: forward-plugin
          containerPort: 24224
        readinessProbe:
          tcpSocket:
            port: 24224
          initialDelaySeconds: 2
          periodSeconds: 4
        resources:
          limits:
            memory: 100Mi
          requests:
            cpu: 100m
            memory: 100Mi
        volumeMounts:
        - name: fluent-bit-config
          mountPath: /fluent-bit/etc
        - name: varlog
          mountPath: /var/log
        - name: varlibdockercontainers
          mountPath: /var/lib/docker/containers
          readOnly: true
        - name: varvcapstore
          mountPath: /var/vcap/store
          readOnly: true
        - name: varvcapdata
          mountPath: /var/vcap/data
          readOnly: true
      terminationGracePeriodSeconds: 10
      volumes:
      - name: varlog
        hostPath:
          path: /var/log
      - name: varlibdockercontainers
        hostPath:
          path: /var/lib/docker/containers
      - name: varvcapstore
        hostPath:
          path: /var/vcap/store/
      - name: varvcapdata
        hostPath:
          path: /var/vcap/data/
      - name: fluent-bit-config
        configMap:
          name: fluent-bit
