apiVersion: nvidia.com/v1
kind: ClusterPolicy
metadata:
  name: cluster-policy
  labels:
    {{- include "gpu-operator.labels" . | nindent 4 }}
    app.kubernetes.io/component: "gpu-operator"
  {{- if .Values.operator.cleanupCRD }}
  # CR cleanup is handled during pre-delete hook
  # Add below annotation so that helm doesn't attempt to cleanup CR twice
  annotations:
    "helm.sh/resource-policy": keep
  {{- end }}
spec:
  hostPaths:
    rootFS: {{ .Values.hostPaths.rootFS }}
    driverInstallDir: {{ .Values.hostPaths.driverInstallDir }}
  operator:
    {{- if .Values.operator.runtimeClass }}
    runtimeClass: {{ .Values.operator.runtimeClass }}
    {{- end }}
    {{- if .Values.operator.defaultGPUMode }}
    defaultGPUMode: {{ .Values.operator.defaultGPUMode }}
    {{- end }}
    {{- if .Values.operator.initContainer }}
    initContainer:
      {{- if .Values.operator.initContainer.repository }}
      repository: {{ .Values.operator.initContainer.repository }}
      {{- end }}
      {{- if .Values.operator.initContainer.image }}
      image: {{ .Values.operator.initContainer.image }}
      {{- end }}
      {{- if .Values.operator.initContainer.version }}
      version: {{ .Values.operator.initContainer.version | quote }}
      {{- end }}
      {{- if .Values.operator.initContainer.imagePullPolicy }}
      imagePullPolicy: {{ .Values.operator.initContainer.imagePullPolicy }}
      {{- end }}
      {{- if .Values.operator.initContainer.imagePullSecrets }}
      imagePullSecrets: {{ toYaml .Values.operator.initContainer.imagePullSecrets | nindent 8 }}
      {{- end }}
    {{- end }}
    {{- if .Values.operator.use_ocp_driver_toolkit }}
    use_ocp_driver_toolkit: {{ .Values.operator.use_ocp_driver_toolkit }}
    {{- end }}
  daemonsets:
    labels:
      {{- include "gpu-operator.operand-labels" . | nindent 6 }}
    {{- if .Values.daemonsets.annotations }}
    annotations: {{ toYaml .Values.daemonsets.annotations | nindent 6 }}
    {{- end }}
    {{- if .Values.daemonsets.tolerations }}
    tolerations: {{ toYaml .Values.daemonsets.tolerations | nindent 6 }}
    {{- end }}
    {{- if .Values.daemonsets.priorityClassName }}
    priorityClassName: {{ .Values.daemonsets.priorityClassName }}
    {{- end }}
    {{- if .Values.daemonsets.updateStrategy }}
    updateStrategy: {{ .Values.daemonsets.updateStrategy }}
    {{- end }}
    {{- if .Values.daemonsets.rollingUpdate }}
    rollingUpdate:
      maxUnavailable: {{ .Values.daemonsets.rollingUpdate.maxUnavailable | quote }}
    {{- end }}
  validator:
    {{- if .Values.validator.repository }}
    repository: {{ .Values.validator.repository }}
    {{- end }}
    {{- if .Values.validator.image }}
    image: {{ .Values.validator.image }}
    {{- end }}
    version: {{ .Values.validator.version | default .Chart.AppVersion | quote }}
    {{- if .Values.validator.imagePullPolicy }}
    imagePullPolicy: {{ .Values.validator.imagePullPolicy }}
    {{- end }}
    {{- if .Values.validator.imagePullSecrets }}
    imagePullSecrets: {{ toYaml .Values.validator.imagePullSecrets | nindent 8 }}
    {{- end }}
    {{- if .Values.validator.resources }}
    resources: {{ toYaml .Values.validator.resources | nindent 6 }}
    {{- end }}
    {{- if .Values.validator.env }}
    env: {{ toYaml .Values.validator.env | nindent 6 }}
    {{- end }}
    {{- if .Values.validator.args }}
    args: {{ toYaml .Values.validator.args | nindent 6 }}
    {{- end }}
    {{- if .Values.validator.plugin }}
    plugin:
      {{- if .Values.validator.plugin.env }}
      env: {{ toYaml .Values.validator.plugin.env | nindent 8 }}
      {{- end }}
    {{- end }}
    {{- if .Values.validator.cuda }}
    cuda:
      {{- if .Values.validator.cuda.env }}
      env: {{ toYaml .Values.validator.cuda.env | nindent 8 }}
      {{- end }}
    {{- end }}
    {{- if .Values.validator.driver }}
    driver:
      {{- if .Values.validator.driver.env }}
      env: {{ toYaml .Values.validator.driver.env | nindent 8 }}
      {{- end }}
    {{- end }}
    {{- if .Values.validator.toolkit }}
    toolkit:
      {{- if .Values.validator.toolkit.env }}
      env: {{ toYaml .Values.validator.toolkit.env | nindent 8 }}
      {{- end }}
    {{- end }}
    {{- if .Values.validator.vfioPCI }}
    vfioPCI:
      {{- if .Values.validator.vfioPCI.env }}
      env: {{ toYaml .Values.validator.vfioPCI.env | nindent 8 }}
      {{- end }}
    {{- end }}
    {{- if .Values.validator.vgpuManager }}
    vgpuManager:
      {{- if .Values.validator.vgpuManager.env }}
      env: {{ toYaml .Values.validator.vgpuManager.env | nindent 8 }}
      {{- end }}
    {{- end }}
    {{- if .Values.validator.vgpuDevices }}
    vgpuDevices:
      {{- if .Values.validator.vgpuDevices.env }}
      env: {{ toYaml .Values.validator.vgpuDevices.env | nindent 8 }}
      {{- end }}
    {{- end }}

  mig:
    {{- if .Values.mig.strategy }}
    strategy: {{ .Values.mig.strategy }}
    {{- end }}
  psa:
    enabled: {{ .Values.psa.enabled }}
  cdi:
    enabled: {{ .Values.cdi.enabled }}
    default: {{ .Values.cdi.default }}
  driver:
    enabled: {{ .Values.driver.enabled }}
    useNvidiaDriverCRD: {{ .Values.driver.nvidiaDriverCRD.enabled }}
    kernelModuleType: {{ .Values.driver.kernelModuleType }}
    usePrecompiled: {{ .Values.driver.usePrecompiled }}
    {{- if .Values.driver.repository }}
    repository: {{ .Values.driver.repository }}
    {{- end }}
    {{- if .Values.driver.image }}
    image: {{ .Values.driver.image }}
    {{- end }}
    {{- if .Values.driver.version }}
    version: {{ .Values.driver.version | quote }}
    {{- end }}
    {{- if .Values.driver.imagePullPolicy }}
    imagePullPolicy: {{ .Values.driver.imagePullPolicy }}
    {{- end }}
    {{- if .Values.driver.imagePullSecrets }}
    imagePullSecrets: {{ toYaml .Values.driver.imagePullSecrets | nindent 6 }}
    {{- end }}
    {{- if .Values.driver.startupProbe }}
    startupProbe: {{ toYaml .Values.driver.startupProbe | nindent 6 }}
    {{- end }}
    {{- if .Values.driver.livenessProbe }}
    livenessProbe: {{ toYaml .Values.driver.livenessProbe | nindent 6 }}
    {{- end }}
    {{- if .Values.driver.readinessProbe }}
    readinessProbe: {{ toYaml .Values.driver.readinessProbe | nindent 6 }}
    {{- end }}
    rdma:
      enabled: {{ .Values.driver.rdma.enabled }}
      useHostMofed: {{ .Values.driver.rdma.useHostMofed }}
    manager:
      {{- if .Values.driver.manager.repository }}
      repository: {{ .Values.driver.manager.repository }}
      {{- end }}
      {{- if .Values.driver.manager.image }}
      image: {{ .Values.driver.manager.image }}
      {{- end }}
      {{- if .Values.driver.manager.version }}
      version: {{ .Values.driver.manager.version | quote }}
      {{- end }}
      {{- if .Values.driver.manager.imagePullPolicy }}
      imagePullPolicy: {{ .Values.driver.manager.imagePullPolicy }}
      {{- end }}
      {{- if .Values.driver.manager.env }}
      env: {{ toYaml .Values.driver.manager.env | nindent 8 }}
      {{- end }}
    {{- if .Values.driver.repoConfig }}
    repoConfig: {{ toYaml .Values.driver.repoConfig | nindent 6 }}
    {{- end }}
    {{- if .Values.driver.certConfig }}
    certConfig: {{ toYaml .Values.driver.certConfig | nindent 6 }}
    {{- end }}
    {{- if .Values.driver.licensingConfig }}
    licensingConfig: {{ toYaml .Values.driver.licensingConfig | nindent 6 }}
    {{- end }}
    {{- if .Values.driver.virtualTopology }}
    virtualTopology: {{ toYaml .Values.driver.virtualTopology | nindent 6 }}
    {{- end }}
    {{- if .Values.driver.kernelModuleConfig }}
    kernelModuleConfig: {{ toYaml .Values.driver.kernelModuleConfig | nindent 6 }}
    {{- end }}
    {{- if .Values.driver.resources }}
    resources: {{ toYaml .Values.driver.resources | nindent 6 }}
    {{- end }}
    {{- if .Values.driver.env }}
    env: {{ toYaml .Values.driver.env | nindent 6 }}
    {{- end }}
    {{- if .Values.driver.args }}
    args: {{ toYaml .Values.driver.args | nindent 6 }}
    {{- end }}
    {{- if .Values.driver.upgradePolicy }}
    upgradePolicy:
      autoUpgrade: {{ .Values.driver.upgradePolicy.autoUpgrade | default false }}
      maxParallelUpgrades: {{ .Values.driver.upgradePolicy.maxParallelUpgrades | default 0 }}
      maxUnavailable : {{ .Values.driver.upgradePolicy.maxUnavailable | default "25%" }}
      waitForCompletion:
        timeoutSeconds: {{ .Values.driver.upgradePolicy.waitForCompletion.timeoutSeconds }}
        {{- if .Values.driver.upgradePolicy.waitForCompletion.podSelector }}
        podSelector: {{ .Values.driver.upgradePolicy.waitForCompletion.podSelector }}
        {{- end }}
      podDeletion:
        force: {{ .Values.driver.upgradePolicy.gpuPodDeletion.force | default false }}
        timeoutSeconds: {{ .Values.driver.upgradePolicy.gpuPodDeletion.timeoutSeconds }}
        deleteEmptyDir: {{ .Values.driver.upgradePolicy.gpuPodDeletion.deleteEmptyDir | default false }}
      drain:
        enable: {{ .Values.driver.upgradePolicy.drain.enable | default false }}
        force: {{ .Values.driver.upgradePolicy.drain.force | default false }}
        {{- if .Values.driver.upgradePolicy.drain.podSelector }}
        podSelector: {{ .Values.driver.upgradePolicy.drain.podSelector }}
        {{- end }}
        timeoutSeconds: {{ .Values.driver.upgradePolicy.drain.timeoutSeconds }}
        deleteEmptyDir: {{ .Values.driver.upgradePolicy.drain.deleteEmptyDir | default false}}
    {{- end }}
  vgpuManager:
    enabled: {{ .Values.vgpuManager.enabled }}
    {{- if .Values.vgpuManager.repository }}
    repository: {{ .Values.vgpuManager.repository }}
    {{- end }}
    {{- if .Values.vgpuManager.image }}
    image: {{ .Values.vgpuManager.image }}
    {{- end }}
    {{- if .Values.vgpuManager.version }}
    version: {{ .Values.vgpuManager.version | quote }}
    {{- end }}
    {{- if .Values.vgpuManager.imagePullPolicy }}
    imagePullPolicy: {{ .Values.vgpuManager.imagePullPolicy }}
    {{- end }}
    {{- if .Values.vgpuManager.imagePullSecrets }}
    imagePullSecrets: {{ toYaml .Values.vgpuManager.imagePullSecrets | nindent 6 }}
    {{- end }}
    {{- if .Values.vgpuManager.resources }}
    resources: {{ toYaml .Values.vgpuManager.resources | nindent 6 }}
    {{- end }}
    {{- if .Values.vgpuManager.env }}
    env: {{ toYaml .Values.vgpuManager.env | nindent 6 }}
    {{- end }}
    {{- if .Values.vgpuManager.args }}
    args: {{ toYaml .Values.vgpuManager.args | nindent 6 }}
    {{- end }}
    driverManager:
      {{- if .Values.vgpuManager.driverManager.repository }}
      repository: {{ .Values.vgpuManager.driverManager.repository }}
      {{- end }}
      {{- if .Values.vgpuManager.driverManager.image }}
      image: {{ .Values.vgpuManager.driverManager.image }}
      {{- end }}
      {{- if .Values.vgpuManager.driverManager.version }}
      version: {{ .Values.vgpuManager.driverManager.version | quote }}
      {{- end }}
      {{- if .Values.vgpuManager.driverManager.imagePullPolicy }}
      imagePullPolicy: {{ .Values.vgpuManager.driverManager.imagePullPolicy }}
      {{- end }}
      {{- if .Values.vgpuManager.driverManager.env }}
      env: {{ toYaml .Values.vgpuManager.driverManager.env | nindent 8 }}
      {{- end }}
  kataManager:
    enabled: {{ .Values.kataManager.enabled }}
    config: {{ toYaml .Values.kataManager.config | nindent 6 }}
    {{- if .Values.kataManager.repository }}
    repository: {{ .Values.kataManager.repository }}
    {{- end }}
    {{- if .Values.kataManager.image }}
    image: {{ .Values.kataManager.image }}
    {{- end }}
    {{- if .Values.kataManager.version }}
    version: {{ .Values.kataManager.version | quote }}
    {{- end }}
    {{- if .Values.kataManager.imagePullPolicy }}
    imagePullPolicy: {{ .Values.kataManager.imagePullPolicy }}
    {{- end }}
    {{- if .Values.kataManager.imagePullSecrets }}
    imagePullSecrets: {{ toYaml .Values.kataManager.imagePullSecrets | nindent 6 }}
    {{- end }}
    {{- if .Values.kataManager.resources }}
    resources: {{ toYaml .Values.kataManager.resources | nindent 6 }}
    {{- end }}
    {{- if .Values.kataManager.env }}
    env: {{ toYaml .Values.kataManager.env | nindent 6 }}
    {{- end }}
    {{- if .Values.kataManager.args }}
    args: {{ toYaml .Values.kataManager.args | nindent 6 }}
    {{- end }}
  vfioManager:
    enabled: {{ .Values.vfioManager.enabled }}
    {{- if .Values.vfioManager.repository }}
    repository: {{ .Values.vfioManager.repository }}
    {{- end }}
    {{- if .Values.vfioManager.image }}
    image: {{ .Values.vfioManager.image }}
    {{- end }}
    {{- if .Values.vfioManager.version }}
    version: {{ .Values.vfioManager.version | quote }}
    {{- end }}
    {{- if .Values.vfioManager.imagePullPolicy }}
    imagePullPolicy: {{ .Values.vfioManager.imagePullPolicy }}
    {{- end }}
    {{- if .Values.vfioManager.imagePullSecrets }}
    imagePullSecrets: {{ toYaml .Values.vfioManager.imagePullSecrets | nindent 6 }}
    {{- end }}
    {{- if .Values.vfioManager.resources }}
    resources: {{ toYaml .Values.vfioManager.resources | nindent 6 }}
    {{- end }}
    {{- if .Values.vfioManager.env }}
    env: {{ toYaml .Values.vfioManager.env | nindent 6 }}
    {{- end }}
    {{- if .Values.vfioManager.args }}
    args: {{ toYaml .Values.vfioManager.args | nindent 6 }}
    {{- end }}
    driverManager:
      {{- if .Values.vfioManager.driverManager.repository }}
      repository: {{ .Values.vfioManager.driverManager.repository }}
      {{- end }}
      {{- if .Values.vfioManager.driverManager.image }}
      image: {{ .Values.vfioManager.driverManager.image }}
      {{- end }}
      {{- if .Values.vfioManager.driverManager.version }}
      version: {{ .Values.vfioManager.driverManager.version | quote }}
      {{- end }}
      {{- if .Values.vfioManager.driverManager.imagePullPolicy }}
      imagePullPolicy: {{ .Values.vfioManager.driverManager.imagePullPolicy }}
      {{- end }}
      {{- if .Values.vfioManager.driverManager.env }}
      env: {{ toYaml .Values.vfioManager.driverManager.env | nindent 8 }}
      {{- end }}
  vgpuDeviceManager:
    enabled: {{ .Values.vgpuDeviceManager.enabled }}
    {{- if .Values.vgpuDeviceManager.repository }}
    repository: {{ .Values.vgpuDeviceManager.repository }}
    {{- end }}
    {{- if .Values.vgpuDeviceManager.image }}
    image: {{ .Values.vgpuDeviceManager.image }}
    {{- end }}
    {{- if .Values.vgpuDeviceManager.version }}
    version: {{ .Values.vgpuDeviceManager.version | quote }}
    {{- end }}
    {{- if .Values.vgpuDeviceManager.imagePullPolicy }}
    imagePullPolicy: {{ .Values.vgpuDeviceManager.imagePullPolicy }}
    {{- end }}
    {{- if .Values.vgpuDeviceManager.imagePullSecrets }}
    imagePullSecrets: {{ toYaml .Values.vgpuDeviceManager.imagePullSecrets | nindent 6 }}
    {{- end }}
    {{- if .Values.vgpuDeviceManager.resources }}
    resources: {{ toYaml .Values.vgpuDeviceManager.resources | nindent 6 }}
    {{- end }}
    {{- if .Values.vgpuDeviceManager.env }}
    env: {{ toYaml .Values.vgpuDeviceManager.env | nindent 6 }}
    {{- end }}
    {{- if .Values.vgpuDeviceManager.args }}
    args: {{ toYaml .Values.vgpuDeviceManager.args | nindent 6 }}
    {{- end }}
    {{- if .Values.vgpuDeviceManager.config }}
    config: {{ toYaml .Values.vgpuDeviceManager.config | nindent 6 }}
    {{- end  }}
  ccManager:
    enabled: {{ .Values.ccManager.enabled }}
    defaultMode: {{ .Values.ccManager.defaultMode | quote }}
    {{- if .Values.ccManager.repository }}
    repository: {{ .Values.ccManager.repository }}
    {{- end }}
    {{- if .Values.ccManager.image }}
    image: {{ .Values.ccManager.image }}
    {{- end }}
    {{- if .Values.ccManager.version }}
    version: {{ .Values.ccManager.version | quote }}
    {{- end }}
    {{- if .Values.ccManager.imagePullPolicy }}
    imagePullPolicy: {{ .Values.ccManager.imagePullPolicy }}
    {{- end }}
    {{- if .Values.ccManager.imagePullSecrets }}
    imagePullSecrets: {{ toYaml .Values.ccManager.imagePullSecrets | nindent 6 }}
    {{- end }}
    {{- if .Values.ccManager.resources }}
    resources: {{ toYaml .Values.ccManager.resources | nindent 6 }}
    {{- end }}
    {{- if .Values.ccManager.env }}
    env: {{ toYaml .Values.vfioManager.env | nindent 6 }}
    {{- end }}
    {{- if .Values.ccManager.args }}
    args: {{ toYaml .Values.ccManager.args | nindent 6 }}
    {{- end }}
  toolkit:
    enabled: {{ .Values.toolkit.enabled }}
    {{- if .Values.toolkit.repository }}
    repository: {{ .Values.toolkit.repository }}
    {{- end }}
    {{- if .Values.toolkit.image }}
    image: {{ .Values.toolkit.image }}
    {{- end }}
    {{- if .Values.toolkit.version }}
    version: {{ .Values.toolkit.version | quote }}
    {{- end }}
    {{- if .Values.toolkit.imagePullPolicy }}
    imagePullPolicy: {{ .Values.toolkit.imagePullPolicy }}
    {{- end }}
    {{- if .Values.toolkit.imagePullSecrets }}
    imagePullSecrets: {{ toYaml .Values.toolkit.imagePullSecrets | nindent 6 }}
    {{- end }}
    {{- if .Values.toolkit.resources }}
    resources: {{ toYaml .Values.toolkit.resources | nindent 6 }}
    {{- end }}
    {{- if .Values.toolkit.env }}
    env: {{ toYaml .Values.toolkit.env | nindent 6 }}
    {{- end }}
    {{- if .Values.toolkit.installDir }}
    installDir: {{ .Values.toolkit.installDir }}
    {{- end }}
  devicePlugin:
    enabled: {{ .Values.devicePlugin.enabled }}
    {{- if .Values.devicePlugin.repository }}
    repository: {{ .Values.devicePlugin.repository }}
    {{- end }}
    {{- if .Values.devicePlugin.image }}
    image: {{ .Values.devicePlugin.image }}
    {{- end }}
    {{- if .Values.devicePlugin.version }}
    version: {{ .Values.devicePlugin.version | quote }}
    {{- end }}
    {{- if .Values.devicePlugin.imagePullPolicy }}
    imagePullPolicy: {{ .Values.devicePlugin.imagePullPolicy }}
    {{- end }}
    {{- if .Values.devicePlugin.imagePullSecrets }}
    imagePullSecrets: {{ toYaml .Values.devicePlugin.imagePullSecrets | nindent 6 }}
    {{- end }}
    {{- if .Values.devicePlugin.resources }}
    resources: {{ toYaml .Values.devicePlugin.resources | nindent 6 }}
    {{- end }}
    {{- if .Values.devicePlugin.env }}
    env: {{ toYaml .Values.devicePlugin.env | nindent 6 }}
    {{- end }}
    {{- if .Values.devicePlugin.args }}
    args: {{ toYaml .Values.devicePlugin.args | nindent 6 }}
    {{- end }}
    {{- if .Values.devicePlugin.config.name }}
    config:
      name: {{ .Values.devicePlugin.config.name }}
      default: {{ .Values.devicePlugin.config.default }}
    {{- end }}
  dcgm:
    enabled: {{ .Values.dcgm.enabled }}
    {{- if .Values.dcgm.repository }}
    repository: {{ .Values.dcgm.repository }}
    {{- end }}
    {{- if .Values.dcgm.image }}
    image: {{ .Values.dcgm.image }}
    {{- end }}
    {{- if .Values.dcgm.version }}
    version: {{ .Values.dcgm.version | quote }}
    {{- end }}
    {{- if .Values.dcgm.imagePullPolicy }}
    imagePullPolicy: {{ .Values.dcgm.imagePullPolicy }}
    {{- end }}
    {{- if .Values.dcgm.imagePullSecrets }}
    imagePullSecrets: {{ toYaml .Values.dcgm.imagePullSecrets | nindent 6 }}
    {{- end }}
    {{- if .Values.dcgm.resources }}
    resources: {{ toYaml .Values.dcgm.resources | nindent 6 }}
    {{- end }}
    {{- if .Values.dcgm.env }}
    env: {{ toYaml .Values.dcgm.env | nindent 6 }}
    {{- end }}
    {{- if .Values.dcgm.args }}
    args: {{ toYaml .Values.dcgm.args | nindent 6 }}
    {{- end }}
  dcgmExporter:
    enabled: {{ .Values.dcgmExporter.enabled }}
    {{- if .Values.dcgmExporter.repository }}
    repository: {{ .Values.dcgmExporter.repository }}
    {{- end }}
    {{- if .Values.dcgmExporter.image }}
    image: {{ .Values.dcgmExporter.image }}
    {{- end }}
    {{- if .Values.dcgmExporter.version }}
    version: {{ .Values.dcgmExporter.version | quote }}
    {{- end }}
    {{- if .Values.dcgmExporter.imagePullPolicy }}
    imagePullPolicy: {{ .Values.dcgmExporter.imagePullPolicy }}
    {{- end }}
    {{- if .Values.dcgmExporter.imagePullSecrets }}
    imagePullSecrets: {{ toYaml .Values.dcgmExporter.imagePullSecrets | nindent 6 }}
    {{- end }}
    {{- if .Values.dcgmExporter.resources }}
    resources: {{ toYaml .Values.dcgmExporter.resources | nindent 6 }}
    {{- end }}
    {{- if .Values.dcgmExporter.env }}
    env: {{ toYaml .Values.dcgmExporter.env | nindent 6 }}
    {{- end }}
    {{- if .Values.dcgmExporter.args }}
    args: {{ toYaml .Values.dcgmExporter.args | nindent 6 }}
    {{- end }}
    {{- if and (.Values.dcgmExporter.config) (.Values.dcgmExporter.config.name) }}
    config:
      name: {{ .Values.dcgmExporter.config.name }}
    {{- end }}
    {{- if .Values.dcgmExporter.serviceMonitor }}
    serviceMonitor: {{ toYaml .Values.dcgmExporter.serviceMonitor | nindent 6 }}
    {{- end }}
  gfd:
    enabled: {{ .Values.gfd.enabled }}
    {{- if .Values.gfd.repository }}
    repository: {{ .Values.gfd.repository }}
    {{- end }}
    {{- if .Values.gfd.image }}
    image: {{ .Values.gfd.image }}
    {{- end }}
    {{- if .Values.gfd.version }}
    version: {{ .Values.gfd.version | quote }}
    {{- end }}
    {{- if .Values.gfd.imagePullPolicy }}
    imagePullPolicy: {{ .Values.gfd.imagePullPolicy }}
    {{- end }}
    {{- if .Values.gfd.imagePullSecrets }}
    imagePullSecrets: {{ toYaml .Values.gfd.imagePullSecrets | nindent 6 }}
    {{- end }}
    {{- if .Values.gfd.resources }}
    resources: {{ toYaml .Values.gfd.resources | nindent 6 }}
    {{- end }}
    {{- if .Values.gfd.env }}
    env: {{ toYaml .Values.gfd.env | nindent 6 }}
    {{- end }}
    {{- if .Values.gfd.args }}
    args: {{ toYaml .Values.gfd.args | nindent 6 }}
    {{- end }}
  migManager:
    enabled: {{ .Values.migManager.enabled }}
    {{- if .Values.migManager.repository }}
    repository: {{ .Values.migManager.repository }}
    {{- end }}
    {{- if .Values.migManager.image }}
    image: {{ .Values.migManager.image }}
    {{- end }}
    {{- if .Values.migManager.version }}
    version: {{ .Values.migManager.version | quote }}
    {{- end }}
    {{- if .Values.migManager.imagePullPolicy }}
    imagePullPolicy: {{ .Values.migManager.imagePullPolicy }}
    {{- end }}
    {{- if .Values.migManager.imagePullSecrets }}
    imagePullSecrets: {{ toYaml .Values.migManager.imagePullSecrets | nindent 6 }}
    {{- end }}
    {{- if .Values.migManager.resources }}
    resources: {{ toYaml .Values.migManager.resources | nindent 6 }}
    {{- end }}
    {{- if .Values.migManager.env }}
    env: {{ toYaml .Values.migManager.env | nindent 6 }}
    {{- end }}
    {{- if .Values.migManager.args }}
    args: {{ toYaml .Values.migManager.args | nindent 6 }}
    {{- end }}
    {{- if .Values.migManager.config }}
    config:
      name: {{ .Values.migManager.config.name }}
      default: {{ .Values.migManager.config.default }}
    {{- end }}
    {{- if .Values.migManager.gpuClientsConfig }}
    gpuClientsConfig: {{ toYaml .Values.migManager.gpuClientsConfig | nindent 6 }}
    {{- end }}
  nodeStatusExporter:
    enabled: {{ .Values.nodeStatusExporter.enabled }}
    {{- if .Values.nodeStatusExporter.repository }}
    repository: {{ .Values.nodeStatusExporter.repository }}
    {{- end }}
    {{- if .Values.nodeStatusExporter.image }}
    image: {{ .Values.nodeStatusExporter.image }}
    {{- end }}
    version: {{ .Values.nodeStatusExporter.version | default .Chart.AppVersion | quote }}
    {{- if .Values.nodeStatusExporter.imagePullPolicy }}
    imagePullPolicy: {{ .Values.nodeStatusExporter.imagePullPolicy }}
    {{- end }}
    {{- if .Values.nodeStatusExporter.imagePullSecrets }}
    imagePullSecrets: {{ toYaml .Values.nodeStatusExporter.imagePullSecrets | nindent 6 }}
    {{- end }}
    {{- if .Values.nodeStatusExporter.resources }}
    resources: {{ toYaml .Values.nodeStatusExporter.resources | nindent 6 }}
    {{- end }}
    {{- if .Values.nodeStatusExporter.env }}
    env: {{ toYaml .Values.nodeStatusExporter.env | nindent 6 }}
    {{- end }}
    {{- if .Values.nodeStatusExporter.args }}
    args: {{ toYaml .Values.nodeStatusExporter.args | nindent 6 }}
    {{- end }}
  {{- if .Values.gds.enabled }}
  gds:
    enabled: {{ .Values.gds.enabled }}
    {{- if .Values.gds.repository }}
    repository: {{ .Values.gds.repository }}
    {{- end }}
    {{- if .Values.gds.image }}
    image: {{ .Values.gds.image }}
    {{- end }}
    version: {{ .Values.gds.version | quote }}
    {{- if .Values.gds.imagePullPolicy }}
    imagePullPolicy: {{ .Values.gds.imagePullPolicy }}
    {{- end }}
    {{- if .Values.gds.imagePullSecrets }}
    imagePullSecrets: {{ toYaml .Values.gds.imagePullSecrets | nindent 8 }}
    {{- end }}
    {{- if .Values.gds.env }}
    env: {{ toYaml .Values.gds.env | nindent 6 }}
    {{- end }}
    {{- if .Values.gds.args }}
    args: {{ toYaml .Values.gds.args | nindent 6 }}
    {{- end }}
  {{- end }}
  {{- if .Values.gdrcopy }}
  gdrcopy:
    enabled: {{ .Values.gdrcopy.enabled | default false }}
    {{- if .Values.gdrcopy.repository }}
    repository: {{ .Values.gdrcopy.repository }}
    {{- end }}
    {{- if .Values.gdrcopy.image }}
    image: {{ .Values.gdrcopy.image }}
    {{- end }}
    version: {{ .Values.gdrcopy.version | quote }}
    {{- if .Values.gdrcopy.imagePullPolicy }}
    imagePullPolicy: {{ .Values.gdrcopy.imagePullPolicy }}
    {{- end }}
    {{- if .Values.gdrcopy.imagePullSecrets }}
    imagePullSecrets: {{ toYaml .Values.gdrcopy.imagePullSecrets | nindent 8 }}
    {{- end }}
    {{- if .Values.gdrcopy.env }}
    env: {{ toYaml .Values.gdrcopy.env | nindent 6 }}
    {{- end }}
    {{- if .Values.gdrcopy.args }}
    args: {{ toYaml .Values.gdrcopy.args | nindent 6 }}
    {{- end }}
  {{- end }}
  sandboxWorkloads:
    enabled: {{ .Values.sandboxWorkloads.enabled }}
    {{- if .Values.sandboxWorkloads.defaultWorkload }}
    defaultWorkload: {{ .Values.sandboxWorkloads.defaultWorkload }}
    {{- end }}
  sandboxDevicePlugin:
    {{- if .Values.sandboxDevicePlugin.enabled }}
    enabled: {{ .Values.sandboxDevicePlugin.enabled }}
    {{- end }}
    {{- if .Values.sandboxDevicePlugin.repository }}
    repository: {{ .Values.sandboxDevicePlugin.repository }}
    {{- end }}
    {{- if .Values.sandboxDevicePlugin.image }}
    image: {{ .Values.sandboxDevicePlugin.image }}
    {{- end }}
    {{- if .Values.sandboxDevicePlugin.version }}
    version: {{ .Values.sandboxDevicePlugin.version | quote }}
    {{- end }}
    {{- if .Values.sandboxDevicePlugin.imagePullPolicy }}
    imagePullPolicy: {{ .Values.sandboxDevicePlugin.imagePullPolicy }}
    {{- end }}
    {{- if .Values.sandboxDevicePlugin.imagePullSecrets }}
    imagePullSecrets: {{ toYaml .Values.sandboxDevicePlugin.imagePullSecrets | nindent 6 }}
    {{- end }}
    {{- if .Values.sandboxDevicePlugin.resources }}
    resources: {{ toYaml .Values.sandboxDevicePlugin.resources | nindent 6 }}
    {{- end }}
    {{- if .Values.sandboxDevicePlugin.env }}
    env: {{ toYaml .Values.sandboxDevicePlugin.env | nindent 6 }}
    {{- end }}
    {{- if .Values.sandboxDevicePlugin.args }}
    args: {{ toYaml .Values.sandboxDevicePlugin.args | nindent 6 }}
    {{- end }}
