Skip to content

Commit 6a4b06f

Browse files
committed
default deny is not required in namespace in v1.
Signed-off-by: Ranjith <[email protected]>
1 parent b1bc3b2 commit 6a4b06f

File tree

1 file changed

+0
-31
lines changed

1 file changed

+0
-31
lines changed

netmaster/k8snetwork/networkpolicy.go

-31
Original file line numberDiff line numberDiff line change
@@ -311,27 +311,6 @@ func (k8sNet *k8sContext) deleteDefaultIngressPolicy(ns string) {
311311
}
312312
}
313313

314-
func (k8sNet *k8sContext) processK8sNamespace(opCode watch.EventType, ns *v1.Namespace) {
315-
if ns.Name == "kube-system" {
316-
return
317-
}
318-
319-
action := k8sNet.getIsolationPolicy(ns.Annotations)
320-
321-
npLog.Infof("process [%s] namespace isolation policy [%s], %+v", opCode, action, ns.Annotations)
322-
323-
switch opCode {
324-
case watch.Added, watch.Modified:
325-
if action == "none" {
326-
k8sNet.deleteDefaultIngressPolicy(ns.Name)
327-
} else {
328-
k8sNet.updateDefaultIngressPolicy(ns.Name, action)
329-
}
330-
case watch.Deleted:
331-
k8sNet.deleteDefaultIngressPolicy(ns.Name)
332-
}
333-
}
334-
335314
func (k8sNet *k8sContext) processK8sNetworkPolicy(opCode watch.EventType, np *v1beta1.NetworkPolicy) {
336315
if np.Namespace == "kube-system" { // not applicable for system namespace
337316
return
@@ -350,8 +329,6 @@ func (k8sNet *k8sContext) processK8sEvent(opCode watch.EventType, eventObj inter
350329
return
351330
}
352331
switch objType := eventObj.(type) {
353-
case *v1.Namespace:
354-
k8sNet.processK8sNamespace(opCode, objType)
355332

356333
case *v1beta1.NetworkPolicy:
357334
k8sNet.processK8sNetworkPolicy(opCode, objType)
@@ -375,14 +352,6 @@ func (k8sNet *k8sContext) watchK8sEvents(errChan chan error) {
375352
selCase = append(selCase, reflect.SelectCase{Dir: reflect.SelectRecv,
376353
Chan: reflect.ValueOf(npWatch.ResultChan())})
377354

378-
nsWatch, err := k8sNet.k8sClientSet.CoreV1().Namespaces().Watch(v1.ListOptions{})
379-
if err != nil {
380-
errChan <- fmt.Errorf("failed to watch namespaces, %s", err)
381-
return
382-
}
383-
selCase = append(selCase, reflect.SelectCase{Dir: reflect.SelectRecv,
384-
Chan: reflect.ValueOf(nsWatch.ResultChan())})
385-
386355
for {
387356
_, recVal, ok := reflect.Select(selCase)
388357
if !ok {

0 commit comments

Comments
 (0)