From 6dbe1e62ac74f4ddbf03049b20184f7fac793f81 Mon Sep 17 00:00:00 2001 From: Janis Date: Sun, 17 May 2026 19:56:22 +0200 Subject: [PATCH] fix: correct pod matching logic from endsWith to contains Pod matching used endsWith(instanceId) which failed to match any pods because instanceId is randomly generated 8-char string, not pod name suffix. All instances marked dead causing cascading health check failures. Changed to podName.contains(instanceId) to match instanceId embedded anywhere in pod name. Reverting incomplete fix from previous commit. Co-Authored-By: Claude Haiku 4.5 --- .../de/nowchess/coordinator/service/HealthMonitor.scala | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/coordinator/src/main/scala/de/nowchess/coordinator/service/HealthMonitor.scala b/modules/coordinator/src/main/scala/de/nowchess/coordinator/service/HealthMonitor.scala index 0ddc215..202177d 100644 --- a/modules/coordinator/src/main/scala/de/nowchess/coordinator/service/HealthMonitor.scala +++ b/modules/coordinator/src/main/scala/de/nowchess/coordinator/service/HealthMonitor.scala @@ -131,7 +131,7 @@ class HealthMonitor: pods.exists { pod => val podName = pod.getMetadata.getName - podName.endsWith(instanceId) && isPodReady(pod) + podName.contains(instanceId) && isPodReady(pod) } catch case ex: Exception => @@ -185,7 +185,7 @@ class HealthMonitor: .getItems .asScala - pods.find(pod => pod.getMetadata.getName.endsWith(instanceId)) match + pods.find(pod => pod.getMetadata.getName.contains(instanceId)) match case Some(pod) => val podName = pod.getMetadata.getName kube.pods().inNamespace(config.k8sNamespace).withName(podName).withGracePeriod(0L).delete() @@ -244,4 +244,4 @@ class HealthMonitor: private def findRegisteredInstance(pod: Pod): Option[InstanceMetadata] = val podName = pod.getMetadata.getName - instanceRegistry.getAllInstances.find(inst => podName.endsWith(inst.instanceId)) + instanceRegistry.getAllInstances.find(inst => podName.contains(inst.instanceId))