---
kind: DaemonSet
apiVersion: apps/v1
metadata:
  name: sriov-network-config-daemon
  namespace: {{.Namespace}}
  annotations:
    release.openshift.io/version: "{{.ReleaseVersion}}"
spec:
  selector:
    matchLabels:
      app: sriov-network-config-daemon
  updateStrategy:
    type: RollingUpdate
    rollingUpdate:
      maxUnavailable: 33%
  template:
    metadata:
      annotations:
        target.workload.openshift.io/management: '{"effect": "PreferredDuringScheduling"}'
      labels:
        app: sriov-network-config-daemon
        component: network
        type: infra
        openshift.io/component: network
    spec:
      hostNetwork: true
      hostPID: true
      nodeSelector:
        beta.kubernetes.io/os: linux
        node-role.kubernetes.io/worker:
      tolerations:
      - operator: Exists
      serviceAccountName: sriov-network-config-daemon
      containers:
      - name: sriov-network-config-daemon
        image: {{.Image}}
        command:
          - sriov-network-config-daemon
        imagePullPolicy: IfNotPresent
        securityContext:
          privileged: true
        args:
          - "start"
        env:
          - name: NODE_NAME
            valueFrom:
              fieldRef:
                fieldPath: spec.nodeName
          - name: NAMESPACE
            valueFrom:
              fieldRef:
                fieldPath: metadata.namespace
          - name: CLUSTER_TYPE
            value: "{{.ClusterType}}"
        volumeMounts:
        - name: host
          mountPath: /host
        lifecycle:
          preStop:
            exec:
              command: ["/bindata/scripts/clean-k8s-services.sh"]
      volumes:
      - name: host
        hostPath:
          path: /
