---
apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: sysdig-daemonset
  labels:
    app: sysdig-example
    role: security
spec:
  selector:
    matchLabels:
      app: sysdig-example
      role: security
  template:
    metadata:
      labels:
        app: sysdig-example
        role: security
    spec:
      serviceAccount: sysdig-account
      containers:
      - name: sysdig
        image: sysdig/sysdig:latest
        securityContext:
          privileged: true
        # Uncomment the 3 lines below to enable eBPF support for Sysdig.
        # This allows Sysdig to run on Google COS.
        # Leave blank for the default probe location, or set to the path
        # of a precompiled probe.
        # env:
        # - name: SYSDIG_BPF_PROBE
        #   value: ""
        args:
        - bash
        - -c
        - |
          echo 'Starting bash...'
          tail -f /dev/null
        volumeMounts:
        # - mountPath: /host/var/run/docker.sock
        #   name: docker-socket
        - mountPath: /host/run/containerd/containerd.sock
          name: containerd-socket
        - mountPath: /host/dev
          name: dev-fs
          readOnly: true
        - mountPath: /host/proc
          name: proc-fs
          readOnly: true
        - mountPath: /host/boot
          name: boot-fs
          readOnly: true
        - mountPath: /host/lib/modules
          name: lib-modules
          readOnly: true
        - mountPath: /host/usr
          name: usr-fs
          readOnly: true
        - mountPath: /host/etc/
          name: etc-fs
          readOnly: true
        - mountPath: /captures
          name: captures-fs
      volumes:
      # - name: docker-socket
      #   hostPath:
      #     path: /var/run/docker.sock
      - name: containerd-socket
        hostPath:
          #path: /run/containerd/containerd.sock
          path: /var/snap/microk8s/common/run/containerd.sock
      - name: dev-fs
        hostPath:
          path: /dev
      - name: proc-fs
        hostPath:
          path: /proc
      - name: boot-fs
        hostPath:
          path: /boot
      - name: lib-modules
        hostPath:
          path: /lib/modules
      - name: usr-fs
        hostPath:
          path: /usr
      - name: etc-fs
        hostPath:
          path: /etc
      - name: captures-fs
        hostPath:
          path: /opt/sysdig/captures
