Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
Signed-off-by: wgrayson <[email protected]>
  • Loading branch information
GraysonWu committed Apr 20, 2022
1 parent eb1a554 commit 246f1c5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
10 changes: 5 additions & 5 deletions pkg/agent/openflow/network_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -841,12 +841,12 @@ func (c *clause) addAddrFlows(featureNetworkPolicy *featureNetworkPolicy, addrTy
return conjMatchFlowContextChanges
}

// addServiceFlows translates the specified NetworkPolicyPorts to conjunctiveMatchFlow, and returns corresponding
// conjMatchFlowContextChange.
func (c *clause) addServiceFlows(featureNetworkPolicy *featureNetworkPolicy, ports []v1beta2.Service, priority *uint16, matchSrc bool) []*conjMatchFlowContextChange {
// addServiceFlows translates the specified Antrea Service to conjunctiveMatchFlow,
// and returns corresponding conjMatchFlowContextChange.
func (c *clause) addServiceFlows(featureNetworkPolicy *featureNetworkPolicy, services []v1beta2.Service, priority *uint16, matchSrc bool) []*conjMatchFlowContextChange {
var conjMatchFlowContextChanges []*conjMatchFlowContextChange
for _, port := range ports {
matches := generateServiceConjMatches(c.ruleTable.GetID(), port, priority, featureNetworkPolicy.ipProtocols, matchSrc)
for _, service := range services {
matches := generateServiceConjMatches(c.ruleTable.GetID(), service, priority, featureNetworkPolicy.ipProtocols, matchSrc)
for _, match := range matches {
ctxChange := c.addConjunctiveMatchFlow(featureNetworkPolicy, match)
conjMatchFlowContextChanges = append(conjMatchFlowContextChanges, ctxChange)
Expand Down
7 changes: 4 additions & 3 deletions pkg/controller/networkpolicy/crd_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@ var (
}
)

// toAntreaServicesForCRD converts a slice of v1alpha1.NetworkPolicyPort
// objects to a slice of Antrea Service objects. A bool is returned along with
// the Service objects to indicate whether any named port exists.
// toAntreaServicesForCRD converts a slice of v1alpha1.NetworkPolicyPort objects
// and a slice of v1alpha1.NetworkPolicyProtocol objects to a slice of Antrea
// Service objects. A bool is returned along with the Service objects to indicate
// whether any named port exists.
func toAntreaServicesForCRD(npPorts []v1alpha1.NetworkPolicyPort, npProtocols []v1alpha1.NetworkPolicyProtocol) ([]controlplane.Service, bool) {
var antreaServices []controlplane.Service
var namedPortExists bool
Expand Down

0 comments on commit 246f1c5

Please sign in to comment.