From 7197b6c471e79dfda59236910a186a0a0c0a19ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E5=90=AF=E8=88=AA?= <101104760+ZhangSetSail@users.noreply.github.com> Date: Sat, 16 Nov 2024 01:17:14 +0800 Subject: [PATCH] fix: cronjob start failure MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张启航 <101104760+ZhangSetSail@users.noreply.github.com> --- worker/appm/types/v1/status.go | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/worker/appm/types/v1/status.go b/worker/appm/types/v1/status.go index e6635ec79..724597367 100644 --- a/worker/appm/types/v1/status.go +++ b/worker/appm/types/v1/status.go @@ -191,9 +191,12 @@ func (a *AppService) GetServiceStatus() string { } return RUNNING } - if a.job != nil { + if a.cronjob != nil { succeed := 0 failed := 0 + if len(a.pods) == 0 { + return RUNNING + } for _, po := range a.pods { if po.Status.Phase == "Succeeded" { succeed++ @@ -203,19 +206,17 @@ func (a *AppService) GetServiceStatus() string { } } if len(a.pods) == succeed { - return SUCCEEDED + return RUNNING } if failed > 0 { return ABNORMAL } return RUNNING } - if a.cronjob != nil { + + if a.job != nil { succeed := 0 failed := 0 - if len(a.pods) == 0 { - return RUNNING - } for _, po := range a.pods { if po.Status.Phase == "Succeeded" { succeed++ @@ -225,13 +226,14 @@ func (a *AppService) GetServiceStatus() string { } } if len(a.pods) == succeed { - return RUNNING + return SUCCEEDED } if failed > 0 { return ABNORMAL } return RUNNING } + if a.statefulset == nil && a.deployment == nil && len(a.pods) > 0 { return STOPPING }