Skip to content

Commit 7e936e7

Browse files
authored
simplify subnet.go code (#6009)
* simplify enqueueUpdate Signed-off-by: Mengxin Liu <liumengxinfly@gmail.com> * refactor format Signed-off-by: Mengxin Liu <liumengxinfly@gmail.com> * refactor calculate IPs * add helper function * simplify ip parse Signed-off-by: Mengxin Liu <liumengxinfly@gmail.com> * refactor subnet status calculation to unify IP handling Signed-off-by: Mengxin Liu <liumengxinfly@gmail.com> * split subnet status update to subnet_status.go Signed-off-by: Mengxin Liu <liumengxinfly@gmail.com> * fix status triger subnet update Signed-off-by: Mengxin Liu <liumengxinfly@gmail.com> --------- Signed-off-by: Mengxin Liu <liumengxinfly@gmail.com>
1 parent 9e37806 commit 7e936e7

File tree

3 files changed

+443
-717
lines changed

3 files changed

+443
-717
lines changed

pkg/controller/init.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -709,11 +709,7 @@ func (c *Controller) syncSubnetCR() error {
709709
klog.Warningf("subnet %s is not ready", subnet.Name)
710710
continue
711711
}
712-
if util.CheckProtocol(subnet.Spec.CIDRBlock) == kubeovnv1.ProtocolDual {
713-
subnet, err = c.calcDualSubnetStatusIP(subnet)
714-
} else {
715-
subnet, err = c.calcSubnetStatusIP(subnet)
716-
}
712+
subnet, err = c.calcSubnetStatusIP(subnet)
717713
if err != nil {
718714
klog.Errorf("failed to calculate subnet %s used ip: %v", cachedSubnet.Name, err)
719715
return err

0 commit comments

Comments
 (0)