Clean defaultAllowIPSet on namespace delete
This commit is contained in:
1 parent
75bf62ca80
commit
91ab0e4a76
2 files changed
+15
-1
No files matched your search
@@ -294,6 +294,11 @@ func TestDefaultAllow(t *testing.T) {
|
|||||||
controller.DeletePod(podFoo)
|
controller.DeletePod(podFoo)
|
||||||
// Should remove foo pod from default-allow
|
// Should remove foo pod from default-allow
|
||||||
require.False(t, m.entryExists(defaultAllowIPSetName, fooPodIP))
|
require.False(t, m.entryExists(defaultAllowIPSetName, fooPodIP))
|
||||||
|
|
||||||
|
controller.DeleteNamespace(defaultNamespace)
|
||||||
|
// Should remove default ipset
|
||||||
|
require.NotContains(t, m.sets, defaultAllowIPSetName)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestOutOfOrderPodEvents(t *testing.T) {
|
func TestOutOfOrderPodEvents(t *testing.T) {
|
||||||
|
|||||||
+10
-1
@@ -471,7 +471,16 @@ func (ns *ns) deleteNamespace(obj *coreapi.Namespace) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Remove namespace ipset from any matching namespace selectors
|
// Remove namespace ipset from any matching namespace selectors
|
||||||
return ns.nsSelectors.delFromMatching(obj.ObjectMeta.UID, obj.ObjectMeta.Labels, string(ns.allPods.ipsetName))
|
err := ns.nsSelectors.delFromMatching(obj.ObjectMeta.UID, obj.ObjectMeta.Labels, string(ns.allPods.ipsetName))
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if !ns.legacy {
|
||||||
|
return ns.ips.Destroy(ns.defaultAllowIPSet)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ns *ns) isDefaultDeny(namespace *coreapi.Namespace) bool {
|
func (ns *ns) isDefaultDeny(namespace *coreapi.Namespace) bool {
|
||||||
|
|||||||
Reference in new issue
Block a user