apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: lacework-agent
  labels:
    tier: monitoring
    app: lacework-agent
spec:
  selector:
    matchLabels:
      name: lacework
  updateStrategy:
    type: RollingUpdate
  template:
    metadata:
      labels:
        name: lacework
    spec:
      tolerations: 
        - key: node-role.kubernetes.io/master
          effect: NoSchedule
      terminationGracePeriodSeconds: 20
      hostPID: true
      hostNetwork: true
      serviceAccount: lacework
      serviceAccountName: lacework
      containers:
      - name: lacework
        image: lacework/datacollector
        imagePullPolicy: Always
        env:
          - name: LaceworkLogStdout
            value: "yes"
        resources:
          requests:
            cpu: "100m"
            memory: "512Mi"
        securityContext:
          privileged: true
        volumeMounts:
          - name: cfgmap
            mountPath: /var/lib/lacework/config
          - name: dev
            mountPath: /dev
          - name: run-sock
            mountPath: /var/run/docker.sock
          - name: run-pid
            mountPath: /var/run/docker.pid
          - name: sys
            mountPath: /sys
          - name: log
            mountPath: /var/log
          - name: passwd
            mountPath: /etc/passwd
            readOnly: true
          - name: group
            mountPath: /etc/group
            readOnly: true
          - name: hostlacework
            mountPath: /var/lib/lacework/collector
          - name: hostroot
            mountPath: /laceworkfim
            readOnly: true
          - name: podinfo
            mountPath: /etc/podinfo
      volumes:
        - name: dev
          hostPath:
              path: /dev
        - name: run-sock
          hostPath:
              path: /var/run/docker.sock
        - name: run-pid
          hostPath:
              path: /var/run/docker.pid
        - name: sys
          hostPath:
              path: /sys
        - name: log
          hostPath:
              path: /var/log
        - name: passwd
          hostPath:
              path: /etc/passwd
        - name: group
          hostPath:
              path: /etc/group
        - name: hostroot
          hostPath:
              path: /
        - name: hostlacework
          hostPath:
              path: /var/lib/lacework/collector
        - name: cfgmap
          configMap:
            name: lacework-config
            items:
            - key: config.json
              path: config.json
        - name: podinfo
          downwardAPI:
            items:
              - path: "labels"
                fieldRef:
                  fieldPath: metadata.labels
              - path: "annotations"
                fieldRef:
                  fieldPath: metadata.annotations
