# borrowed from https://cloud.weave.works/k8s/scope.yaml?k8s-version=1.10.0
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
  namespace: weave
spec:
  minReadySeconds: 5
  template:
    metadata:
      labels:
        name: weave-scope-agent
        app: weave-scope
        weave-cloud-component: scope
        weave-scope-component: agent
    spec:
      containers:
        - name: scope-agent
          args:
            - '--no-app'
            - '--probe.docker=false'
            - '--probe.kubernetes=true'
            - '--probe.cri=true'
            - '--probe.cri.endpoint=unix:///var/run/crio/crio.sock'
            - 'weave-scope-app.weave.svc.cluster.local.:80'
          env:
            - name: KUBERNETES_NODENAME
              valueFrom:
                fieldRef:
                  apiVersion: v1
                  fieldPath: spec.nodeName
          image: weaveworks/scope:1.13.1
          imagePullPolicy: IfNotPresent
          securityContext:
            privileged: true
          volumeMounts:
            - name: cri-socket
              mountPath: /var/run/crio/crio.sock
            - name: scope-plugins
              mountPath: /var/run/scope/plugins
            - name: sys-kernel-debug
              mountPath: /sys/kernel/debug
      dnsPolicy: ClusterFirstWithHostNet
      hostNetwork: true
      hostPID: true
      serviceAccountName: weave-scope
      tolerations:
        - effect: NoSchedule
          operator: Exists
      volumes:
        - name: cri-socket
          hostPath:
            path: /var/run/crio/crio.sock
        - name: scope-plugins
          hostPath:
            path: /var/run/scope/plugins
        - name: sys-kernel-debug
          hostPath:
            path: /sys/kernel/debug
  updateStrategy:
    rollingUpdate:
      maxUnavailable: 1
