---
apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: weave-scope-agent
  labels:
    name: weave-scope-agent
    app: weave-scope
    weave-cloud-component: scope
    weave-scope-component: agent
spec:
  minReadySeconds: 5
  selector:
    matchLabels:
      app: weave-scope
  template:
    metadata:
      labels:
        name: weave-scope-agent
        app: weave-scope
        weave-cloud-component: scope
        weave-scope-component: agent
    spec:
      containers:
      - name: scope-agent
        args:
        - '--mode=probe'
        - '--probe-only'
        - '--probe.kubernetes=true'
        - '--probe.kubernetes.role=host'
        - '--probe.cri=true'
        - '--probe.cri.endpoint=unix:///run/containerd/containerd.sock'
        - '--probe.docker=true'
        - '--probe.docker.bridge=docker0'
        - '--weave=false'
        - 'weave-scope-app.weave.svc.cluster.local.:80'
        image: weaveworks/scope:1.13.2
        imagePullPolicy: IfNotPresent
        resources:
          requests:
            cpu: 100m
            memory: 100Mi
        securityContext:
          privileged: true
        volumeMounts:
        - name: containerd-socket
          mountPath: /run/containerd/containerd.sock
        - name: docker-socket
          mountPath: /var/run/docker.sock
        - name: scope-plugins
          mountPath: /var/run/scope/plugins
        - name: sys-kernel-debug
          mountPath: /sys/kernel/debug
      dnsPolicy: ClusterFirstWithHostNet
      hostNetwork: true
      hostPID: true
      tolerations:
      - effect: NoSchedule
        operator: Exists
      volumes:
      - name: containerd-socket
        hostPath:
          # for MicroK8s's containerd
          path: /var/snap/microk8s/common/run/containerd.sock
      - name: docker-socket
        hostPath:
          # for official Docker distribution
          path: /var/run/docker.sock
      - name: scope-plugins
        hostPath:
          path: /var/run/scope/plugins
      - name: sys-kernel-debug
        hostPath:
          path: /sys/kernel/debug
  updateStrategy:
    rollingUpdate:
      maxUnavailable: 1
