npc: Replace rulesType by policyType
This commit is contained in:
1 parent
5afcd0595d
commit
497a9c7fd0
3 files changed
+24
-29
No files matched your search
+8
-8
@@ -46,13 +46,13 @@ func (ns *ns) analysePolicyLegacy(policy *extnapi.NetworkPolicy) (
|
||||
// From is not provided, this rule matches all sources (traffic not restricted by source).
|
||||
if ingressRule.Ports == nil {
|
||||
// Ports is not provided, this rule matches all ports (traffic not restricted by port).
|
||||
rule := newRuleSpec(ingress, nil, nil, dstSelector, nil)
|
||||
rule := newRuleSpec(ingressPolicy, nil, nil, dstSelector, nil)
|
||||
rules[rule.key] = rule
|
||||
} else {
|
||||
// Ports is present and contains at least one item, then this rule allows traffic
|
||||
// only if the traffic matches at least one port in the ports list.
|
||||
withNormalisedProtoAndPortLegacy(ingressRule.Ports, func(proto, port string) {
|
||||
rule := newRuleSpec(ingress, &proto, nil, dstSelector, &port)
|
||||
rule := newRuleSpec(ingressPolicy, &proto, nil, dstSelector, &port)
|
||||
rules[rule.key] = rule
|
||||
})
|
||||
}
|
||||
@@ -78,13 +78,13 @@ func (ns *ns) analysePolicyLegacy(policy *extnapi.NetworkPolicy) (
|
||||
|
||||
if ingressRule.Ports == nil {
|
||||
// Ports is not provided, this rule matches all ports (traffic not restricted by port).
|
||||
rule := newRuleSpec(ingress, nil, srcSelector, dstSelector, nil)
|
||||
rule := newRuleSpec(ingressPolicy, nil, srcSelector, dstSelector, nil)
|
||||
rules[rule.key] = rule
|
||||
} else {
|
||||
// Ports is present and contains at least one item, then this rule allows traffic
|
||||
// only if the traffic matches at least one port in the ports list.
|
||||
withNormalisedProtoAndPortLegacy(ingressRule.Ports, func(proto, port string) {
|
||||
rule := newRuleSpec(ingress, &proto, srcSelector, dstSelector, &port)
|
||||
rule := newRuleSpec(ingressPolicy, &proto, srcSelector, dstSelector, &port)
|
||||
rules[rule.key] = rule
|
||||
})
|
||||
}
|
||||
@@ -138,11 +138,11 @@ func (ns *ns) analysePolicy(policy *networkingv1.NetworkPolicy) (
|
||||
|
||||
if allSources {
|
||||
if allPorts {
|
||||
rule := newRuleSpec(ingress, nil, nil, dstSelector, nil)
|
||||
rule := newRuleSpec(ingressPolicy, nil, nil, dstSelector, nil)
|
||||
rules[rule.key] = rule
|
||||
} else {
|
||||
withNormalisedProtoAndPort(ingressRule.Ports, func(proto, port string) {
|
||||
rule := newRuleSpec(ingress, &proto, nil, dstSelector, &port)
|
||||
rule := newRuleSpec(ingressPolicy, &proto, nil, dstSelector, &port)
|
||||
rules[rule.key] = rule
|
||||
})
|
||||
}
|
||||
@@ -168,11 +168,11 @@ func (ns *ns) analysePolicy(policy *networkingv1.NetworkPolicy) (
|
||||
}
|
||||
|
||||
if allPorts {
|
||||
rule := newRuleSpec(ingress, nil, srcSelector, dstSelector, nil)
|
||||
rule := newRuleSpec(ingressPolicy, nil, srcSelector, dstSelector, nil)
|
||||
rules[rule.key] = rule
|
||||
} else {
|
||||
withNormalisedProtoAndPort(ingressRule.Ports, func(proto, port string) {
|
||||
rule := newRuleSpec(ingress, &proto, srcSelector, dstSelector, &port)
|
||||
rule := newRuleSpec(ingressPolicy, &proto, srcSelector, dstSelector, &port)
|
||||
rules[rule.key] = rule
|
||||
})
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user