fix(generic-specializer): prevent panic on missing kptfile status#1100
fix(generic-specializer): prevent panic on missing kptfile status#1100pulkitvats2007-crypto wants to merge 1 commit into
Conversation
…status Signed-off-by: pulkitvats2007-crypto <pulkitvats2007@gmail.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hi @pulkitvats2007-crypto. Thanks for your PR. I'm waiting for a nephio-project member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Summary
The generic-specializer was crashing when processing Kptfiles that do not contain a
statusblock.This PR adds a defensive nil check to safely handle such cases and allow reconciliation to continue.
Root Cause
kptfile.Statusis an optional pointer.The controller assumed it is always present and directly accessed:
When Status == nil, this caused a runtime panic:
invalid memory address or nil pointer dereference.In Go, dereferencing a nil pointer always results in a runtime panic if not checked beforehand, because the pointer does not reference any valid memory location oai_citation:0‡codegenes.
Fix
Added a nil check before accessing
Status.Conditions:Testing
reconciler_nil_status_test.goImpact