mirror of https://github.com/k3s-io/k3s
Add pod-terminated check to kubectl-exec
Fixes https://github.com/openshift/origin/issues/8472#event-681794952pull/6/head
parent
1aece22176
commit
734f05057e
|
@ -174,6 +174,10 @@ func (p *ExecOptions) Run() error {
|
|||
return err
|
||||
}
|
||||
|
||||
if pod.Status.Phase == api.PodSucceeded || pod.Status.Phase == api.PodFailed {
|
||||
return fmt.Errorf("cannot exec into a container in a completed pod; current phase is %s", pod.Status.Phase)
|
||||
}
|
||||
|
||||
containerName := p.ContainerName
|
||||
if len(containerName) == 0 {
|
||||
glog.V(4).Infof("defaulting container name to %s", pod.Spec.Containers[0].Name)
|
||||
|
|
Loading…
Reference in New Issue