apis

package
v1.23.0 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2023 License: Apache-2.0 Imports: 97 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ActionCreate  = "create"
	ActionDelete  = "delete"
	ActionUpdate  = "update"
	ActionPatch   = "patch"
	ActionList    = "list"
	ActionGet     = "get"
	ActionCheck   = "check"
	ActionEnable  = "enable"
	ActionDisable = "disable"
)
View Source
const ChangeCauseAnnotation = "kubernetes.io/change-cause"
View Source
const WatcherRefreshInterval = 5 * time.Second

Variables

View Source
var DefaultExecCommand = []string{
	"/bin/sh",
	"-c",
	"export LINES=20; export COLUMNS=100; TERM=xterm-256color; export TERM; [ -x /bin/bash ] && ([ -x /usr/bin/script ] && /usr/bin/script -q -c /bin/bash /dev/null || exec /bin/bash) || exec /bin/sh",
}
View Source
var NewPageDataFromContext = pagination.NewPageDataFromContext

Functions

func ExecuteAtLocalOrRemoteKubectlPodWithWebsocket added in v1.23.0

func ExecuteAtLocalOrRemoteKubectlPodWithWebsocket(
	resp http.ResponseWriter, req *http.Request,
	commands []string,
	cluster cluster.Interface,
	options *KubectlOptions,
)

func ExtractList

func ExtractList(obj runtime.Object) ([]client.Object, error)

func GetDeploymentInfo

func GetDeploymentInfo(ctx context.Context, cli client.Client, namespace string, name string) (*rollout.RolloutInfo, error)

func GetRolloutInfo

func GetRolloutInfo(ctx context.Context, cli client.Client, namespace, name string) (*rollout.RolloutInfo, error)

func NewJaegerHandler

func NewJaegerHandler(server string) *jaegerHandler

func NewPrometheusHandler

func NewPrometheusHandler(server string) (*prometheusHandler, error)

func NewRolloutInfo

func NewRolloutInfo(ro *rolloutsv1alpha1.Rollout,
	allReplicaSets []appsv1.ReplicaSet,
	allPods []corev1.Pod,
	allExperiments []rolloutsv1alpha1.Experiment,
	allARs []rolloutsv1alpha1.AnalysisRun,
) *rollout.RolloutInfo

func NodeTotalRequestsAndLimits added in v1.22.0

func NodeTotalRequestsAndLimits(node *corev1.Node, podList *corev1.PodList) (reqs, limits corev1.ResourceList)

func NotOK

func NotOK(c *gin.Context, err error)

func OK

func OK(c *gin.Context, data interface{})

如果是非成功的响应,使用 NotOK

func RateLimitWriter added in v1.22.0

func RateLimitWriter(ctx context.Context, w io.Writer, speed int) io.Writer

func Routes added in v1.23.0

func Routes(ctx context.Context, cluster cluster.Interface, options *Options, kubectlOptions *KubectlOptions) (func(c *gin.Context), error)

nolint: funlen

func Run

func Run(ctx context.Context,
	cluster cluster.Interface,
	systemoptions *system.Options,
	apioptions *Options,
	kubectlOptions *KubectlOptions,
	otelopts *otel.Options,
) error

func RunWebSocketStream added in v1.23.0

func RunWebSocketStream(
	resp http.ResponseWriter, req *http.Request,
	fun func(ctx context.Context, stream remotecommand.StreamOptions) error,
)

func ServeWatchThen

func ServeWatchThen(c *gin.Context, cli client.Client, namespace, name string, watchlist client.ObjectList,
	onchangefunc func(obj client.Object) (interface{}, error),
)

func WatchEvents

func WatchEvents(c *gin.Context, cluster cluster.Interface, list client.ObjectList, opts ...client.ListOption) error

Types

type AlertHandler

type AlertHandler struct {
	*Watcher
}

获取各个集群的告警信息

func (*AlertHandler) Webhook

func (h *AlertHandler) Webhook(c *gin.Context)

@Tags Agent.V1 @Summary kubegems default alert webhook @Description kubegems default alert webhook @Accept json @Produce json @Success 200 {object} handlers.ResponseStruct{Data=string} "" @Router /alert [post] @Security JWT

type AlertmanagerHandler

type AlertmanagerHandler struct {
	C kubernetes.Interface
	// contains filtered or unexported fields
}

获取各个集群的告警信息

func NewAlertmanagerClient

func NewAlertmanagerClient(server string, k8sclient kubernetes.Interface) (*AlertmanagerHandler, error)

func (*AlertmanagerHandler) CheckConfig

func (h *AlertmanagerHandler) CheckConfig(c *gin.Context)

@Tags Agent.V1 @Summary 检查alertmanagerconfig @Description 检查alertmanagerconfig @Accept json @Produce json @Param form body v1alpha1.AlertmanagerConfig true "body" @Success 200 {object} handlers.ResponseStruct{Data=string} "" @Router /v1/proxy/cluster/{cluster}/custom/alertmanager/v1/alerts/_/actions/check [post] @Security JWT

