From 4ae234d01d6930fea01fd5daa5c512d0f6514ba4 Mon Sep 17 00:00:00 2001 From: Eswar Rajan Subramanian Date: Thu, 24 Nov 2022 11:26:36 +0530 Subject: [PATCH] Fix for k8s Networkpolicy not getting generated for CIDRs 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) {