k8s

package
v0.0.0-...-b35005d Latest Latest
Warning

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

Go to latest
Published: May 18, 2023 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const END_OF_TRANSMISSION = "\u0004"

Variables

This section is empty.

Functions

This section is empty.

Types

type NamespaceService

type NamespaceService struct{}

func (*NamespaceService) DeleteNamespace

func (nss *NamespaceService) DeleteNamespace(name string) error

DeleteNamespace 删除namespace

func (*NamespaceService) GetNamespaceDetail

func (nss *NamespaceService) GetNamespaceDetail(name string) (*k8sResponse.NamespaceDetail, error)

GetNamespaceDetail 获取某个namespace详情

func (*NamespaceService) GetNamespaceList

func (nss *NamespaceService) GetNamespaceList(info request.PageInfo) ([]k8sResponse.NamespaceBrief, int, error)

GetNamespaceList 获取namespace list

func (*NamespaceService) GetNamespaceName

func (nss *NamespaceService) GetNamespaceName() ([]string, error)

GetNamespaceName 获取命名空间名称

type NodeService

type NodeService struct{}

func (*NodeService) GetNodeDetail

func (n *NodeService) GetNodeDetail(name string) (*modelK8s.NodeDetail, error)

func (*NodeService) GetNodePods

func (n *NodeService) GetNodePods(name string, info request.PageInfo) ([]modelK8s.RelatedPod, int64, error)

GetNodePods 获取节点上的pod信息

func (*NodeService) GetNodes

func (n *NodeService) GetNodes(info request.PageInfo) ([]k8sResp.NodeBrief, int, error)

type PodService

type PodService struct{}

func (*PodService) DeletePod

func (ps *PodService) DeletePod(namespace string, pod string) error

DeletePod 删除pod

func (*PodService) GetPodDetail

func (ps *PodService) GetPodDetail(namespace string, pod string) (*modelK8s.PodDetail, error)

GetPodDetail 获取指定pod详情

func (*PodService) GetPodLog

func (ps *PodService) GetPodLog(namespace string, pod string, container string, lines int64, follow bool) (string, error)

GetPodLog 获取pod日志

func (*PodService) GetPodWebSSH

func (ps *PodService) GetPodWebSSH(namespace string, podName string, containerName string, cfg *rest.Config, ptyHandler PtyHandler) error

GetPodWebSSH pod webSSH

func (*PodService) GetPods

func (ps *PodService) GetPods(namespace string, page int, pageSize int) ([]modelK8s.PodBrief, int, error)

GetPods 获取集群pods

func (*PodService) NewTerminalSession

func (ps *PodService) NewTerminalSession(conn *websocket.Conn) (*TerminalSession, error)

type PtyHandler

type PtyHandler interface {
	io.Reader
	io.Writer
	remotecommand.TerminalSizeQueue
}

PtyHandler is what remoteCommand expects from a pty

type ResourceService

type ResourceService struct{}

func (*ResourceService) GetResourceRaw

func (rs *ResourceService) GetResourceRaw(name string, resource string, namespace string) (raw interface{}, err error)

type TerminalMessage

type TerminalMessage struct {
	Op   string `json:"op"`
	Data string `json:"data"`
	//SessionID string `json:"sessionID"`
	Rows uint16 `json:"rows"`
	Cols uint16 `json:"cols"`
}

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
}

func (*TerminalSession) Close

func (t *TerminalSession) Close() error

Close session

func (*TerminalSession) Next

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

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

Write 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