pod

package
v0.0.155 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2025 License: MIT Imports: 31 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 RegisterLabelRoutes added in v0.0.145

func RegisterLabelRoutes(api *gin.RouterGroup)

func RegisterLogRoutes added in v0.0.145

func RegisterLogRoutes(api *gin.RouterGroup)

func RegisterPodFileRoutes added in v0.0.145

func RegisterPodFileRoutes(api *gin.RouterGroup)

func RegisterPortRoutes added in v0.0.145

func RegisterPortRoutes(api *gin.RouterGroup)

func RegisterResourceRoutes added in v0.0.145

func RegisterResourceRoutes(api *gin.RouterGroup)

func RegisterXtermRoutes added in v0.0.145

func RegisterXtermRoutes(api *gin.RouterGroup)

Types

type FileController added in v0.0.145

type FileController struct{}

func (*FileController) Delete added in v0.0.145

func (fc *FileController) Delete(c *gin.Context)

@Summary 删除文件 @Security BearerAuth @Param cluster query string true "集群名称" @Param body body info true "文件信息" @Success 200 {object} string @Router /k8s/cluster/{cluster}/file/delete [post]

func (*FileController) Download added in v0.0.145

func (fc *FileController) Download(c *gin.Context)

@Summary 下载文件 @Security BearerAuth @Param cluster query string true "集群名称" @Param podName query string true "Pod名称" @Param path query string true "文件路径" @Param containerName query string true "容器名称" @Param namespace query string true "命名空间" @Success 200 {object} string @Router /k8s/cluster/{cluster}/file/download [get]

func (*FileController) List added in v0.0.145

func (fc *FileController) List(c *gin.Context)

List 处理获取文件列表的 HTTP 请求 @Summary 获取文件列表 @Security BearerAuth @Param cluster query string true "集群名称" @Param body body info true "文件信息" @Success 200 {object} string @Router /k8s/cluster/{cluster}/file/list [post]

func (*FileController) Save added in v0.0.145

func (fc *FileController) Save(c *gin.Context)

@Summary 保存文件 @Security BearerAuth @Param cluster query string true "集群名称" @Param body body info true "文件信息" @Success 200 {object} string @Router /k8s/cluster/{cluster}/file/save [post]

func (*FileController) Show added in v0.0.145

func (fc *FileController) Show(c *gin.Context)

Show 处理下载文件的 HTTP 请求 @Summary 查看文件内容 @Security BearerAuth @Param cluster query string true "集群名称" @Param body body info true "文件信息" @Success 200 {object} string @Router /k8s/cluster/{cluster}/file/show [post]

func (*FileController) Upload added in v0.0.145

func (fc *FileController) Upload(c *gin.Context)

Upload 处理上传文件的 HTTP 请求 @Summary 上传文件 @Security BearerAuth @Param cluster query string true "集群名称" @Param containerName formData string true "容器名称" @Param namespace formData string true "命名空间" @Param podName formData string true "Pod名称" @Param path formData string true "文件路径" @Param fileName formData string true "文件名" @Param file formData file true "上传文件" @Success 200 {object} string @Router /k8s/cluster/{cluster}/file/upload [post]

type LabelController added in v0.0.145

type LabelController struct{}

func (*LabelController) UniqueLabels added in v0.0.145

func (lc *LabelController) UniqueLabels(c *gin.Context)

@Summary 获取Pod唯一标签键列表 @Security BearerAuth @Param cluster query string true "集群名称" @Success 200 {object} string @Router /k8s/cluster/{cluster}/pod/labels/unique_labels [get] UniqueLabels 返回当前集群中所有唯一的 Pod 标签键列表,格式化为前端可用的选项数组。

type LogController added in v0.0.145

type LogController struct{}

func (*LogController) DownloadLogs added in v0.0.145

func (lc *LogController) DownloadLogs(c *gin.Context)

DownloadLogs 下载Pod日志 @Summary 下载Pod日志 @Security BearerAuth @Param cluster path string true "集群名称" @Param ns path string true "命名空间" @Param pod_name path string true "Pod名称" @Param container_name path string true "容器名称" @Success 200 {file} file "日志文件" @Router /k8s/cluster/{cluster}/pod/logs/download/ns/{ns}/pod_name/{pod_name}/container/{container_name} [get]

