Skip to content

Commit 8ec90f5

Browse files
committed
update ipv6 security-group remote group name (#2389)
1 parent 489d245 commit 8ec90f5

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

pkg/controller/security_group.go

+3
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,9 @@ func (c *Controller) syncSgLogicalPort(key string) error {
366366
klog.Errorf("failed to find logical port, %v", err)
367367
return err
368368
}
369+
if len(results) == 0 {
370+
return nil
371+
}
369372

370373
var v4s, v6s []string
371374
var ports []string

pkg/ovs/ovn-nbctl-legacy.go

+6-2
Original file line numberDiff line numberDiff line change
@@ -2109,10 +2109,14 @@ func (c LegacyClient) createSgRuleACL(sgName string, direction AclDirection, rul
21092109
matchArgs = append(matchArgs, fmt.Sprintf("inport==@%s && %s && %s.dst==%s", sgPortGroupName, ipSuffix, ipSuffix, rule.RemoteAddress))
21102110
}
21112111
} else {
2112+
remotePgName := GetSgV4AssociatedName(rule.RemoteSecurityGroup)
2113+
if rule.IPVersion == "ipv6" {
2114+
remotePgName = GetSgV6AssociatedName(rule.RemoteSecurityGroup)
2115+
}
21122116
if direction == SgAclIngressDirection {
2113-
matchArgs = append(matchArgs, fmt.Sprintf("outport==@%s && %s && %s.src==$%s", sgPortGroupName, ipSuffix, ipSuffix, GetSgV4AssociatedName(rule.RemoteSecurityGroup)))
2117+
matchArgs = append(matchArgs, fmt.Sprintf("outport==@%s && %s && %s.src==$%s", sgPortGroupName, ipSuffix, ipSuffix, remotePgName))
21142118
} else {
2115-
matchArgs = append(matchArgs, fmt.Sprintf("inport==@%s && %s && %s.dst==$%s", sgPortGroupName, ipSuffix, ipSuffix, GetSgV4AssociatedName(rule.RemoteSecurityGroup)))
2119+
matchArgs = append(matchArgs, fmt.Sprintf("inport==@%s && %s && %s.dst==$%s", sgPortGroupName, ipSuffix, ipSuffix, remotePgName))
21162120
}
21172121
}
21182122

0 commit comments

Comments
 (0)