Skip to content
This repository was archived by the owner on Feb 8, 2021. It is now read-only.

Commit 1cfcb24

Browse files
committed
exec support init container
1 parent 77de942 commit 1cfcb24

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

docs/user-guide/kubectl/kubectl_exec.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ kubectl exec 123456-7890 -c ruby-container -i -t -- bash -il
100100

101101
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
102102

103-
###### Auto generated by spf13/cobra on 5-Apr-2016
103+
###### Auto generated by spf13/cobra on 3-Jun-2016
104104

105105
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
106106
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_exec.md?pixel)]()

pkg/kubectl/cmd/exec.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,6 @@ func (p *ExecOptions) Run() error {
174174
return err
175175
}
176176

177-
if pod.Status.Phase != api.PodRunning {
178-
return fmt.Errorf("pod %s is not running and cannot execute commands; current phase is %s", p.PodName, pod.Status.Phase)
179-
}
180-
181177
containerName := p.ContainerName
182178
if len(containerName) == 0 {
183179
glog.V(4).Infof("defaulting container name to %s", pod.Spec.Containers[0].Name)

pkg/registry/pod/strategy.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,11 @@ func podHasContainerWithName(pod *api.Pod, containerName string) bool {
332332
return true
333333
}
334334
}
335+
for _, c := range pod.Spec.InitContainers {
336+
if c.Name == containerName {
337+
return true
338+
}
339+
}
335340
return false
336341
}
337342

0 commit comments

Comments
 (0)