gpu-operator
gpu-operator copied to clipboard
fix(controller): do not apply driver upgrade annotation when driver is disabled
The applyDriverAutoUpgradeAnnotation() function was applying the nvidia.com/gpu-driver-upgrade-enabled annotation to GPU nodes even when driver.enabled=false. This occurred because the function only checked if driver.upgradePolicy.autoUpgrade was true, without verifying that the driver component itself was enabled.
This fix adds a check for Driver.IsEnabled() before applying the annotation, ensuring it is only set when:
- Driver is enabled
- Auto-upgrade policy exists and is enabled
- Sandbox workloads are disabled
Added unit tests to validate the fix and prevent regression.
Fixes #1277