Documentation ¶
Index ¶
Constants ¶
const EndOfTransmission = "\u0004"
Variables ¶
This section is empty.
Functions ¶
func CreateAttachHandler ¶
CreateAttachHandler is called from main for /api/sockjs
func WaitForTerminal ¶
func WaitForTerminal(k8sClient kubernetes.Interface, cfg *rest.Config, ref ContainerRef)
WaitForTerminal is called from apihandler.handleAttach as a goroutine Waits for the SockJS connection to be opened by the client the session to be bound in handleTerminalSession
Types ¶
type ContainerRef ¶
type ContainerRef struct { Environment string Cluster string ClusterID uint Namespace string Pod string Container string RandomID string }
func ParseContainerRef ¶
func ParseContainerRef(str string) (ContainerRef, error)
func (ContainerRef) String ¶
func (ref ContainerRef) String() string
type Controller ¶
type Controller interface { GetTerminalID(ctx context.Context, clusterID uint, podName, containerName string) (*SessionIDResp, error) GetSockJSHandler(ctx context.Context, sessionID string) (http.Handler, error) // CreateShell returns sessionID and sockJSHandler according to clusterID,podName,containerName CreateShell(ctx context.Context, clusterID uint, podName, containerName string) (sessionID string, sockJSHandler http.Handler, err error) }
func NewController ¶
func NewController(param *param.Param) Controller
type Message ¶
Message is the messaging protocol between ShellController and TerminalSession.
OP DIRECTION FIELD(S) USED DESCRIPTION --------------------------------------------------------------------- bind fe->be SessionID Id sent back from TerminalResponse stdin fe->be Data Keystrokes/paste buffer resize fe->be Rows, Cols New terminal size stdout be->fe Data Output from the process toast be->fe Data OOB message to be shown to the user
type PtyHandler ¶
type PtyHandler interface { io.Reader io.Writer remotecommand.TerminalSizeQueue }
PtyHandler is what remotecommand expects from a pty
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
Session implements PtyHandler (using a SockJS connection)
func (Session) Next ¶
func (t Session) Next() *remotecommand.TerminalSize
TerminalSize handles pty->process resize events Called in a loop from remotecommand as long as the process is running
func (Session) Read ¶
Read handles pty->process messages (stdin, resize) Called in a loop from remotecommand as long as the process is running
type SessionIDResp ¶
type SessionIDResp struct {
ID string `json:"id"`
}
type SessionMap ¶
SessionMap stores a map of all TerminalSession objects and a lock to avoid concurrent conflict
func (*SessionMap) Close ¶
func (sm *SessionMap) Close(sessionID string, status uint32, reason string)
Close shuts down the SockJS connection and sends the status code and reason to the client Can happen if the process exits or if there is an error starting up the process For now the status code is unused and reason is shown to the user (unless "")
func (*SessionMap) Get ¶
func (sm *SessionMap) Get(sessionID string) Session
Get return a given terminalSession by sessionId
func (*SessionMap) Set ¶
func (sm *SessionMap) Set(sessionID string, session Session)
Set store a TerminalSession to SessionMap