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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

make conformance with underlay pn vlan subnet has no gw #2908

Merged
merged 1 commit into from
Jun 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 11 additions & 11 deletions pkg/controller/external-gw.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,17 @@ func (c *Controller) establishExternalGateway(config map[string]string) error {
return err
}
var lrpIp, lrpMac string
if config["nic-ip"] == "" {
lrpName := fmt.Sprintf("%s-%s", c.config.ClusterRouter, c.config.ExternalGatewaySwitch)
lrp, err := c.ovnClient.GetLogicalRouterPort(lrpName, true)
if err != nil {
klog.Errorf("failed to get lrp %s, %v", lrpName, err)
return err
}
if lrp != nil {
klog.Infof("lrp %s already exist", lrpName)
lrpMac = lrp.MAC
lrpIp = lrp.Networks[0]
} else if config["nic-ip"] == "" {
if lrpIp, lrpMac, err = c.createDefaultVpcLrpEip(config); err != nil {
klog.Errorf("failed to create ovn eip for default vpc lrp: %v", err)
return err
Expand All @@ -151,16 +161,6 @@ func (c *Controller) establishExternalGateway(config map[string]string) error {
lrpIp = config["nic-ip"]
lrpMac = config["nic-mac"]
}
lrpName := fmt.Sprintf("%s-%s", c.config.ClusterRouter, c.config.ExternalGatewaySwitch)
exist, err := c.ovnClient.LogicalRouterPortExists(lrpName)
if err != nil {
return err
}
if exist {
klog.Infof("lrp %s exist", lrpName)
return nil
}

if err := c.ovnClient.CreateGatewayLogicalSwitch(c.config.ExternalGatewaySwitch, c.config.ClusterRouter, c.config.ExternalGatewayNet, lrpIp, lrpMac, c.config.ExternalGatewayVlanID, chassises...); err != nil {
klog.Errorf("create external gateway switch %s: %v", c.config.ExternalGatewaySwitch, err)
return err
Expand Down