func (*AlertmanagerHandler) CreateSilence

func (h *AlertmanagerHandler) CreateSilence(c *gin.Context)

@Tags Agent.V1 @Summary 为指定告警规则添加silence @Description 添加告警silence @Accept json @Produce json @Param cluster path string true "cluster" @Param from body types.Silence true "silence" @Success 200 {object} handlers.ResponseStruct{Data=string} "" @Router /v1/proxy/cluster/{cluster}/custom/alertmanager/v1/silence/_/actions/create [post] @Security JWT

func (*AlertmanagerHandler) DeleteSilence

func (h *AlertmanagerHandler) DeleteSilence(c *gin.Context)

@Tags Agent.V1 @Summary get silence @Description get silence @Accept json @Produce json @Param cluster path string true "cluster" @Param id query string true "id" @Success 200 {object} handlers.ResponseStruct{Data=string} "" @Router /v1/proxy/cluster/{cluster}/custom/alertmanager/v1/silence/_/actions/delete [delete] @Security JWT

func (*AlertmanagerHandler) ListAlerts

func (h *AlertmanagerHandler) ListAlerts(c *gin.Context)

@Tags Agent.V1 @Summary 获取alertmanager中的告警数据 @Description 获取alertmanager中的告警数据 @Accept json @Produce json @Param cluster path string true "cluster" @Param filter query string false "filter" @Param receiver query string false "receiver" @Param silenced query bool false "silenced" @Param inhibited query bool false "inhibited" @Param active query bool false "active" @Param unprocessed query bool false "unprocessed" @Success 200 {object} handlers.ResponseStruct{Data=[]client.ExtendedAlert} "labelvalues" @Router /v1/proxy/cluster/{cluster}/custom/alertmanager/v1/alerts [get] @Security JWT

func (*AlertmanagerHandler) ListSilence

func (h *AlertmanagerHandler) ListSilence(c *gin.Context)

@Tags Agent.V1 @Summary get silence @Description get silence @Accept json @Produce json @Param cluster path string true "cluster" @Param filter query string true "filter" @Success 200 {object} handlers.ResponseStruct{Data=string} "" @Router /v1/proxy/cluster/{cluster}/custom/alertmanager/v1/silence [get] @Security JWT

type ArgoRolloutHandler

type ArgoRolloutHandler struct {
	// contains filtered or unexported fields
}

func (*ArgoRolloutHandler) GetRolloutDepInfo

func (h *ArgoRolloutHandler) GetRolloutDepInfo(c *gin.Context)

@Tags Agent.V1 @Summary rollout info @Description rollout info(deployment) @Param cluster path string true "cluster" @Success 200 {object} object "rollout.RolloutInfo" @Router /v1/proxy/cluster/{cluster}/custom/argoproj.io/v1alpha1/namespaces/{namespace}/rollouts/{name}/actions/depinfo [get] @Security JWT

func (*ArgoRolloutHandler) GetRolloutInfo

func (h *ArgoRolloutHandler) GetRolloutInfo(c *gin.Context)

@Tags Agent.V1 @Summary rollout info @Description rollout info(argo rollout) @Param cluster path string true "cluster" @Success 200 {object} object "rollout.RolloutInfo" @Router /v1/proxy/cluster/{cluster}/custom/argoproj.io/v1alpha1/namespaces/{namespace}/rollouts/{name}/actions/info [get] @Security JWT

type ClusterHandler

type ClusterHandler struct {
	// contains filtered or unexported fields
}

func (*ClusterHandler) APIResources

func (h *ClusterHandler) APIResources(c *gin.Context)

@Tags Agent.V1 @Summary 获取k8s api-resources @Description 获取k8s api-resources @Accept json @Produce json @Param cluster path string true "cluster" @Success 200 {object} handlers.ResponseStruct{Data=[]object} "resp" @Router /v1/proxy/cluster/{cluster}/api-resources [get]

type ConnectionPool added in v1.23.0

type ConnectionPool interface {
	// Join 加入连接池
	Join(conn *syncConn)
	// 从连接池中删除指定客户端
	Remove(clients ...string)
	// 开始运行连接池
	Start()
	// 分发消息
	DispatchMessage(message interface{})
}

ConnectionPool websocket 连接池,自动维护连接状态

func NewConnectionPool added in v1.23.0

func NewConnectionPool() ConnectionPool

type CustomNode

type CustomNode struct {
	Node          *corev1.Node
	TotalRequests map[corev1.ResourceName]resource.Quantity
	TotalLimits   map[corev1.ResourceName]resource.Quantity
}

type EventHandler

type EventHandler struct {
	C client.Client
}

func (*EventHandler) List

func (h *EventHandler) List(c *gin.Context)

