Fix nil pointer panic in upgrade controller when DrainSpec is not set#2418
Merged
tariq1890 merged 1 commit intoNVIDIA:mainfrom May 4, 2026
Merged
Conversation
9f17c4c to
4d8fc92
Compare
Contributor
|
/ok to test 4d8fc92 |
Contributor
|
LGTM. Can you please rebase your PR from latest main. We had some CI fixes which are required to run all the tests. |
4d8fc92 to
b9b4372
Compare
Contributor
|
/ok to test b9b4372 |
rahulait
approved these changes
May 4, 2026
tariq1890
reviewed
May 4, 2026
When UpgradePolicy.AutoUpgrade is true but no drain section is specified in the ClusterPolicy, the upgrade controller panics at upgrade_controller.go:172 due to a nil DrainSpec dereference. Add a nil check for DrainSpec and initialize it with defaults when not set, consistent with how UpgradePolicy itself is handled on line 160. Fixes: NVIDIA#2417 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Harshal Patil <12152047+harche@users.noreply.github.com>
8728bdc to
03abb74
Compare
Contributor
|
/ok to test 03abb74 |
tariq1890
approved these changes
May 4, 2026
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.
Summary
DrainSpecin the upgrade controller before accessingPodSelectorDrainSpecis nil, initializes it with an emptyDrainSpec{}so the defaultPodSelectoris appliedPodSelectorcasesRoot cause
DriverUpgradePolicySpec.DrainSpecis a pointer (*DrainSpec,json:"drain,omitempty"). WhenUpgradePolicy.AutoUpgradeistruebut nodrainsection is specified in the ClusterPolicy,DrainSpecis nil. The code atupgrade_controller.go:172dereferencesDrainSpec.PodSelectorwithout a nil check, causing a panic:Verified on cluster
autoUpgrade: truewithoutdrainsection → upgrade controller panic loop (1284 panics observed)Fixes: #2417
Test plan
TestSetDrainSpecPodSelector— nil, empty, existing PodSelector)go build ./controllers/compilesautoUpgrade: trueand nodrainsection — zero panics