Skip to content

Commit

Permalink
ovn: update patch for skipping ct (#3879)
Browse files Browse the repository at this point in the history
Signed-off-by: zhangzujian <[email protected]>
  • Loading branch information
zhangzujian committed Mar 28, 2024
1 parent 8885cd2 commit fe2797c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dist/images/Dockerfile.base
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ RUN cd /usr/src/ && git clone -b branch-22.03 --depth=1 https://github.com/ovn-o
# ovn-controller: do not send GARP on localnet for Kube-OVN ports
curl -s https://github.com/kubeovn/ovn/commit/1792621bf33a661d66ca47620871668267e3e521.patch | git apply && \
# lflow: do not send direct traffic between lports to conntrack
curl -s https://github.com/kubeovn/ovn/commit/55b22c91f9e4a128ab2ae0068e426cc2f0220e0c.patch | git apply && \
curl -s https://github.com/kubeovn/ovn/commit/f9ad910c8036dc138e52738c400ddcca7236337e.patch | git apply && \
sed -i 's/OVN/ovn/g' debian/changelog && \
rm -rf .git && \
./boot.sh && \
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/subnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -1599,7 +1599,7 @@ func (c *Controller) reconcileVlan(subnet *kubeovnv1.Subnet) error {
}

localnetPort := ovs.GetLocalnetName(subnet.Name)
if err := c.ovnLegacyClient.CreateLocalnetPort(subnet.Name, localnetPort, vlan.Spec.Provider, vlan.Spec.ID); err != nil {
if err := c.ovnLegacyClient.CreateLocalnetPort(subnet.Name, localnetPort, vlan.Spec.Provider, subnet.Spec.CIDRBlock, vlan.Spec.ID); err != nil {
klog.Errorf("failed to create localnet port for subnet %s: %v", subnet.Name, err)
return err
}
Expand Down
9 changes: 8 additions & 1 deletion pkg/ovs/ovn-nbctl-legacy.go
Original file line number Diff line number Diff line change
Expand Up @@ -2243,7 +2243,7 @@ func (c LegacyClient) GetLogicalSwitchPortByLogicalSwitch(logicalSwitch string)
return rv, nil
}

func (c LegacyClient) CreateLocalnetPort(ls, port, provider string, vlanID int) error {
func (c LegacyClient) CreateLocalnetPort(ls, port, provider, cidrBlock string, vlanID int) error {
cmdArg := []string{
MayExist, "lsp-add", ls, port, "--",
"lsp-set-addresses", port, "unknown", "--",
Expand All @@ -2255,6 +2255,13 @@ func (c LegacyClient) CreateLocalnetPort(ls, port, provider string, vlanID int)
cmdArg = append(cmdArg,
"--", "set", "logical_switch_port", port, fmt.Sprintf("tag=%d", vlanID))
}
ipv4CIDR, ipv6CIDR := util.SplitStringIP(cidrBlock)
if ipv4CIDR != "" {
cmdArg = append(cmdArg, "--", "set", "logical_switch_port", port, fmt.Sprintf("external_ids:ipv4_network=%s", ipv4CIDR))
}
if ipv6CIDR != "" {
cmdArg = append(cmdArg, "--", "set", "logical_switch_port", port, fmt.Sprintf("external_ids:ipv6_network=%s", ipv6CIDR))
}

if _, err := c.ovnNbCommand(cmdArg...); err != nil {
klog.Errorf("create localnet port %s failed, %v", port, err)
Expand Down

0 comments on commit fe2797c

Please sign in to comment.