Skip to content

Commit ecfce50

Browse files
oilbeaterclaude
andcommitted
fix(controller): prevent NPE in isOvnSubnet when subnet is nil
When an IP CR references a deleted subnet, handleUpdateIP calls isOvnSubnet with a nil subnet pointer, causing a panic that puts the controller into CrashLoopBackOff. Add a nil check so that isOvnSubnet safely returns false for nil input. Fixes #6309 Signed-off-by: Mengxin Liu <liumengxinfly@gmail.com> Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Mengxin Liu <liumengxinfly@gmail.com>
1 parent be9489c commit ecfce50

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pkg/controller/subnet.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2372,7 +2372,7 @@ func (c *Controller) checkSubnetUsingIPs(subnet *kubeovnv1.Subnet) error {
23722372
}
23732373

23742374
func isOvnSubnet(subnet *kubeovnv1.Subnet) bool {
2375-
return util.IsOvnProvider(subnet.Spec.Provider)
2375+
return subnet != nil && util.IsOvnProvider(subnet.Spec.Provider)
23762376
}
23772377

23782378
func checkAndFormatsExcludeIPs(subnet *kubeovnv1.Subnet) bool {

0 commit comments

Comments
 (0)