# Kontaind contains all artifacts to run as daemonset on nodes that are running
# kontain. Combine the kvm device plugin and kontain installer into one
# package.
#
# The original device plugin is just for kvm. We adapted to include a step to
# install the necessary kontain components on the node.
# From kubernetes-device-plugins/manifests/kvm-ds.yml
# License: MIT

apiVersion: apps/v1
kind: DaemonSet
metadata:
  labels:
    name: kontaind
  name: kontaind
spec:
  selector:
    matchLabels:
      name: kontaind
  template:
    metadata:
      labels:
        name: kontaind
    spec:
      containers:
      - name: device-plugin-kvm
        image: DEVICE_PLUGIN_IMAGE()
        args: ["-v", "3", "-logtostderr"]
        securityContext:
          privileged: true
        volumeMounts:
          - name: device-plugin
            mountPath: /var/lib/kubelet/device-plugins
      initContainers:
      - name: kontain-installer
        image: INSTALLER_IMAGE()
        imagePullPolicy: Always
        securityContext:
          privileged: true
        volumeMounts:
          - name: install-path
            mountPath: /opt
          - name: kvm-device
            mountPath: /dev/kvm
      volumes:
        - name: device-plugin
          hostPath:
            path: /var/lib/kubelet/device-plugins
        - name: install-path
          hostPath:
            path: /opt
        - name: kvm-device
          hostPath:
            path: /dev/kvm
