From 42ac6ad92fd7ad7d9cc5ababeb892c5d7cc82f61 Mon Sep 17 00:00:00 2001 From: David Wertenteil Date: Mon, 22 Jan 2024 09:20:37 +0200 Subject: [PATCH 1/2] Do not patch when server is unavailable Signed-off-by: David Wertenteil --- pkg/networkmanager/network_manager.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/networkmanager/network_manager.go b/pkg/networkmanager/network_manager.go index 0f95e55d..b9c6c400 100644 --- a/pkg/networkmanager/network_manager.go +++ b/pkg/networkmanager/network_manager.go @@ -305,6 +305,12 @@ func (am *NetworkManager) handleNetworkEvents(ctx context.Context, container *co namespace := wlid.GetNamespaceFromWlid(parentWlid) networkNeighborsExists := false networkNeighbors, err := am.storageClient.GetNetworkNeighbors(namespace, name) + if err != nil { + if !strings.Contains(err.Error(), "the server is currently unable to handle the request") { + logger.L().Warning("NetworkManager - failed to update network neighbor", helpers.String("reason", err.Error()), helpers.String("container ID", container.Runtime.ContainerID), helpers.String("k8s workload", watchedContainer.K8sContainerID)) + return + } + } if err == nil { networkNeighborsExists = true } From eb4a87065c1335036dea60d31c88245543cfd19f Mon Sep 17 00:00:00 2001 From: David Wertenteil Date: Mon, 22 Jan 2024 09:38:40 +0200 Subject: [PATCH 2/2] fix err condition Signed-off-by: David Wertenteil --- pkg/networkmanager/network_manager.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/networkmanager/network_manager.go b/pkg/networkmanager/network_manager.go index b9c6c400..fd70972e 100644 --- a/pkg/networkmanager/network_manager.go +++ b/pkg/networkmanager/network_manager.go @@ -306,7 +306,7 @@ func (am *NetworkManager) handleNetworkEvents(ctx context.Context, container *co networkNeighborsExists := false networkNeighbors, err := am.storageClient.GetNetworkNeighbors(namespace, name) if err != nil { - if !strings.Contains(err.Error(), "the server is currently unable to handle the request") { + if strings.Contains(err.Error(), "the server is currently unable to handle the request") { logger.L().Warning("NetworkManager - failed to update network neighbor", helpers.String("reason", err.Error()), helpers.String("container ID", container.Runtime.ContainerID), helpers.String("k8s workload", watchedContainer.K8sContainerID)) return }