---
apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: kube-cni-plugins-ds-amd64
  namespace: kube-system
  labels:
    tier: node
    app: cni-plugins
spec:
  selector:
    matchLabels:
      tier: node
      app: cni-plugins
  template:
    metadata:
      labels:
        tier: node
        app: cni-plugins
    spec:
      hostNetwork: true
      nodeSelector:
        beta.kubernetes.io/arch: amd64
      tolerations:
      - key: node-role.kubernetes.io/master
        operator: Exists
        effect: NoSchedule
      containers:
      - name: cni-plugins
        image: quay.io/kubevirt/cni-default-plugins:v0.8.6
        imagePullPolicy: IfNotPresent
        command:
          - /bin/bash
          - -c
          - |
            cp -rf /usr/src/containernetworking/plugins/bin/*bridge /opt/cni/bin/
            cp -rf /usr/src/containernetworking/plugins/bin/*tuning /opt/cni/bin/
            # Some projects (e.g. openshift/console) use cnv- prefix to distinguish between
            # binaries shipped by OpenShift and those shipped by KubeVirt (D/S matters).
            # Following two lines make sure we will provide both names when needed.
            find /opt/cni/bin/cnv-bridge || ln -s /opt/cni/bin/bridge /opt/cni/bin/cnv-bridge
            find /opt/cni/bin/cnv-tuning || ln -s /opt/cni/bin/tuning /opt/cni/bin/cnv-tuning
            echo "Entering sleep... (success)"
            sleep infinity
        resources:
          requests:
            cpu: "100m"
            memory: "50Mi"
          limits:
            cpu: "100m"
            memory: "50Mi"
        securityContext:
          privileged: true
        volumeMounts:
        - name: cnibin
          mountPath: /opt/cni/bin
      volumes:
      - name: cnibin
        hostPath:
          path: /opt/cni/bin
