fix: correct pod matching logic from endsWith to contains
Build & Test (NowChessSystems) TeamCity build finished

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 <noreply@anthropic.com>
This commit is contained in:
2026-05-17 19:56:22 +02:00
parent 6311d8fd00
commit 6dbe1e62ac
@@ -131,7 +131,7 @@ class HealthMonitor:
pods.exists { pod => pods.exists { pod =>
val podName = pod.getMetadata.getName val podName = pod.getMetadata.getName
podName.endsWith(instanceId) && isPodReady(pod) podName.contains(instanceId) && isPodReady(pod)
} }
catch catch
case ex: Exception => case ex: Exception =>
@@ -185,7 +185,7 @@ class HealthMonitor:
.getItems .getItems
.asScala .asScala
pods.find(pod => pod.getMetadata.getName.endsWith(instanceId)) match pods.find(pod => pod.getMetadata.getName.contains(instanceId)) match
case Some(pod) => case Some(pod) =>
val podName = pod.getMetadata.getName val podName = pod.getMetadata.getName
kube.pods().inNamespace(config.k8sNamespace).withName(podName).withGracePeriod(0L).delete() kube.pods().inNamespace(config.k8sNamespace).withName(podName).withGracePeriod(0L).delete()
@@ -244,4 +244,4 @@ class HealthMonitor:
private def findRegisteredInstance(pod: Pod): Option[InstanceMetadata] = private def findRegisteredInstance(pod: Pod): Option[InstanceMetadata] =
val podName = pod.getMetadata.getName val podName = pod.getMetadata.getName
instanceRegistry.getAllInstances.find(inst => podName.endsWith(inst.instanceId)) instanceRegistry.getAllInstances.find(inst => podName.contains(inst.instanceId))