component status

This commit is contained in:
jeff
2018-11-08 11:29:42 +08:00
parent 1b15e5e774
commit 3a38a83dd2

View File

@@ -64,10 +64,12 @@ func GetComponentStatus(namespace string, componentName string) (interface{}, er
return nil, err
} else {
for _, v := range pods.Items {
component.TotalBackends++
component.HealthyBackends++
for _, c := range v.Status.ContainerStatuses {
component.TotalBackends++
if c.Ready {
component.HealthyBackends++
if !c.Ready {
component.HealthyBackends--
break
}
}
}
@@ -118,10 +120,12 @@ func GetAllComponentsStatus() (map[string]interface{}, error) {
continue
} else {
for _, v := range pods.Items {
component.TotalBackends++
component.HealthyBackends++
for _, c := range v.Status.ContainerStatuses {
component.TotalBackends++
if c.Ready {
component.HealthyBackends++
if !c.Ready {
component.HealthyBackends--
break
}
}
}