Skip to content

Commit

Permalink
fix: region component status failure (#2089)
Browse files Browse the repository at this point in the history
Signed-off-by: 张启航 <[email protected]>
  • Loading branch information
ZhangSetSail authored Dec 5, 2024
1 parent 5725011 commit ce92a9b
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion api/handler/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,17 @@ func (c *clusterAction) ListRainbondComponents(ctx context.Context) (res []*mode
appNameMap[appName]++
pods[appName] = append(pods[appName], pod)
if pod.Status.Phase == "Running" {
ComponentRunPods[appName]++
// 检查容器是否处于等待或崩溃重启状态
isContainerRunning := true
for _, containerStatus := range pod.Status.ContainerStatuses {
if containerStatus.State.Waiting != nil && containerStatus.State.Waiting.Reason == "CrashLoopBackOff" {
isContainerRunning = false
break
}
}
if isContainerRunning {
ComponentRunPods[appName]++
}
}
ComponentAllPods[appName]++
}
Expand Down

0 comments on commit ce92a9b

Please sign in to comment.