Skip to content

Commit

Permalink
fix: restart ovn-controller to force update flows
Browse files Browse the repository at this point in the history
OVN-IC config might not take into effect when first join an ic group,
so restart ovn-controller to force update flows
  • Loading branch information
oilbeater committed Mar 23, 2021
1 parent c791ef8 commit 638a03a
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions pkg/daemon/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"net"
"os"
"os/exec"
"strings"

"github.com/alauda/felix/ipsets"
Expand Down Expand Up @@ -206,11 +207,21 @@ func (c *Controller) setICGateway() error {
}
enable := node.Labels[util.ICGatewayLabel]
if enable == "true" {
if _, err := ovs.Exec("set", "open_vswitch", ".", "external_ids:ovn-is-interconn=true"); err != nil {
return fmt.Errorf("failed to enable ic gateway, %v", err)
icEnabled, err := ovs.Exec(ovs.IfExists, "get", "open", ".", "external_ids:ovn-is-interconn")
if err != nil {
return fmt.Errorf("failed to get if ic enabled, %v", err)
}
if strings.Trim(icEnabled, "\"") != "true" {
if _, err := ovs.Exec("set", "open", ".", "external_ids:ovn-is-interconn=true"); err != nil {
return fmt.Errorf("failed to enable ic gateway, %v", err)
}
output, err := exec.Command("/usr/share/ovn/scripts/ovn-ctl", "restart_controller").CombinedOutput()
if err != nil {
return fmt.Errorf("failed to restart ovn-controller, %v, %q", err, output)
}
}
} else {
if _, err := ovs.Exec("set", "open_vswitch", ".", "external_ids:ovn-is-interconn=false"); err != nil {
if _, err := ovs.Exec("set", "open", ".", "external_ids:ovn-is-interconn=false"); err != nil {
return fmt.Errorf("failed to disable ic gateway, %v", err)
}
}
Expand Down

0 comments on commit 638a03a

Please sign in to comment.