fix(controller): do not apply driver upgrade annotation when driver is disabled#1981
Open
anujdbe wants to merge 1 commit intoNVIDIA:mainfrom
Open
fix(controller): do not apply driver upgrade annotation when driver is disabled#1981anujdbe wants to merge 1 commit intoNVIDIA:mainfrom
anujdbe wants to merge 1 commit intoNVIDIA:mainfrom
Conversation
…s 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: 1. Driver is enabled 2. Auto-upgrade policy exists and is enabled 3. Sandbox workloads are disabled Added unit tests to validate the fix and prevent regression. Fixes NVIDIA#1277 Signed-off-by: Anuj Dube <anujdubesn@gmail.com>
Contributor
|
/ok-to-test b0249cf |
| } | ||
|
|
||
| // Simulate the logic from applyDriverAutoUpgradeAnnotation | ||
| shouldApply := clusterPolicy.Spec.Driver.IsEnabled() && |
Contributor
There was a problem hiding this comment.
I don't think the tests add much value if we're just duplicating logic here. You will need to either call applyDriverAutoUpgradeAnnotation() with appropriate fake client/objects set up (preferred) or remove the test entirely.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
Added unit tests to validate the fix and prevent regression.
Fixes #1277