@Tags Agent.V1 @Summary 获取Event列表数据 @Description 获取Event列表数据 @Accept json @Produce json @Param order query string false "page" @Param page query int false "page" @Param size query int false "page" @Param search query string false "search" @Param namespace path string true "namespace" @Param cluster path string true "cluster" @Param topkind query string false "topkind" @Param topname query string false "topname" @Success 200 {object} handlers.ResponseStruct{Data=pagination.PageData{List=[]object}} "Event" @Router /v1/proxy/cluster/{cluster}/custom/core/v1/namespaces/{namespace}/events [get] @Security JWT

type EvtHandler

type EvtHandler struct {
	// contains filtered or unexported fields
}

func (EvtHandler) OnAdd

func (eh EvtHandler) OnAdd(obj interface{})

func (EvtHandler) OnDelete

func (eh EvtHandler) OnDelete(obj interface{})

func (EvtHandler) OnUpdate

func (eh EvtHandler) OnUpdate(oldObj interface{}, newObj interface{})

type FileTransfer added in v1.22.0

type FileTransfer struct {
	Cluster   cluster.Interface
	Namespace string
	Pod       string
	Container string
	Filename  string
}

func (*FileTransfer) Download added in v1.22.0

func (fd *FileTransfer) Download(c *gin.Context) error

func (*FileTransfer) Upload added in v1.22.0

func (fd *FileTransfer) Upload(c *gin.Context) error

type GVKN

type GVKN struct {
	Action string
	schema.GroupVersionKind
	Namespace     string
	Resource      string
	Name          string
	Labels        map[string]string
	LabelSelector string
}

type JobHandler

type JobHandler struct {
	C client.Client
	// contains filtered or unexported fields
}

func (*JobHandler) List

func (h *JobHandler) List(c *gin.Context)

@Tags Agent.V1 @Summary 获取Job列表数据 @Description 获取Job列表数据 @Accept json @Produce json @Param order query string false "page" @Param search query string false "search" @Param page query int false "page" @Param size query int false "page" @Param namespace path string true "namespace" @Param cluster path string true "cluster" @Param topkind query string false "topkind(cronjob)" @Param topname query string false "topname" @Success 200 {object} handlers.ResponseStruct{Data=pagination.PageData{List=[]object}} "Job" @Router /v1/proxy/cluster/{cluster}/custom/batch/v1/namespaces/{namespace}/jobs [get] @Security JWT

type KubectlHandler

type KubectlHandler struct {
	// contains filtered or unexported fields
}

func (*KubectlHandler) DebugPod added in v1.23.0

func (h *KubectlHandler) DebugPod(c *gin.Context)

ExecContainer 调试容器(websocket) @Tags Agent.V1 @Summary 调试容器(websocket) @Description 调试容器(websocket) @Param cluster path string true "cluster" @Param namespace path string true "namespace" @Param name path string true "pod name" @Param container query string true "container" @Param stream query string true "must be true" @Param agentiamge query string false "agentimage" @Param debugimage query string false "debugimage" @Param forkmode query string false "forkmode" @Success 200 {object} object "ws" @Router /v1/proxy/cluster/{cluster}/custom/core/v1/{namespace}/pods/{name}/actions/debug [get] @Security JWT

func (*KubectlHandler) ExecKubectl

func (h *KubectlHandler) ExecKubectl(c *gin.Context)

ExecKubectl kubectl @Tags Agent.V1 @Summary kubectl @Description kubectl @Param cluster path string true "cluster" @Param stream query string true "stream must be true" @Success 200 {object} object "ws" @Router /v1/proxy/cluster/{cluster}/custom/system/v1/kubectl [get] @Security JWT

type KubectlOptions added in v1.23.0

type KubectlOptions struct {
	DebugImage      string `json:"debugImage,omitempty"`
	Namespace       string `json:"namespace,omitempty"`
	PodSelector     string `json:"podSelector,omitempty"`
	UseLocalKubectl bool   `json:"useLocalKubectl,omitempty"`
}

func NewDefaultKubectlOptions added in v1.23.0

func NewDefaultKubectlOptions() *KubectlOptions

type LokiHandler

type LokiHandler struct {
	Server string
}

func (*LokiHandler) AlertRule

func (h *LokiHandler) AlertRule(c *gin.Context)

@Tags Agent.V1 @Summary Loki Alert Rule @Description Loki Alert Rule @Accept json @Produce json @Param cluster path string true "cluster" @Success 200 {object} handlers.ResponseStruct{Data=map[string]prometheus.RealTimeAlertRule} "" @Router /v1/proxy/cluster/{cluster}/custom/loki/v1/alertrule [get] @Security JWT

func (*LokiHandler) LabelValues

func (h *LokiHandler) LabelValues(c *gin.Context)

@Tags Agent.V1 @Summary Loki LabelValues @Description Loki LabelValues @Accept json @Produce json @Param cluster path string true "cluster" @Param start query string true "The start time for the query as a nanosecond Unix epoch" @Param end query string true "The end time for the query as a nanosecond Unix epoch" @Param label query string true "label" @Success 200 {object} handlers.ResponseStruct{Data=object} "" @Router /v1/proxy/cluster/{cluster}/custom/loki/v1/labelvalues [get] @Security JWT

