@@ -801,7 +801,7 @@ func WaitForPodScheduled(ctx context.Context, c clientset.Interface, namespace,
801
801
func WaitForPodContainerStarted (ctx context.Context , c clientset.Interface , namespace , podName string , containerIndex int , timeout time.Duration ) error {
802
802
conditionDesc := fmt .Sprintf ("container %d started" , containerIndex )
803
803
return WaitForPodCondition (ctx , c , namespace , podName , conditionDesc , timeout , func (pod * v1.Pod ) (bool , error ) {
804
- if containerIndex > len (pod .Status .ContainerStatuses )- 1 {
804
+ if containerIndex >= len (pod .Status .ContainerStatuses ) {
805
805
return false , nil
806
806
}
807
807
containerStatus := pod .Status .ContainerStatuses [containerIndex ]
@@ -813,7 +813,7 @@ func WaitForPodContainerStarted(ctx context.Context, c clientset.Interface, name
813
813
func WaitForPodInitContainerStarted (ctx context.Context , c clientset.Interface , namespace , podName string , initContainerIndex int , timeout time.Duration ) error {
814
814
conditionDesc := fmt .Sprintf ("init container %d started" , initContainerIndex )
815
815
return WaitForPodCondition (ctx , c , namespace , podName , conditionDesc , timeout , func (pod * v1.Pod ) (bool , error ) {
816
- if initContainerIndex > len (pod .Status .InitContainerStatuses )- 1 {
816
+ if initContainerIndex >= len (pod .Status .InitContainerStatuses ) {
817
817
return false , nil
818
818
}
819
819
initContainerStatus := pod .Status .InitContainerStatuses [initContainerIndex ]
0 commit comments