apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: logmower-shipper
spec:
  updateStrategy:
    type: RollingUpdate
    rollingUpdate:
      maxUnavailable: 50%
  selector:
    matchLabels:
      app: logmower-shipper
  template:
    metadata:
      labels:
        app: logmower-shipper
    spec:
      serviceAccountName: logmower-shipper
      containers:
        - name: logmower-shipper
          image: harbor.k-space.ee/rasmus/logmower-shipper
          securityContext:
            runAsUser: 0
          env:
            - name: KUBE_NAMESPACE
              valueFrom:
                fieldRef:
                  fieldPath: metadata.namespace
            - name: KUBE_NODE_NAME
              valueFrom:
                fieldRef:
                  fieldPath: spec.nodeName
            - name: MONGODB_URI
              valueFrom:
                secretKeyRef:
                  name: mongodb-application-readwrite
                  key: connectionString.standard
          ports:
            - containerPort: 8000
              name: metrics
          resources:
            limits:
              memory: 200Mi
            requests:
              cpu: 100m
              memory: 100Mi
          volumeMounts:
            - name: etcmachineid
              mountPath: /etc/machine-id
              readOnly: true
            - name: varlibdockercontainers
              mountPath: /var/lib/docker/containers
              readOnly: true
            - name: varlog
              mountPath: /var/log
              readOnly: true
      volumes:
        - name: etcmachineid
          hostPath:
            path: /etc/machine-id
        - name: varlibdockercontainers
          hostPath:
            path: /var/lib/docker/containers
        - name: varlog
          hostPath:
            path: /var/log
      tolerations:
        - operator: "Exists"
          effect: "NoSchedule"
---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: logmower-shipper
  labels:
    app: logmower-shipper
