func GetFailedContainerNames(containers []core.ContainerStatus) []string {
	var failedContainers []string
	for _, c := range containers {
		if IsContainerFailed(&c) {
			failedContainers = append(failedContainers, c.Name)
		}
	}
	return failedContainers
}
GetFailedContainerNames returns list of failed containers from provided list of statuses.
package k8sutil
import core "k8s.io/api/core/v1"
func GetContainerByName(p *core.Pod, name string) (core.Container, bool) {
	for _, c := range p.Spec.Containers {
		if c.Name == name {
			return c, true
		}
	}
	return core.Container{}, false
}
func GetContainerStatusByName(p *core.Pod, name string) (core.ContainerStatus, bool) {
	for _, c := range p.Status.ContainerStatuses {
		if c.Name == name {
			return c, true
		}
	}
	return core.ContainerStatus{}, false
}
func GetAnyContainerByName(containers []core.Container, name string) (core.Container, bool) {
	for _, c := range containers {
		if c.Name == name {
			return c, true
		}
	}
	return core.Container{}, false
}
func GetAnyContainerStatusByName(containers []core.ContainerStatus, name string) (core.ContainerStatus, bool) {
	for _, c := range containers {
		if c.Name == name {
			return c, true
		}
	}
	return core.ContainerStatus{}, false
}