Documentation ¶
Overview ¶
Package terminal implements the functions for all terminal interactions in the frontend. These includes to get a shell into a Pod, SSH sessions for a Node and the streaming of log files. The implementation is very similar to the implementation in the "Kubernetes Dashboard", you can find the file here: https://github.com/kubernetes/dashboard/blob/master/src/app/backend/handler/terminal.go
Index ¶
Constants ¶
const END_OF_TRANSMISSION = "\u0004"
Variables ¶
This section is empty.
Functions ¶
func IsValidShell ¶
IsValidShell checks if the user provided shell is an allowed one.
func StartProcess ¶
StartProcess executes the given command (cmd) in the container specified in the request and connects it up with the ptyHandler (a session).
Types ¶
type Message ¶
Message is the messaging protocol between the shell and terminal session.
OP DIRECTION FIELD(S) USED DESCRIPTION --------------------------------------------------------------------- stdin fe->be Data Keystrokes/paste buffer resize fe->be Rows, Cols New terminal size stdout be->fe Data Output from the process
type PtyHandler ¶
type PtyHandler interface { io.Reader io.Writer remotecommand.TerminalSizeQueue }
PtyHandler is what remotecommand expects from a pty.
type Session ¶
type Session struct { WebSocket *websocket.Conn SizeChan chan remotecommand.TerminalSize DoneChan chan struct{} }
Session implements PtyHandler (using a WebSocket connection).
func (Session) Next ¶
func (t Session) Next() *remotecommand.TerminalSize
Next is called in a loop from remotecommand as long as the process is running. TerminalSize handles pty->process resize events.