Merge pull request #93225 from hasheddan/storage-panic

Return error instead of panic if container index outside bounds
This commit is contained in:
Kubernetes Prow Robot 2020-07-21 09:15:15 -07:00 committed by GitHub
commit a1a2f8c5f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1059,6 +1059,9 @@ func formatVolume(f *framework.Framework, pod *v1.Pod) {
}
func podContainerExec(pod *v1.Pod, containerIndex int, command string) (string, error) {
if containerIndex > len(pod.Spec.Containers)-1 {
return "", fmt.Errorf("container not found in pod: index %d", containerIndex)
}
var shell string
var option string
if framework.NodeOSDistroIs("windows") {