From 102a9ae32cb2370f47777d6c21771b7fa5dead99 Mon Sep 17 00:00:00 2001 From: fuchanghai <33984497+fuchanghai@users.noreply.github.com> Date: Fri, 7 Jul 2023 12:53:16 +0800 Subject: [PATCH] [Fix-14447][K8S Task] Fix IndexOutofBoundsException for pod name without dash (#14448) --- .../apache/dolphinscheduler/plugin/task/api/utils/K8sUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/utils/K8sUtils.java b/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/utils/K8sUtils.java index c50596bb02..ee281a371f 100644 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/utils/K8sUtils.java +++ b/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/utils/K8sUtils.java @@ -98,7 +98,7 @@ public class K8sUtils { String podName = null; for (Pod pod : podList) { podName = pod.getMetadata().getName(); - if (jobName.equals(podName.substring(0, pod.getMetadata().getName().lastIndexOf("-")))) { + if (podName.contains("-") && jobName.equals(podName.substring(0, podName.lastIndexOf("-")))) { break; } }