mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-04 09:49:50 +00:00
Merge pull request #18501 from feihujiang/printHowToReAttachToSession
Auto commit by PR queue bot
This commit is contained in:
commit
bf5f69bf44
@ -221,7 +221,14 @@ func (p *AttachOptions) Run() error {
|
|||||||
TTY: tty,
|
TTY: tty,
|
||||||
}, api.Scheme)
|
}, api.Scheme)
|
||||||
|
|
||||||
return p.Attach.Attach("POST", req.URL(), p.Config, stdin, p.Out, p.Err, tty)
|
err = p.Attach.Attach("POST", req.URL(), p.Config, stdin, p.Out, p.Err, tty)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if p.Stdin && tty && pod.Spec.RestartPolicy == api.RestartPolicyAlways {
|
||||||
|
fmt.Fprintf(p.Out, "Session ended, resume using 'kubectl attach %s -c %s -i -t' command when the pod is running\n", pod.Name, containerToAttach.Name)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetContainer returns the container to attach to, with a fallback.
|
// GetContainer returns the container to attach to, with a fallback.
|
||||||
|
Loading…
Reference in New Issue
Block a user