... | ... |
@@ -519,10 +519,14 @@ func (o *DebugOptions) createPod(pod *kapi.Pod) (*kapi.Pod, error) { |
519 | 519 |
|
520 | 520 |
func containerForName(pod *kapi.Pod, name string) *kapi.Container { |
521 | 521 |
for i, c := range pod.Spec.Containers { |
522 |
- if c.Name != name { |
|
523 |
- continue |
|
522 |
+ if c.Name == name { |
|
523 |
+ return &pod.Spec.Containers[i] |
|
524 |
+ } |
|
525 |
+ } |
|
526 |
+ for i, c := range pod.Spec.InitContainers { |
|
527 |
+ if c.Name == name { |
|
528 |
+ return &pod.Spec.InitContainers[i] |
|
524 | 529 |
} |
525 |
- return &pod.Spec.Containers[i] |
|
526 | 530 |
} |
527 | 531 |
return nil |
528 | 532 |
} |