Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix reference to nil pointer #3872

Merged
merged 1 commit into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions pkg/controller/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -625,15 +625,15 @@ func (c *Controller) syncSubnetCR() error {
klog.Error(err)
return err
}
for _, orisubnet := range subnets {
subnet := orisubnet.DeepCopy()
for _, cachedSubnet := range subnets {
subnet := cachedSubnet.DeepCopy()
if util.CheckProtocol(subnet.Spec.CIDRBlock) == kubeovnv1.ProtocolDual {
subnet, err = c.calcDualSubnetStatusIP(subnet)
} else {
subnet, err = c.calcSubnetStatusIP(subnet)
}
if err != nil {
klog.Errorf("failed to calculate subnet %s used ip: %v", subnet.Name, err)
klog.Errorf("failed to calculate subnet %s used ip: %v", cachedSubnet.Name, err)
return err
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/subnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,7 @@ func (c *Controller) handleAddOrUpdateSubnet(key string) error {
subnet, err = c.calcSubnetStatusIP(subnet)
}
if err != nil {
klog.Errorf("calculate subnet %s used ip failed, %v", subnet.Name, err)
klog.Errorf("calculate subnet %s used ip failed, %v", cachedSubnet.Name, err)
return err
}

Expand Down
Loading