mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 13:37:30 +00:00
Merge pull request #26693 from AdoHe/init_containers
Automatic merge from submit-queue exec support init containers Partially fixes #25818 @smarterclayton ptal.
This commit is contained in:
commit
525140a278
@ -100,7 +100,7 @@ kubectl exec 123456-7890 -c ruby-container -i -t -- bash -il
|
|||||||
|
|
||||||
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
|
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra on 5-Apr-2016
|
###### Auto generated by spf13/cobra on 3-Jun-2016
|
||||||
|
|
||||||
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
|
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
|
||||||
[]()
|
[]()
|
||||||
|
@ -174,10 +174,6 @@ func (p *ExecOptions) Run() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if pod.Status.Phase != api.PodRunning {
|
|
||||||
return fmt.Errorf("pod %s is not running and cannot execute commands; current phase is %s", p.PodName, pod.Status.Phase)
|
|
||||||
}
|
|
||||||
|
|
||||||
containerName := p.ContainerName
|
containerName := p.ContainerName
|
||||||
if len(containerName) == 0 {
|
if len(containerName) == 0 {
|
||||||
glog.V(4).Infof("defaulting container name to %s", pod.Spec.Containers[0].Name)
|
glog.V(4).Infof("defaulting container name to %s", pod.Spec.Containers[0].Name)
|
||||||
|
@ -332,6 +332,11 @@ func podHasContainerWithName(pod *api.Pod, containerName string) bool {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for _, c := range pod.Spec.InitContainers {
|
||||||
|
if c.Name == containerName {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user