apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: nvidia-mig-manager
  namespace: "FILLED BY THE OPERATOR"
  labels:
    app: nvidia-mig-manager
spec:
  selector:
    matchLabels:
      app: nvidia-mig-manager
  template:
    metadata:
      labels:
        app: nvidia-mig-manager
    spec:
      nodeSelector:
        nvidia.com/gpu.deploy.mig-manager: "true"
      tolerations:
        - key: nvidia.com/gpu
          operator: Exists
          effect: NoSchedule
      priorityClassName: system-node-critical
      serviceAccount: nvidia-mig-manager
      initContainers:
        - name: toolkit-validation
          image: "FILLED BY THE OPERATOR"
          command: ['sh', '-c']
          args: ["until [ -f /run/nvidia/validations/toolkit-ready ]; do echo waiting for nvidia container toolkit to be setup; sleep 5; done"]
          securityContext:
            privileged: true
          volumeMounts:
            - name: run-nvidia
              mountPath: /run/nvidia
              mountPropagation: HostToContainer
      containers:
      - name: nvidia-mig-manager
        image: "FILLED BY THE OPERATOR"
        imagePullPolicy: IfNotPresent
        env:
        - name: NODE_NAME
          valueFrom:
            fieldRef:
              fieldPath: spec.nodeName
        - name: CONFIG_FILE
          value: "/mig-parted-config/config.yaml"
        - name: WITH_REBOOT
          value: "false"
        - name: HOST_ROOT_MOUNT
          value: "/host"
        securityContext:
          privileged: true
        volumeMounts:
        - mountPath: /sys
          name: host-sys
        - mountPath: /mig-parted-config
          name: mig-parted-config
        - mountPath: /host
          name: host-root
          mountPropagation: HostToContainer
      volumes:
      - name: host-sys
        hostPath:
          path: /sys
          type: Directory
      - name: mig-parted-config
        configMap:
          name: "FILLED_BY_OPERATOR"
      - name: run-nvidia
        hostPath:
          path: "/run/nvidia"
          type: Directory
      - name: host-root
        hostPath:
          path: "/"
