mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 14:37:00 +00:00
Merge pull request #93225 from hasheddan/storage-panic
Return error instead of panic if container index outside bounds
This commit is contained in:
commit
a1a2f8c5f8
@ -1059,6 +1059,9 @@ func formatVolume(f *framework.Framework, pod *v1.Pod) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func podContainerExec(pod *v1.Pod, containerIndex int, command string) (string, error) {
|
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 shell string
|
||||||
var option string
|
var option string
|
||||||
if framework.NodeOSDistroIs("windows") {
|
if framework.NodeOSDistroIs("windows") {
|
||||||
|
Loading…
Reference in New Issue
Block a user