pod

package
v0.0.142 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2025 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var WebsocketMessageType = map[int]string{
	websocket.BinaryMessage: "binary",
	websocket.TextMessage:   "text",
	websocket.CloseMessage:  "close",
	websocket.PingMessage:   "ping",
	websocket.PongMessage:   "pong",
}

Functions

func BindPodLogOptions

func BindPodLogOptions(c *gin.Context, containerName string) (*v1.PodLogOptions, error)

func DeleteFile added in v0.0.5

func DeleteFile(c *gin.Context)

func DownloadFile

func DownloadFile(c *gin.Context)

func DownloadLogs

func DownloadLogs(c *gin.Context)

func DownloadPodLogsBySelector

func DownloadPodLogsBySelector(c *gin.Context, ns string, containerName string, options metav1.ListOptions)

func FileList

func FileList(c *gin.Context)

FileList 处理获取文件列表的 HTTP 请求

func PortForwardList added in v0.0.106

func PortForwardList(c *gin.Context)

func SaveFile

func SaveFile(c *gin.Context)

func ShowFile

func ShowFile(c *gin.Context)

ShowFile 处理下载文件的 HTTP 请求

func StartPortForward added in v0.0.106

func StartPortForward(c *gin.Context)

func StopPortForward added in v0.0.106

func StopPortForward(c *gin.Context)

func StreamLogs

func StreamLogs(c *gin.Context)

func StreamPodLogsBySelector

func StreamPodLogsBySelector(c *gin.Context, ns string, containerName string, options metav1.ListOptions)

func TopList added in v0.0.100

func TopList(c *gin.Context)

TopList 返回指定命名空间下所有 Pod 的资源使用情况(CPU、内存等),支持多命名空间查询,并以便于前端排序的格式输出。

func UniqueLabels added in v0.0.49

func UniqueLabels(c *gin.Context)

UniqueLabels 返回当前集群中所有唯一的 Pod 标签键列表,格式化为前端可用的选项数组。

func UploadFile

func UploadFile(c *gin.Context)

UploadFile 处理上传文件的 HTTP 请求

func Usage added in v0.0.18

func Usage(c *gin.Context)

func Xterm added in v0.0.36

func Xterm(c *gin.Context)

Xterm 通过 WebSocket 提供与 Kubernetes Pod 容器的交互式终端会话。 支持 xterm.js 前端,处理终端输入输出、窗口大小调整、命令日志记录和连接保活。 会话结束后可根据参数选择性删除目标 Pod。

Types

type LogQueryParams

type LogQueryParams struct {
	Follow       bool   `form:"follow"`
	Previous     bool   `form:"previous"`
	SinceSeconds *int64 `form:"sinceSeconds"`
	SinceTime    string `form:"sinceTime"` // RFC3339 格式时间字符串
	Timestamps   bool   `form:"timestamps"`
	TailLines    *int64 `form:"tailLines"`
}

type PortInfo added in v0.0.106

type PortInfo struct {
	Cluster       string        `json:"cluster"`
	Namespace     string        `json:"namespace"` // Pod 命名空间
	Name          string        `json:"name"`      // pod名称
	ContainerName string        `json:"container_name"`
	PortName      string        `json:"port_name"`  // 端口名称
	Protocol      string        `json:"protocol"`   // TCP/UDP/STCP
	LocalPort     string        `json:"local_port"` // 本地端口,转发端口
	PodPort       string        `json:"pod_port"`   // pod 端口
	Status        string        `json:"status"`     // running/failed/stopped
	StopCh        chan struct{} `json:"-"`
}

PortInfo 结构体用于描述端口转发信息 包含容器名、端口名、协议、端口号、本地端口、转发状态等

type TTYSize added in v0.0.36

type TTYSize struct {
	Cols uint16 `json:"cols"`
	Rows uint16 `json:"rows"`
	X    uint16 `json:"x"`
	Y    uint16 `json:"y"`
}

type TerminalSizeQueue added in v0.0.36

type TerminalSizeQueue struct {
	sync.Mutex
	// contains filtered or unexported fields
}

TerminalSizeQueue 维护 TTY 终端大小

func (*TerminalSizeQueue) Next added in v0.0.36

func (*TerminalSizeQueue) Push added in v0.0.36

func (t *TerminalSizeQueue) Push(cols, rows uint16)

Jump to

Keyboard shortcuts

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