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

replace nb_global function call with ovnClient #2454

Merged
merged 1 commit into from
Mar 9, 2023
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
7 changes: 4 additions & 3 deletions pkg/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -680,11 +680,12 @@ func (c *Controller) Run(ctx context.Context) {
util.LogFatalAndExit(nil, "failed to wait for caches to sync")
}

if err := c.ovnLegacyClient.SetLsDnatModDlDst(c.config.LsDnatModDlDst); err != nil {
if err := c.ovnClient.SetLsDnatModDlDst(c.config.LsDnatModDlDst); err != nil {
util.LogFatalAndExit(err, "failed to set NB_Global option ls_dnat_mod_dl_dst")
}
if err := c.ovnLegacyClient.SetUseCtInvMatch(); err != nil {
util.LogFatalAndExit(err, "failed to set NB_Global option use_ct_inv_match")

if err := c.ovnClient.SetUseCtInvMatch(); err != nil {
util.LogFatalAndExit(err, "failed to set NB_Global option use_ct_inv_match to false")
}

if err := c.InitDefaultVpc(); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func (c *Controller) InitOVN() error {
}
v4Svc, _ := util.SplitStringIP(c.config.ServiceClusterIPRange)
if v4Svc != "" {
if err := c.ovnLegacyClient.SetLBCIDR(v4Svc); err != nil {
if err := c.ovnClient.SetLBCIDR(v4Svc); err != nil {
klog.Errorf("init load balancer svc cidr failed: %v", err)
return err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/ovn-ic.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func (c *Controller) resyncInterConnection() {
blackList = append(blackList, ipv6)
}
}
if err := c.ovnLegacyClient.SetICAutoRoute(autoRoute, blackList); err != nil {
if err := c.ovnClient.SetICAutoRoute(autoRoute, blackList); err != nil {
klog.Errorf("failed to config auto route, %v", err)
return
}
Expand Down
35 changes: 0 additions & 35 deletions pkg/ovs/ovn-nbctl-legacy.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,41 +74,6 @@ func (c LegacyClient) GetVersion() (string, error) {
return c.Version, nil
}

func (c LegacyClient) SetAzName(azName string) error {
if _, err := c.ovnNbCommand("set", "NB_Global", ".", fmt.Sprintf("name=%s", azName)); err != nil {
return fmt.Errorf("failed to set az name, %v", err)
}
return nil
}

func (c LegacyClient) SetLsDnatModDlDst(enabled bool) error {
if _, err := c.ovnNbCommand("set", "NB_Global", ".", fmt.Sprintf("options:ls_dnat_mod_dl_dst=%v", enabled)); err != nil {
return fmt.Errorf("failed to set NB_Global option ls_dnat_mod_dl_dst to %v: %v", enabled, err)
}
return nil
}

func (c LegacyClient) SetUseCtInvMatch() error {
if _, err := c.ovnNbCommand("set", "NB_Global", ".", "options:use_ct_inv_match=false"); err != nil {
return fmt.Errorf("failed to set NB_Global option use_ct_inv_match to false: %v", err)
}
return nil
}

func (c LegacyClient) SetICAutoRoute(enable bool, blackList []string) error {
if enable {
if _, err := c.ovnNbCommand("set", "NB_Global", ".", "options:ic-route-adv=true", "options:ic-route-learn=true", fmt.Sprintf("options:ic-route-blacklist=%s", strings.Join(blackList, ","))); err != nil {
return fmt.Errorf("failed to enable ovn-ic auto route, %v", err)
}
return nil
} else {
if _, err := c.ovnNbCommand("set", "NB_Global", ".", "options:ic-route-adv=false", "options:ic-route-learn=false"); err != nil {
return fmt.Errorf("failed to disable ovn-ic auto route, %v", err)
}
return nil
}
}

// DeleteLogicalSwitchPort delete logical switch port in ovn
func (c LegacyClient) DeleteLogicalSwitchPort(port string) error {
klog.Infof("delete lsp %s", port)
Expand Down