apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: wavefront-collector
  namespace: wavefront-collector
  labels:
    k8s-app: wavefront-collector
    name: wavefront-collector
spec:
  selector:
    matchLabels:
      k8s-app: wavefront-collector
  template:
    metadata:
      labels:
        k8s-app: wavefront-collector
      annotations:
        installation-method: manual
    spec:
      tolerations:
      - effect: NoSchedule
        key: node.alpha.kubernetes.io/role
        operator: Exists
      - effect: NoSchedule
        key: node-role.kubernetes.io/master
        operator: Exists

      serviceAccountName: wavefront-collector

      containers:
      - name: wavefront-collector
        image: projects.registry.vmware.com/tanzu_observability/kubernetes-collector:1.11.0
        imagePullPolicy: IfNotPresent
        command:
        - /wavefront-collector
        - --daemon=true
        - --config-file=/etc/collector/collector.yaml
        volumeMounts:
        - name: procfs
          mountPath: /host/proc
          readOnly: true
        - mountPath: /etc/collector/
          name: collector-config
          readOnly: true
        env:
        - name: HOST_PROC
          value: /host/proc
        - name: POD_NODE_NAME
          valueFrom:
            fieldRef:
              apiVersion: v1
              fieldPath: spec.nodeName
        - name: POD_NAMESPACE_NAME
          valueFrom:
            fieldRef:
              apiVersion: v1
              fieldPath: metadata.namespace
        - name: INSTALLATION_METHOD
          valueFrom:
            fieldRef:
              apiVersion: v1
              fieldPath: metadata.annotations['installation-method']
      volumes:
      - name: procfs
        hostPath:
          path: /proc
      - name: collector-config
        configMap:
          name: collector-config
