Skip to content

Commit

Permalink
use existing node switch cidr instead of the configured one (#2359)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangzujian committed Feb 20, 2023
1 parent 87b8bde commit 3b8da6a
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions pkg/controller/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,16 +152,16 @@ func (c *Controller) initDefaultLogicalSwitch() error {
func (c *Controller) initNodeSwitch() error {
subnet, err := c.config.KubeOvnClient.KubeovnV1().Subnets().Get(context.Background(), c.config.NodeSwitch, metav1.GetOptions{})
if err == nil {
if subnet != nil && util.CheckProtocol(c.config.NodeSwitchCIDR) != util.CheckProtocol(subnet.Spec.CIDRBlock) {
if util.CheckProtocol(c.config.NodeSwitchCIDR) == kubeovnv1.ProtocolDual && util.CheckProtocol(subnet.Spec.CIDRBlock) != kubeovnv1.ProtocolDual {
// single-stack upgrade to dual-stack
if util.CheckProtocol(c.config.NodeSwitchCIDR) == kubeovnv1.ProtocolDual {
subnet := subnet.DeepCopy()
subnet.Spec.CIDRBlock = c.config.NodeSwitchCIDR
if err := formatSubnet(subnet, c); err != nil {
klog.Errorf("init format subnet %s failed: %v", c.config.NodeSwitch, err)
return err
}
subnet := subnet.DeepCopy()
subnet.Spec.CIDRBlock = c.config.NodeSwitchCIDR
if err := formatSubnet(subnet, c); err != nil {
klog.Errorf("init format subnet %s failed: %v", c.config.NodeSwitch, err)
return err
}
} else {
c.config.NodeSwitchCIDR = subnet.Spec.CIDRBlock
}
return nil
}
Expand Down

0 comments on commit 3b8da6a

Please sign in to comment.