apiVersion: apps/v1
kind: DaemonSet
metadata:
  labels:
    app.kubernetes.io/component: kubevirt
    app.kubernetes.io/managed-by: virt-operator
    app.kubernetes.io/version: v1.0.1
    kubevirt.io: virt-handler
  name: virt-handler
  namespace: "{{ namespace }}"
spec:
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      kubevirt.io: virt-handler
  template:
    metadata:
      labels:
        app.kubernetes.io/component: kubevirt
        app.kubernetes.io/managed-by: virt-operator
        app.kubernetes.io/version: v1.0.1
        kubevirt.io: virt-handler
        prometheus.kubevirt.io: "true"
      name: virt-handler
    spec:
      containers:
        - args:
            - --port
            - "8443"
            - --hostname-override
            - $(NODE_NAME)
            - --pod-ip-address
            - $(MY_POD_IP)
            - --max-metric-requests
            - "3"
            - --console-server-port
            - "8186"
            - --graceful-shutdown-seconds
            - "315"
            - -v
            - "2"
          command:
            - virt-handler
          env:
            - name: NODE_NAME
              valueFrom:
                fieldRef:
                  apiVersion: v1
                  fieldPath: spec.nodeName
            - name: MY_POD_IP
              valueFrom:
                fieldRef:
                  apiVersion: v1
                  fieldPath: status.podIP
          image: quay.io/kubevirt/virt-handler@sha256:138dfda5fea8622f3da0d6413fe214fef80c2fd6a6f9533592a0dbfa7e1865b5
          imagePullPolicy: IfNotPresent
          livenessProbe:
            failureThreshold: 3
            httpGet:
              path: /healthz
              port: 8443
              scheme: HTTPS
            initialDelaySeconds: 15
            periodSeconds: 45
            successThreshold: 1
            timeoutSeconds: 10
          name: virt-handler
          ports:
            - containerPort: 8443
              name: metrics
              protocol: TCP
          readinessProbe:
            failureThreshold: 3
            httpGet:
              path: /healthz
              port: 8443
              scheme: HTTPS
            initialDelaySeconds: 15
            periodSeconds: 20
            successThreshold: 1
            timeoutSeconds: 10
          resources:
            requests:
              cpu: 10m
              memory: 325Mi
          securityContext:
            privileged: true
            seLinuxOptions:
              level: s0
          terminationMessagePath: /dev/termination-log
          terminationMessagePolicy: File
          volumeMounts:
            - mountPath: /etc/virt-handler/clientcertificates
              name: kubevirt-virt-handler-certs
              readOnly: true
            - mountPath: /etc/virt-handler/servercertificates
              name: kubevirt-virt-handler-server-certs
              readOnly: true
            - mountPath: /profile-data
              name: profile-data
            - mountPath: /var/run/kubevirt-libvirt-runtimes
              name: libvirt-runtimes
            - mountPath: /var/run/kubevirt
              mountPropagation: Bidirectional
              name: virt-share-dir
            - mountPath: /var/lib/kubevirt
              name: virt-lib-dir
            - mountPath: /var/run/kubevirt-private
              name: virt-private-dir
            - mountPath: /var/lib/kubelet/device-plugins
              name: device-plugin
            - mountPath: /pods
              name: kubelet-pods-shortened
            - mountPath: /var/lib/kubelet/pods
              mountPropagation: Bidirectional
              name: kubelet-pods
            - mountPath: /var/lib/kubevirt-node-labeller
              name: node-labeller
            - mountPath: /etc/podinfo
              name: podinfo
      dnsPolicy: ClusterFirst
      hostPID: true
      initContainers:
        - args:
            - node-labeller.sh
          command:
            - /bin/sh
            - -c
          image: quay.io/kubevirt/virt-launcher@sha256:4c5fce3de2e2589197de72fb0c9436490ea318aca952c05a622c43e067023f35
          imagePullPolicy: IfNotPresent
          name: virt-launcher
          resources: {}
          securityContext:
            privileged: true
          terminationMessagePath: /dev/termination-log
          terminationMessagePolicy: File
          volumeMounts:
            - mountPath: /var/lib/kubevirt-node-labeller
              name: node-labeller
      nodeSelector:
        kubernetes.io/os: linux
      priorityClassName: kubevirt-cluster-critical
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      serviceAccount: kubevirt-handler
      serviceAccountName: kubevirt-handler
      terminationGracePeriodSeconds: 30
      tolerations:
        - key: CriticalAddonsOnly
          operator: Exists
      volumes:
        - name: kubevirt-virt-handler-certs
          secret:
            defaultMode: 420
            optional: true
            secretName: kubevirt-virt-handler-certs
        - name: kubevirt-virt-handler-server-certs
          secret:
            defaultMode: 420
            optional: true
            secretName: kubevirt-virt-handler-server-certs
        - emptyDir: {}
          name: profile-data
        - hostPath:
            path: /var/run/kubevirt-libvirt-runtimes
            type: ""
          name: libvirt-runtimes
        - hostPath:
            path: /var/run/kubevirt
            type: ""
          name: virt-share-dir
        - hostPath:
            path: /var/lib/kubevirt
            type: ""
          name: virt-lib-dir
        - hostPath:
            path: /var/run/kubevirt-private
            type: ""
          name: virt-private-dir
        - hostPath:
            path: /var/lib/kubelet/device-plugins
            type: ""
          name: device-plugin
        - hostPath:
            path: /var/lib/kubelet/pods
            type: ""
          name: kubelet-pods-shortened
        - hostPath:
            path: /var/lib/kubelet/pods
            type: ""
          name: kubelet-pods
        - hostPath:
            path: /var/lib/kubevirt-node-labeller
            type: ""
          name: node-labeller
        - downwardAPI:
            defaultMode: 420
            items:
              - fieldRef:
                  apiVersion: v1
                  fieldPath: metadata.annotations['k8s.v1.cni.cncf.io/network-status']
                path: network-status
          name: podinfo
  updateStrategy:
    rollingUpdate:
      maxSurge: 0
      maxUnavailable: 1
    type: RollingUpdate