Version: v0.0.0-...-82ec70f Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Oct 14, 2021 License: Apache-2.0 Imports: 25 Imported by: 0




View Source
const END_OF_TRANSMISSION = "\u0004"


This section is empty.


func CreateAttachHandler

func CreateAttachHandler(path string) http.Handler

CreateAttachHandler is called from main for /api/sockjs

func WaitForTerminal

func WaitForTerminal(k8sClient kubernetes.Interface, cfg *rest.Config, namespace, podName, containerName, sessionId string)

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


type Handler

type Handler struct {
	// contains filtered or unexported fields

Handler .

func NewHandler

func NewHandler(
	restConfig *rest.Config,
	kubeClient *clientset.Clientset,
	crdClientset *crdclientset.Clientset,
) *Handler

NewHandler returns a new handler.

func (*Handler) CreateDeployment

func (h *Handler) CreateDeployment(c *gin.Context)

CreateDeployment create a deployment.

func (*Handler) CreateFLApp

func (h *Handler) CreateFLApp(c *gin.Context)

CreateFLApp .

func (*Handler) CreateIngress

func (h *Handler) CreateIngress(c *gin.Context)

CreateIngress create a ingress.

func (*Handler) CreateSecret

func (h *Handler) CreateSecret(c *gin.Context)

CreateSecret create a secret.

func (*Handler) CreateService

func (h *Handler) CreateService(c *gin.Context)

CreateService create a service.

func (*Handler) DeleteDeployment

func (h *Handler) DeleteDeployment(c *gin.Context)

DeleteDeployment delete a deployment with name.

func (*Handler) DeleteFLApp

func (h *Handler) DeleteFLApp(c *gin.Context)

DeleteFLApp .

func (*Handler) DeleteIngress

func (h *Handler) DeleteIngress(c *gin.Context)

DeleteIngress delete a ingress with name.

func (*Handler) DeleteSecret

func (h *Handler) DeleteSecret(c *gin.Context)

DeleteSecret delete a secret with name.

func (*Handler) DeleteService

func (h *Handler) DeleteService(c *gin.Context)

DeleteService delete a service with name.

func (*Handler) ExecShell

func (h *Handler) ExecShell(c *gin.Context)

func (*Handler) GetDeployment

func (h *Handler) GetDeployment(c *gin.Context)

GetDeployment returns a deloyment with name.

func (*Handler) GetFLApp

func (h *Handler) GetFLApp(c *gin.Context)

GetFLApp .

func (*Handler) GetIngress

func (h *Handler) GetIngress(c *gin.Context)

GetIngress returns a ingress with name.

func (*Handler) GetPod

func (h *Handler) GetPod(c *gin.Context)

GetPod returns a pod with name.

func (*Handler) GetSecret

func (h *Handler) GetSecret(c *gin.Context)

GetSecret returns a secret with name.

func (*Handler) GetService

func (h *Handler) GetService(c *gin.Context)

GetService returns a service with name.

func (*Handler) ListDeployments

func (h *Handler) ListDeployments(c *gin.Context)

ListDeployments returns services in namespace.

func (*Handler) ListFLAppPods

func (h *Handler) ListFLAppPods(c *gin.Context)

ListFLAppPods .

func (*Handler) ListFLApps

func (h *Handler) ListFLApps(c *gin.Context)

ListFLApps .

func (*Handler) ListIngresses

func (h *Handler) ListIngresses(c *gin.Context)

ListIngresses returns ingresses in namespace.

func (*Handler) ListNamespaces

func (h *Handler) ListNamespaces(c *gin.Context)

ListNamespaces .

func (*Handler) ListPodEvents

func (h *Handler) ListPodEvents(c *gin.Context)

ListPodEvents returns pod's events.

func (*Handler) ListPods

func (h *Handler) ListPods(c *gin.Context)

ListPods returns pods in namespace.

func (*Handler) ListSecrets

func (h *Handler) ListSecrets(c *gin.Context)

ListSecrets returns secrets in namespace.

func (*Handler) ListServices

func (h *Handler) ListServices(c *gin.Context)

ListServices returns services in namespace.

func (*Handler) Run

func (h *Handler) Run(stopCh <-chan struct{}) error

Run .

func (*Handler) UpdateDeployment

func (h *Handler) UpdateDeployment(c *gin.Context)

UpdateDeployment update a deployment.

type PtyHandler

type PtyHandler interface {

PtyHandler is what remotecommand expects from a pty

type SessionMap

type SessionMap struct {
	Sessions map[string]TerminalSession
	Lock     sync.RWMutex

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) TerminalSession

Get return a given terminalSession by sessionId

func (*SessionMap) Set

func (sm *SessionMap) Set(sessionId string, session TerminalSession)

Set store a TerminalSession to SessionMap

type TerminalMessage

type TerminalMessage struct {
	Op, Data, SessionID string
	Rows, Cols          uint16

TerminalMessage 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 TerminalSession

type TerminalSession struct {
	// contains filtered or unexported fields

TerminalSession implements PtyHandler (using a SockJS connection)

func (TerminalSession) Next

TerminalSize handles pty->process resize events Called in a loop from remotecommand as long as the process is running

func (TerminalSession) Read

func (t TerminalSession) Read(p []byte) (int, error)

Read handles pty->process messages (stdin, resize) Called in a loop from remotecommand as long as the process is running

func (TerminalSession) Toast

func (t TerminalSession) Toast(p string) error

Toast can be used to send the user any OOB messages hterm puts these in the center of the terminal

func (TerminalSession) Write

func (t TerminalSession) Write(p []byte) (int, error)

Write handles process->pty stdout Called from remotecommand whenever there is any output

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL