npc: Manage entries in egressDefaultAllowIPSet
This commit is contained in:
1 parent
d474c1c26d
commit
79727a86fa
2 files changed
+100
-36
No files matched your search
+7
-4
@@ -89,20 +89,23 @@ func newSelectorSet(ips ipset.Interface, onNewSelector selectorFn, onNewDstSelec
|
||||
dstSelectorsCount: make(map[string]map[policyType]int)}
|
||||
}
|
||||
|
||||
func (ss *selectorSet) addToMatching(user types.UID, labelMap map[string]string, entry string, comment string) (bool, error) {
|
||||
func (ss *selectorSet) addToMatching(user types.UID, labelMap map[string]string, entry string, comment string) (bool, bool, error) {
|
||||
foundIngress := false
|
||||
// TODO(brb) foundEgress
|
||||
foundEgress := false
|
||||
for _, s := range ss.entries {
|
||||
if s.matches(labelMap) {
|
||||
if ss.dstSelectorExist(s, ingressPolicy) {
|
||||
foundIngress = true
|
||||
}
|
||||
if ss.dstSelectorExist(s, egressPolicy) {
|
||||
foundEgress = true
|
||||
}
|
||||
if err := s.addEntry(user, entry, comment); err != nil {
|
||||
return foundIngress, err
|
||||
return foundIngress, foundEgress, err
|
||||
}
|
||||
}
|
||||
}
|
||||
return foundIngress, nil
|
||||
return foundIngress, foundEgress, nil
|
||||
}
|
||||
|
||||
func (ss *selectorSet) delFromMatching(user types.UID, labelMap map[string]string, entry string) error {
|
||||
|
||||
Reference in new issue
Block a user