func (*LokiHandler) Labels

func (h *LokiHandler) Labels(c *gin.Context)

@Tags Agent.V1 @Summary Loki Labels @Description Loki Labels @Accept json @Produce json @Param cluster path string true "cluster" @Param start query string true "The start time for the query as a nanosecond Unix epoch" @Param end query string true "The end time for the query as a nanosecond Unix epoch" @Success 200 {object} handlers.ResponseStruct{Data=object} "" @Router /v1/proxy/cluster/{cluster}/custom/loki/v1/labels [get] @Security JWT

func (*LokiHandler) Query

func (h *LokiHandler) Query(c *gin.Context)

@Tags Agent.V1 @Summary Loki Query @Description Loki Query @Accept json @Produce json @Param cluster path string true "cluster" @Param limit query string false "The max number of entries to return" @Param query query string true "loki query language" @Param time query int false "The evaluation time for the query as a nanosecond Unix epoch or another supported format. Defaults to now" @Param direction query string true "The order to all results" @Success 200 {object} handlers.ResponseStruct{Data=object} "" @Router /v1/proxy/cluster/{cluster}/custom/loki/v1/query [get] @Security JWT

func (*LokiHandler) QueryRange

func (h *LokiHandler) QueryRange(c *gin.Context)

@Tags Agent.V1 @Summary Loki QueryRange @Description Loki QueryRange @Accept json @Produce json @Param cluster path string true "cluster" @Param start query string true "The start time for the query as a nanosecond Unix epoch" @Param end query string true "The end time for the query as a nanosecond Unix epoch" @Param direction query string true "The order to all results" @Param limit query string false "The max number of entries to return" @Param query query string true "loki query language" @Success 200 {object} handlers.ResponseStruct{Data=object} "" @Router /v1/proxy/cluster/{cluster}/custom/loki/v1/queryrange [get] @Security JWT

func (*LokiHandler) Series

func (h *LokiHandler) Series(c *gin.Context)

@Tags Agent.V1 @Summary Loki Series @Description Loki Series @Accept json @Produce json @Param cluster path string true "cluster" @Param start query string true "The start time for the query as a nanosecond Unix epoch" @Param end query string true "The end time for the query as a nanosecond Unix epoch" @Param match query string true "match" @Success 200 {object} handlers.ResponseStruct{Data=object} "" @Router /v1/proxy/cluster/{cluster}/custom/loki/v1/series [get] @Security JWT

func (*LokiHandler) Tail

func (h *LokiHandler) Tail(c *gin.Context)

@Tags Agent.V1 @Summary Loki LabelValues @Description Loki LabelValues @Accept json @Produce json @Param cluster path string true "cluster" @Param start query string true "The start time for the query as a nanosecond Unix epoch" @Param limit query string false "The max number of entries to return" @Param query query string true "loki query language" @Param delay_for query string true "The number of seconds to delay retrieving logs to let slow loggers catch up. Defaults to 0 and cannot be larger than 5." @Param stream query string true "must be true" @Success 200 {object} handlers.ResponseStruct{Data=object} "" @Router /v1/proxy/cluster/{cluster}/custom/loki/v1/tail [get] @Security JWT

type MainCategory added in v1.22.0

type MainCategory map[string]map[string][]api.PluginStatus

type NamespaceHandler

type NamespaceHandler struct {
	C client.Client
}

func (*NamespaceHandler) List

func (h *NamespaceHandler) List(c *gin.Context)

@Tags Agent.V1 @Summary 获取可以绑定的环境的namespace列表数据 @Description 获取可以绑定的环境的namespace列表数据 @Accept json @Produce json @Param order query string false "page" @Param search query string false "search" @Param page query int false "page" @Param size query int false "page" @Param cluster path string true "cluster" @Success 200 {object} handlers.ResponseStruct{Data=pagination.PageData{List=[]object}} "Namespace" @Router /v1/proxy/cluster/{cluster}/custom/core/v1/namespaces [get] @Security JWT

type NodeHandler

type NodeHandler struct {
	C client.Client
}

func (*NodeHandler) Get

func (h *NodeHandler) Get(c *gin.Context)

@Tags Agent.V1 @Summary 自定义的NODE详情接口,(可以获取资源分配情况) @Description 自定义的NODE详情接口,(可以获取资源分配情况) @Accept json @Produce json @Param name path string true "name" @Param cluster path string true "cluster" @Success 200 {object} handlers.ResponseStruct{Data=CustomNode} "Node" @Router /v1/proxy/cluster/{cluster}/custom/core/v1/nodes/{name} [get] @Security JWT

func (*NodeHandler) PatchNodeCordon

func (h *NodeHandler) PatchNodeCordon(c *gin.Context)

