From 0291ccd995f5a968e79d150671b7d39d19db8c34 Mon Sep 17 00:00:00 2001 From: tamanoha Date: Fri, 17 Feb 2023 13:27:09 -0800 Subject: [PATCH] update podInfo key as containerid instead of name and namespace --- cns/service/main.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cns/service/main.go b/cns/service/main.go index a5b3178f21..fa8526d6d0 100644 --- a/cns/service/main.go +++ b/cns/service/main.go @@ -728,6 +728,13 @@ func main() { cns.GlobalPodInfoScheme = cns.InterfaceIDPodInfoScheme } } + // If cns manageendpointstate is true, then cns maintains its own state and reconciles from it. + // in this case, cns maintains state with containerid as key and so in-memory cache can lookup + // and update based on container id. + if cnsconfig.ManageEndpointState { + cns.GlobalPodInfoScheme = cns.InterfaceIDPodInfoScheme + } + logger.Printf("Set GlobalPodInfoScheme %v (InitializeFromCNI=%t)", cns.GlobalPodInfoScheme, cnsconfig.InitializeFromCNI) err = InitializeCRDState(rootCtx, httpRestService, cnsconfig) @@ -735,7 +742,6 @@ func main() { logger.Errorf("Failed to start CRD Controller, err:%v.\n", err) return } - } // Initialize multi-tenant controller if the CNS is running in MultiTenantCRD mode.