From 9ddb89e5e4952ee3f5079b1ed113631d71c33541 Mon Sep 17 00:00:00 2001 From: Cristian Toma Date: Sun, 20 Oct 2024 17:08:33 +0300 Subject: [PATCH] Ignore 404 when deleting defunct K8S pod. --- src/Orleans.Hosting.Kubernetes/KubernetesClusterAgent.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Orleans.Hosting.Kubernetes/KubernetesClusterAgent.cs b/src/Orleans.Hosting.Kubernetes/KubernetesClusterAgent.cs index 98ba7e6bd8..89bab4cdb6 100644 --- a/src/Orleans.Hosting.Kubernetes/KubernetesClusterAgent.cs +++ b/src/Orleans.Hosting.Kubernetes/KubernetesClusterAgent.cs @@ -8,6 +8,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Net; using System.Threading; using System.Threading.Tasks; @@ -257,7 +258,11 @@ private async Task MonitorOrleansClustering() } catch (Exception exception) { - _logger.LogError(exception, "Error deleting pod {PodName} in namespace {PodNamespace} corresponding to defunct silo {SiloAddress}", change.Name, _podNamespace, change.SiloAddress); + // Ignore NotFound errors, as the pod may have already been deleted by other means + if (exception is not HttpOperationException { Response.StatusCode: HttpStatusCode.NotFound }) + { + _logger.LogError(exception, "Error deleting pod {PodName} in namespace {PodNamespace} corresponding to defunct silo {SiloAddress}", change.Name, _podNamespace, change.SiloAddress); + } } } }