Skip to content

Commit

Permalink
Ignore 404 when deleting defunct K8S pod (#9194)
Browse files Browse the repository at this point in the history
Ignore 404 when deleting defunct K8S pod.
  • Loading branch information
tomachristian authored Oct 20, 2024
1 parent 2f0c339 commit 474ea78
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Orleans.Hosting.Kubernetes/KubernetesClusterAgent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Threading;
using System.Threading.Tasks;

Expand Down Expand Up @@ -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);
}
}
}
}
Expand Down

0 comments on commit 474ea78

Please sign in to comment.