func (*LogController) StreamLogs added in v0.0.145

func (lc *LogController) StreamLogs(c *gin.Context)

StreamLogs 通过SSE流式传输Pod日志 @Summary 流式获取Pod日志 @Security BearerAuth @Param cluster path string true "集群名称" @Param ns path string true "命名空间" @Param pod_name path string true "Pod名称" @Param container_name path string true "容器名称" @Success 200 {string} string "日志流" @Router /k8s/cluster/{cluster}/pod/logs/sse/ns/{ns}/pod_name/{pod_name}/container/{container_name} [get]

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 PortController added in v0.0.145

type PortController struct{}

func (*PortController) PortForwardList added in v0.0.145

func (pc *PortController) PortForwardList(c *gin.Context)

@Summary 列出端口转发信息 @Security BearerAuth @Param cluster query string true "集群名称" @Param ns path string true "命名空间" @Param name path string true "Pod名称" @Success 200 {object} string @Router /k8s/cluster/{cluster}/pod/port_forward/ns/{ns}/name/{name}/port/list [get]

func (*PortController) StartPortForward added in v0.0.145

func (pc *PortController) StartPortForward(c *gin.Context)

@Summary 开始端口转发 @Security BearerAuth @Param cluster query string true "集群名称" @Param ns path string true "命名空间" @Param name path string true "Pod名称" @Param container_name path string true "容器名称" @Param pod_port path string true "Pod端口" @Param local_port path string true "本地端口" @Success 200 {object} string @Router /k8s/cluster/{cluster}/pod/port_forward/ns/{ns}/name/{name}/container/{container_name}/pod_port/{pod_port}/local_port/{local_port}/start [post]

func (*PortController) StopPortForward added in v0.0.145

func (pc *PortController) StopPortForward(c *gin.Context)

@Summary 停止端口转发 @Security BearerAuth @Param cluster query string true "集群名称" @Param ns path string true "命名空间" @Param name path string true "Pod名称" @Param container_name path string true "容器名称" @Param pod_port path string true "Pod端口" @Success 200 {object} string @Router /k8s/cluster/{cluster}/pod/port_forward/ns/{ns}/name/{name}/container/{container_name}/pod_port/{pod_port}/stop [post]

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 ResourceController added in v0.0.145

type ResourceController struct{}

func (*ResourceController) TopList added in v0.0.145

func (rc *ResourceController) TopList(c *gin.Context)

@Summary 获取Pod资源使用情况列表 @Security BearerAuth @Param cluster query string true "集群名称" @Param ns path string true "命名空间,多个用逗号分隔" @Success 200 {object} string @Router /k8s/cluster/{cluster}/pod/top/ns/{ns}/list [get] TopList 返回指定命名空间下所有 Pod 的资源使用情况(CPU、内存等),支持多命名空间查询,并以便于前端排序的格式输出。

func (*ResourceController) Usage added in v0.0.145

func (rc *ResourceController) Usage(c *gin.Context)

@Summary 获取Pod资源使用情况 @Security BearerAuth @Param cluster query string true "集群名称" @Param ns path string true "命名空间" @Param name path string true "Pod名称" @Success 200 {object} string @Router /k8s/cluster/{cluster}/pod/usage/ns/{ns}/name/{name} [get]

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)

type XtermController added in v0.0.145

type XtermController struct{}

func (*XtermController) Xterm added in v0.0.145

func (xc *XtermController) Xterm(c *gin.Context)

@Summary 提供Pod容器的交互式终端会话 @Security BearerAuth @Param cluster query string true "集群名称" @Param ns path string true "命名空间" @Param pod_name path string true "Pod名称" @Param container_name query string false "容器名称,默认为第一个容器" @Param remove query bool false "会话结束后是否删除Pod" @Success 101 {string} string "WebSocket连接成功" @Router /k8s/cluster/{cluster}/pod/xterm/ns/{ns}/pod_name/{pod_name} [get] Xterm 通过 WebSocket 提供与 Kubernetes Pod 容器的交互式终端会话。 支持 xterm.js 前端,处理终端输入输出、窗口大小调整、命令日志记录和连接保活。 会话结束后可根据参数选择性删除目标 Pod。

Jump to

Keyboard shortcuts

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