apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: azure-cni
  namespace: kube-system
  labels:
    app: azure-cni
spec:
  selector:
    matchLabels:
      k8s-app: azure-cni
  template:
    metadata:
      labels:
        k8s-app: azure-cni
      annotations:
        cluster-autoscaler.kubernetes.io/daemonset-pod: "true"
    spec:
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
            - matchExpressions:
              - key: type
                operator: NotIn
                values:
                - virtual-kubelet
              - key: kubernetes.io/os
                operator: In
                values:
                - linux
      priorityClassName: system-node-critical
      tolerations:
        - key: CriticalAddonsOnly
          operator: Exists
        - operator: "Exists"
          effect: NoExecute
        - operator: "Exists"
          effect: NoSchedule
      initContainers:
        - name: azure-cni
          image:  mcr.microsoft.com/containernetworking/azure-cni:v1.5.16
          imagePullPolicy: Always
          command: ["/dropgz"]
          args:
            - deploy
            - azure-vnet
            - -o
            - /opt/cni/bin/azure-vnet
            - azure-vnet-ipam
            - -o
            - /opt/cni/bin/azure-vnet-ipam
            - azure-vnet-telemetry
            - -o
            - /opt/cni/bin/azure-vnet-telemetry
            - azure.conflist
            - -o
            - /etc/cni/net.d/10-azure.conflist
          volumeMounts:
            - name: cni-bin
              mountPath: /opt/cni/bin
            - name: cni-conflist
              mountPath: /etc/cni/net.d
      containers:
        - name: pause
          image: mcr.microsoft.com/oss/kubernetes/pause:3.6
      hostNetwork: true
      volumes:
        - name: cni-conflist
          hostPath:
            path: /etc/cni/net.d
            type: Directory
        - name: cni-bin
          hostPath:
            path: /opt/cni/bin
            type: Directory
