From ae4eaf7d40d581ab48d5d9941a108bc288cfc547 Mon Sep 17 00:00:00 2001 From: Eswar Rajan <89014588+seswarrajan@users.noreply.github.com> Date: Thu, 24 Nov 2022 12:10:17 +0530 Subject: [PATCH] Fix for k8s Networkpolicy not getting generated for CIDRs (#607) Signed-off-by: Eswar Rajan Subramanian --- src/networkpolicy/networkPolicy.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/networkpolicy/networkPolicy.go b/src/networkpolicy/networkPolicy.go index 8997033f..b9b55ea4 100644 --- a/src/networkpolicy/networkPolicy.go +++ b/src/networkpolicy/networkPolicy.go @@ -1944,6 +1944,10 @@ func convertKnoxNetworkLogToKnoxNetworkPolicy(log *types.KnoxNetworkLog, pods [] } else if log.Direction == "INGRESS" { ingressPolicy = &iePolicy } + // Update namespace + if iePolicy.Metadata["status"] == "latest" { + iePolicy.Metadata["namespace"] = log.SrcNamespace + } } if !isValidPolicy(ingressPolicy) {