@Tags Agent.V1 @Summary 修改节点调度 @Description 修改节点调度 @Accept json @Produce json @Param param body cordonForm true "表单"` @Param name path string true "name" @Param cluster path string true "cluster" @Success 200 {object} handlers.ResponseStruct{Data=object} "Node" @Router /v1/proxy/cluster/{cluster}/custom/core/v1/nodes/{name}/actions/cordon [patch] @Security JWT

func (*NodeHandler) PatchNodeLabelOrAnnotations

func (h *NodeHandler) PatchNodeLabelOrAnnotations(c *gin.Context)

@Tags Agent.V1 @Summary 修改node的元数据,label和annotations @Description 修改node的元数据,label和annotations @Accept json @Produce json @Param param body metaForm true "表单"` @Param name path string true "name" @Param cluster path string true "cluster" @Success 200 {object} handlers.ResponseStruct{Data=object} "Node" @Router /v1/proxy/cluster/{cluster}/custom/core/v1/nodes/{name}/actions/metadata [patch] @Security JWT

func (*NodeHandler) PatchNodeTaint

func (h *NodeHandler) PatchNodeTaint(c *gin.Context)

@Tags Agent.V1 @Summary 修改节点污点 @Description 修改节点污点 @Accept json @Produce json @Param param body taintForm true "表单"` @Param name path string true "name" @Param cluster path string true "cluster" @Success 200 {object} handlers.ResponseStruct{Data=object} "Node" @Router /v1/proxy/cluster/{cluster}/custom/core/v1/nodes/{name}/actions/taint [patch] @Security JWT

type Options

type Options struct {
	PrometheusServer   string `json:"prometheusServer,omitempty"`
	AlertmanagerServer string `json:"alertmanagerServer,omitempty"`
	LokiServer         string `json:"lokiServer,omitempty"`
	JaegerServer       string `json:"jaegerServer,omitempty"`
	EnableHTTPSigs     bool   `json:"enableHTTPSigs,omitempty" description:"check http sigs, default false"`
}

func NewDefaultOptions

func NewDefaultOptions() *Options

type PluginHandler

type PluginHandler struct {
	PM *pluginmanager.PluginManager
}

func (*PluginHandler) CheckUpdate added in v1.23.0

func (h *PluginHandler) CheckUpdate(c *gin.Context)

@Tags Agent.Plugin @Summary 检查更新 @Description 检查更新 @Accept json @Produce json @Param cluster path string true "cluster" @Success 200 {object} handlers.ResponseStruct{Data=[]api.PluginStatus} "ok" @Router /v1/proxy/cluster/{cluster}/plugins:check-update [post]

func (*PluginHandler) Disable

func (h *PluginHandler) Disable(c *gin.Context)

@Tags Agent.Plugin @Summary 禁用插件 @Description 禁用插件 @Accept json @Produce json @Param cluster path string true "cluster" @Param name path string true "name" @Success 200 {object} handlers.ResponseStruct{Data=string} "Plugins" @Router /v1/proxy/cluster/{cluster}/plugins [delete] @Security JWT

func (*PluginHandler) Enable

func (h *PluginHandler) Enable(c *gin.Context)

@Tags Agent.Plugin @Summary 启用插件 @Description 启用插件 @Accept json @Produce json @Param cluster path string true "cluster" @Param name path string true "name" @Param body body pluginmanager.PluginVersion true "pluginVersion" @Success 200 {object} handlers.ResponseStruct{Data=string} "ok" @Router /v1/proxy/cluster/{cluster}/plugins/{name} [post] @Security JWT

func (*PluginHandler) Get added in v1.23.0

func (h *PluginHandler) Get(c *gin.Context)

@Tags Agent.Plugin @Summary 插件详情 @Description 插件详情 @Accept json @Produce json @Param cluster path string true "cluster" @Param name path string true "name" @Param version query string true "version" @Success 200 {object} handlers.ResponseStruct{Data=pluginmanager.PluginVersion} "Plugins" @Router /v1/proxy/cluster/{cluster}/plugins/{name} [get] @Security JWT

func (*PluginHandler) List

func (h *PluginHandler) List(c *gin.Context)

@Tags Agent.Plugin @Summary 获取Plugin列表数据 @Description 获取Plugin列表数据 @Accept json @Produce json @Param cluster path string true "cluster" @Param simple query bool true "simple" @Success 200 {object} handlers.ResponseStruct{Data=map[string]map[string][]api.PluginStatus} "Plugins" @Router /v1/proxy/cluster/{cluster}/plugins [get] @Security JWT

type PluginStatus

type PluginStatus struct {
	Name        string `json:"name"`
	Namespace   string `json:"namespace"`
	Required    bool   `json:"required"`
	Icon        string `json:"icon"`
	Description string `json:"description"`
	Version     string `json:"version"`
	Enabled     bool   `json:"enabled"`
	Healthy     bool   `json:"healthy"`
	Message     string `json:"message"`
	// contains filtered or unexported fields
}

type PodCmdExecutor added in v1.22.0

type PodCmdExecutor struct {
	Cluster        cluster.Interface
	Pod            client.ObjectKey
	PodExecOptions v1.PodExecOptions
	StreamOptions  remotecommand.StreamOptions
}

func (PodCmdExecutor) Execute added in v1.23.0

func (pe PodCmdExecutor) Execute(ctx context.Context) error

Execute

type PodHandler

type PodHandler struct {
	// contains filtered or unexported fields
}

func (*PodHandler) DownloadFileFromPod added in v1.22.0

func (h *PodHandler) DownloadFileFromPod(c *gin.Context)

DownloadFileFromPod 从容器下载文件 @Tags Agent.V1 @Summary 从容器下载文件 @Description 从容器下载文件 @Param cluster path string true "cluster" @Param namespace path string true "namespace" @Param pod path string true "pod" @Param container query string true "container" @Param filename query string true "filename" @Success 200 {object} object "ws" @Router /v1/proxy/cluster/{cluster}/custom/core/v1/namespaces/{namespace}/pods/{name}/file [get] @Security JWT

func (*PodHandler) ExecPods

func (h *PodHandler) ExecPods(c *gin.Context)

ExecContainer 进入容器交互执行命令 @Tags Agent.V1 @Summary 进入容器交互执行命令(websocket) @Description 进入容器交互执行命令(websocket) @Param cluster path string true "cluster" @Param namespace path string true "namespace" @Param pod path string true "pod" @Param container query string true "container" @Param stream query string true "stream must be true" @Param token query string true "token" @Param shell query string false "default sh, choice(bash,ash,zsh)" @Success 200 {object} object "ws" @Router /v1/proxy/cluster/{cluster}/custom/core/v1/namespaces/{namespace}/pods/{name}/actions/shell [get] @Security JWT

func (*PodHandler) GetContainerLogs

func (h *PodHandler) GetContainerLogs(c *gin.Context)

GetContainerLogs 获取容器的stdout输出 @Tags Agent.V1 @Summary 实时获取日志STDOUT输出(websocket) @Description 实时获取日志STDOUT输出(websocket) @Param cluster path string true "cluster" @Param namespace path string true "namespace" @Param pod path string true "pod" @Param container query string true "container" @Param stream query string true "stream must be true" @Param follow query string true "follow" @Param tail query int false "tail line (default 1000)" @Success 200 {object} object "ws" @Router /v1/proxy/cluster/{cluster}/custom/core/v1/namespaces/{namespace}/pods/{name}/actions/logs [get] @Security JWT

func (*PodHandler) List

func (h *PodHandler) List(c *gin.Context)

@Tags Agent.V1 @Summary 获取Pod列表数据 @Description 获取Pod列表数据 @Accept json @Produce json @Param order query string false "page" @Param search query string false "search" @Param page query int false "page" @Param size query int false "page" @Param namespace path string true "namespace" @Param fieldSelector query string false "fieldSelector, 只支持podstatus={xxx}格式" @Param cluster path string true "cluster" @Param topkind query string false "topkind(Deployment,StatefulSet,DaemonSet,Job,Node)" @Param topname query string false "topname" @Success 200 {object} handlers.ResponseStruct{Data=handlers.PageData{List=[]object}} "Pod" @Router /v1/proxy/cluster/{cluster}/custom/core/v1/namespaces/{namespace}/pods [get] @Security JWT

func (*PodHandler) UploadFileToContainer added in v1.22.0

func (h *PodHandler) UploadFileToContainer(c *gin.Context)

UploadFileToContainer upload files to container @Tags Agent.V1 @Summary upload files to container @Description upload files to container @Param cluster path string true "cluster" @Param namespace path string true "namespace" @Param pod path string true "pod" @Param container query string true "container" @Param filename query string true "filename" @Success 200 {object} object "ws" @Router /v1/proxy/cluster/{cluster}/custom/core/v1/namespaces/{namespace}/pods/{name}/upfile [post] @Security JWT

type PvcHandler

type PvcHandler struct {
	C client.Client
}

func (*PvcHandler) Get

func (h *PvcHandler) Get(c *gin.Context)

@Tags Agent.V1 @Summary 获取PersistentVolumeClaim数据 @Description 获取PersistentVolumeClaim数据 @Accept json @Produce json @Param cluster path string true "cluster" @Param name path string true "name" @Param namespace path string true "namespace" @Success 200 {object} handlers.ResponseStruct{Data=object} "counter" @Router /v1/proxy/cluster/{cluster}/custom/core/v1/namespaces/{namespace}/pvcs/{name} [get] @Security JWT

func (*PvcHandler) List

func (h *PvcHandler) List(c *gin.Context)

@Tags Agent.V1 @Summary 获取PersistentVolumeClaim列表数据 @Description 获取PersistentVolumeClaim列表数据 @Accept json @Produce json @Param order query string false "page" @Param search query string false "search" @Param page query int false "page" @Param size query int false "page" @Param namespace path string true "namespace" @Param cluster path string true "cluster" @Success 200 {object} handlers.ResponseStruct{Data=pagination.PageData{List=[]object}} "PersistentVolumeClaim" @Router /v1/proxy/cluster/{cluster}/custom/core/v1/namespaces/{namespace}/pvcs [get] @Security JWT

type REST

type REST struct {
	// contains filtered or unexported fields
}

func (*REST) Create

func (h *REST) Create(c *gin.Context)

@Tags Agent.V1 @Summary 创建 none namespaced scope workload @Description 创建 none namespaced scope workload @Accept json @Produce json @Param cluster path string true "cluster" @Param group path string true "group" @Param version path string true "version" @Param resource path string true "resoruce" @Param name path string true "name" @Param namespace path string true "namespace" @Param data body object true "body" @Success 200 {object} handlers.ResponseStruct{Data=object} "counter" @Router /v1/proxy/cluster/{cluster}/{group}/{version}/namespaces/{namespace}/{resource}/{name} [post] @Security JWT

func (*REST) Delete

func (h *REST) Delete(c *gin.Context)

@Tags Agent.V1 @Summary 创建namespaced scope workload @Description 创建namespaced scope workload @Accept json @Produce json @Param cluster path string true "cluster" @Param group path string true "group" @Param version path string true "version" @Param resource path string true "resoruce" @Param name path string true "name" @Param namespace path string true "namespace" @Success 200 {object} handlers.ResponseStruct{Data=object} "counter" @Router /v1/proxy/cluster/{cluster}/{group}/{version}/namespaces/{namespace}/{resource}/{name} [delete] @Security JWT

func (*REST) Get

func (h *REST) Get(c *gin.Context)

@Tags Agent.V1 @Summary 获取namespaced scope workload @Description 获取namespaced scope workload @Accept json @Produce json @Param cluster path string true "cluster" @Param group path string true "group" @Param version path string true "version" @Param resource path string true "resoruce" @Param name path string true "name" @Param namespace path string true "namespace" @Success 200 {object} handlers.ResponseStruct{Data=object} "counter" @Router /v1/proxy/cluster/{cluster}/{group}/{version}/namespaces/{namespace}/{resource}/{name} [get] @Security JWT

func (*REST) List

func (h *REST) List(c *gin.Context)

@Tags Agent.V1 @Summary 获取namespaced scope workload list @Description 获取namespaced scope workload list @Accept json @Produce json @Param cluster path string true "cluster" @Param group path string true "group" @Param version path string true "version" @Param resource path string true "resoruce" @Param namespace path string true "namespace" @Param watch query bool true "watch" @Success 200 {object} handlers.ResponseStruct{Data=[]object} "counter" @Router /v1/proxy/cluster/{cluster}/{group}/{version}/namespaces/{namespace}/{resource} [get] @Security JWT

func (*REST) Patch

func (h *REST) Patch(c *gin.Context)

@Tags Agent.V1 @Summary 创建namespaced scope workload @Description 创建namespaced scope workload @Accept json @Produce json @Param cluster path string true "cluster" @Param group path string true "group" @Param version path string true "version" @Param resource path string true "resoruce" @Param name path string true "name" @Param namespace path string true "namespace" @Param data body object true "body" @Success 200 {object} handlers.ResponseStruct{Data=object} "counter" @Router /v1/proxy/cluster/{cluster}/{group}/{version}/namespaces/{namespace}/{resource}/{name} [patch] @Security JWT

func (*REST) Scale

func (h *REST) Scale(c *gin.Context)

@Tags Agent.V1 @Summary 扩缩容 @Description 扩缩容 @Accept json @Produce json @Param cluster path string true "cluster" @Param group path string true "group" @Param version path string true "version" @Param resource path string true "resoruce" @Param name path string true "name" @Param namespace path string true "namespace" @Param data body scaleForm true "body" @Success 200 {object} handlers.ResponseStruct{Data=object} "counter" @Router /v1/proxy/cluster/{cluster}/{group}/{version}/namespaces/{namespace}/{resource}/{name}/actions/scale [patch] @Security JWT

func (*REST) Update

func (h *REST) Update(c *gin.Context)

@Tags Agent.V1 @Summary 创建namespaced scope workload @Description 创建namespaced scope workload @Accept json @Produce json @Param cluster path string true "cluster" @Param group path string true "group" @Param version path string true "version" @Param resource path string true "resoruce" @Param name path string true "name" @Param namespace path string true "namespace" @Param data body object true "body" @Success 200 {object} handlers.ResponseStruct{Data=object} "counter" @Router /v1/proxy/cluster/{cluster}/{group}/{version}/namespaces/{namespace}/{resource}/{name} [put] @Security JWT

type RevisionHistory

type RevisionHistory struct {
	Revision   int64       `json:"revision"`
	CreateTime metav1.Time `json:"createTime"`
	Namespace  string      `json:"namespace"`
	Name       string      `json:"name"`
	Kind       string      `json:"kind"`
	Images     []string    `json:"images"`
	Cause      string      `json:"cause"`
	Extra      string      `json:"extra"`
	Current    bool        `json:"current"`
}

type Revisions

type Revisions []*RevisionHistory

func (Revisions) Len

func (r Revisions) Len() int

func (Revisions) Less

func (r Revisions) Less(i, j int) bool

func (Revisions) Swap

func (r Revisions) Swap(i, j int)

type RolloutHandler

type RolloutHandler struct {
	// contains filtered or unexported fields
}

func (*RolloutHandler) DaemonSetHistory

func (h *RolloutHandler) DaemonSetHistory(c *gin.Context)

func (*RolloutHandler) DaemonsetRollback

func (h *RolloutHandler) DaemonsetRollback(c *gin.Context)

func (*RolloutHandler) DeploymentHistory

func (h *RolloutHandler) DeploymentHistory(c *gin.Context)

func (*RolloutHandler) DeploymentRollback

func (h *RolloutHandler) DeploymentRollback(c *gin.Context)

func (*RolloutHandler) StatefulSetHistory

func (h *RolloutHandler) StatefulSetHistory(c *gin.Context)

func (*RolloutHandler) StatefulSetRollback

func (h *RolloutHandler) StatefulSetRollback(c *gin.Context)

type SecretHandler

type SecretHandler struct {
	C client.Client
	// contains filtered or unexported fields
}

func (*SecretHandler) List

func (h *SecretHandler) List(c *gin.Context)

@Tags Agent.V1 @Summary 获取Secret列表数据 @Description 获取Secret列表数据,其中包含了对 tls 类型的secret证书详情 @Accept json @Produce json @Param order query string false "page" @Param search query string false "search" @Param page query int false "page" @Param size query int false "page" @Param namespace path string true "namespace" @Param cluster path string true "cluster" @Success 200 {object} handlers.ResponseStruct{Data=pagination.PageData{List=[]SecretWithCertsInfo}} "Secrets" @Router /v1/proxy/cluster/{cluster}/custom/core/v1/namespaces/{namespace}/secrets [get] @Security JWT

type SecretWithCertsInfo

type SecretWithCertsInfo struct {
	Secret   *corev1.Secret                     `json:"secret,omitempty"`
	CertInfo map[string]certificate.Certificate `json:"certInfo,omitempty"`
}

func (SecretWithCertsInfo) GetCreationTimestamp

func (s SecretWithCertsInfo) GetCreationTimestamp() metav1.Time

func (SecretWithCertsInfo) GetName

func (s SecretWithCertsInfo) GetName() string

type ServiceProxyHandler

type ServiceProxyHandler struct{}

func (*ServiceProxyHandler) ServiceProxy

func (sp *ServiceProxyHandler) ServiceProxy(c *gin.Context)

type SortAndSearchAble

type SortAndSearchAble = pagination.SortAndSearchAble

type StatisticsHandler

type StatisticsHandler struct {
	C cluster.Interface
}

func (*StatisticsHandler) ClusterResourceStatistics

func (sth *StatisticsHandler) ClusterResourceStatistics(c *gin.Context)

ClusterResourceStatistics 获取集群级别资源统计 @Tags Agent.V1 @Summary 获取集群级别资源统计 @Description 获取集群级别资源统计 @Accept json @Produce json @Param cluster path string true "cluster" @Success 200 {object} handlers.ResponseStruct{Data=object} "counter" @Router /v1/proxy/cluster/{cluster}/custom/statistics.system/v1/resources [get] @Security JWT

func (*StatisticsHandler) ClusterStatistics added in v1.23.0

func (sth *StatisticsHandler) ClusterStatistics(c *gin.Context)

ClusterResourceStatistics 获取集群级别统计 @Tags Agent.V1 @Summary 获取集群级别统计 @Description 获取集群级别统计 @Accept json @Produce json @Param cluster path string true "cluster" @Success 200 {object} handlers.ResponseStruct{Data=statistics.ClusterStatistics} "counter" @Router /v1/proxy/cluster/{cluster}/custom/statistics.system/v1/all [get] @Security JWT

func (*StatisticsHandler) ClusterWorkloadStatistics

func (sth *StatisticsHandler) ClusterWorkloadStatistics(c *gin.Context)

@Tags Agent.V1 @Summary 获取集群内各种workload的统计 @Description 获取集群内各种workload的统计 @Accept json @Produce json @Param cluster path string true "cluster" @Success 200 {object} handlers.ResponseStruct{Data=object} "counter" @Router /v1/proxy/cluster/{cluster}/custom/statistics.system/v1/workloads [get] @Security JWT

type Watcher

type Watcher struct {
	Cache cache.Cache
	// contains filtered or unexported fields
}

func NewWatcher

func NewWatcher(c cache.Cache) *Watcher

func (*Watcher) DispatchMessage

func (w *Watcher) DispatchMessage(message interface{})

func (*Watcher) Notify

func (w *Watcher) Notify(obj interface{}, evt msgbus.EventKind)

func (*Watcher) Start

func (w *Watcher) Start()

func (*Watcher) StreamWatch

func (w *Watcher) StreamWatch(c *gin.Context)

StreamWatch watch集群的事件 [不暴露给客户端]

Jump to

Keyboard shortcuts

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