mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 06:27:05 +00:00
improve GetExistingContainerStatus
remove duplicate Signed-off-by: yanxuean <yan.xuean@zte.com.cn>
This commit is contained in:
parent
09ccecfe9c
commit
9770ff9082
@ -205,14 +205,10 @@ func GetContainerStatus(statuses []v1.ContainerStatus, name string) (v1.Containe
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetExistingContainerStatus extracts the status of container "name" from "statuses",
|
// GetExistingContainerStatus extracts the status of container "name" from "statuses",
|
||||||
// and returns empty status if "name" does not exist.
|
// It also returns if "name" exists.
|
||||||
func GetExistingContainerStatus(statuses []v1.ContainerStatus, name string) v1.ContainerStatus {
|
func GetExistingContainerStatus(statuses []v1.ContainerStatus, name string) v1.ContainerStatus {
|
||||||
for i := range statuses {
|
status, _ := GetContainerStatus(statuses, name)
|
||||||
if statuses[i].Name == name {
|
return status
|
||||||
return statuses[i]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return v1.ContainerStatus{}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsPodAvailable returns true if a pod is available; false otherwise.
|
// IsPodAvailable returns true if a pod is available; false otherwise.
|
||||||
|
Loading…
Reference in New Issue
Block a user