clusterhandler

package
v1.24.1 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2023 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ModelName      = "Cluster"
	PrimaryKeyName = "cluster_id"
	SearchFields   = []string{"ClusterName"}
	FilterFields   = []string{"ClusterName"}
	PreloadFields  = []string{"Environments", "TenantResourceQuotas"}
)

Functions

func CheckBeforeAdd added in v1.23.6

func CheckBeforeAdd(ctx context.Context, db *database.Database, cluster *models.Cluster) error

func CompleteCluster added in v1.23.6

func CompleteCluster(ctx context.Context, cluster *models.Cluster, restconfig *rest.Config, clientSet kubernetes.Interface) error

func ConfigClientCertExpire added in v1.23.6

func ConfigClientCertExpire(cfg *rest.Config) *time.Time

func DetectCRIRuntime added in v1.23.6

func DetectCRIRuntime(ctx context.Context, cs kubernetes.Interface) (string, error)

func OnKubeConfig added in v1.23.6

func OnKubeConfig(ctx context.Context,
	cfgraw []byte,
	f func(ctx context.Context, cs *kubernetes.Clientset, cfg *rest.Config) error,
) error

Types

type ClusterHandler

type ClusterHandler struct {
	base.BaseHandler
}

func (*ClusterHandler) DeleteCluster

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

DeleteCluster 删除 Cluster

@Tags			Cluster
@Summary		删除 Cluster
@Description	删除 Cluster
@Accept			json
@Produce		json
@Param			record_only	query		string					false	"only delete record in database"
@Param			cluster_id	path		uint					true	"cluster_id"
@Success		204			{object}	handlers.ResponseStruct	"resp"
@Router			/v1/cluster/{cluster_id} [delete]
@Security		JWT

func (*ClusterHandler) ListCluster

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

ListCluster 列表 Cluster

@Tags			Cluster
@Summary		Cluster列表
@Description	Cluster列表
@Accept			json
@Produce		json
@Param			ClusterName	query		string																	false	"ClusterName"
@Param			preload		query		string																	false	"choices Environments,TenantResourceQuotas"
@Param			page		query		int																		false	"page"
@Param			size		query		int																		false	"page"
@Param			search		query		string																	false	"search in (ClusterName)"
@Success		200			{object}	handlers.ResponseStruct{Data=handlers.PageData{List=[]models.Cluster}}	"Cluster"
@Router			/v1/cluster [get]
@Security		JWT

func (*ClusterHandler) ListClusterEnvironment

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

ListClusterEnvironment 获取属于Cluster的 Environment 列表

@Tags			Cluster
@Summary		获取属于 Cluster 的 Environment 列表
@Description	获取属于 Cluster 的 Environment 列表
@Accept			json
@Produce		json
@Param			cluster_id	path		uint																		true	"cluster_id"
@Param			preload		query		string																		false	"choices Creator,Cluster,Project,Applications,Users"
@Param			page		query		int																			false	"page"
@Param			size		query		int																			false	"page"
@Param			search		query		string																		false	"search in (EnvironmentName)"
@Success		200			{object}	handlers.ResponseStruct{Data=handlers.PageData{List=[]models.Environment}}	"models.Environment"
@Router			/v1/cluster/{cluster_id}/environment [get]
@Security		JWT

func (*ClusterHandler) ListClusterLogQueryHistory

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

ListClusterLogQueryHistory 获取属于Cluster的 LogQueryHistory 列表

@Tags			Cluster
@Summary		获取属于 Cluster 的 LogQueryHistory 列表
@Description	获取属于 Cluster 的 LogQueryHistory 列表
@Accept			json
@Produce		json
@Param			cluster_id	path		uint																			true	"cluster_id"
@Param			preload		query		string																			false	"choices Cluster,Creator"
@Param			page		query		int																				false	"page"
@Param			size		query		int																				false	"page"
@Param			search		query		string																			false	"search in (LogQL)"
@Success		200			{object}	handlers.ResponseStruct{Data=handlers.PageData{List=[]models.LogQueryHistory}}	"models.LogQueryHistory"
@Router			/v1/cluster/{cluster_id}/logqueryhistory [get]
@Security		JWT

func (*ClusterHandler) ListClusterLogQueryHistoryv2

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

ListLogQueryHistory 聚合查询日志查询历史[按照当前用户的查询历史聚合]

@Tags			Cluster
@Summary		聚合查询日志查询历史, unique logql desc 按照当前用户的查询历史聚合
@Description	聚合查询日志查询历史 unique logql desc 按照当前用户的查询历史聚合
@Accept			json
@Produce		json
@Success		200	{object}	handlers.ResponseStruct{Data=[]models.LogQueryHistoryWithCount}	"LogQueryHistory"
@Router			/v1/cluster/{cluster_id}/logqueryhistoryv2 [get]
@Security		JWT

func (*ClusterHandler) ListClusterLogQuerySnapshot

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

ListClusterLogQuerySnapshot 获取属于Cluster的 LogQuerySnapshot 列表

@Tags			Cluster
@Summary		获取属于 Cluster 的 LogQuerySnapshot 列表
@Description	获取属于 Cluster 的 LogQuerySnapshot 列表
@Accept			json
@Produce		json
@Param			cluster_id	path		uint																			true	"cluster_id"
@Param			preload		query		string																			false	"choices Cluster,Creator"
@Param			page		query		int																				false	"page"
@Param			size		query		int																				false	"page"
@Param			search		query		string																			false	"search in (SnapshotName)"
@Success		200			{object}	handlers.ResponseStruct{Data=handlers.PageData{List=[]models.LogQuerySnapshot}}	"models.LogQuerySnapshot"
@Router			/v1/cluster/{cluster_id}/logquerysnapshot [get]
@Security		JWT

func (*ClusterHandler) ListClusterQuota

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

ClusterStatistics 集群资源状态

@Tags			Cluster
@Summary		集群资源状态
@Description	集群资源状态
@Accept			json
@Produce		json
@Param			cluster_id	path		int											true	"cluster_id"
@Success		200			{object}	handlers.ResponseStruct{Data=ClusterQuota}	"statistics"
@Router			/v1/cluster/{cluster_id}/quota [get]
@Security		JWT

func (*ClusterHandler) ListClusterStatus

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

ListClusterStatus 列出集群状态

@Tags			Cluster
@Summary		列出集群状态
@Description	列出集群状态
@Accept			json
@Produce		json
@Success		200	{object}	handlers.ResponseStruct{Data=map[string]bool}	"集群状态"
@Router			/v1/cluster/_/status [get]
@Security		JWT

func (*ClusterHandler) PostCluster

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

PostCluster 创建Cluster

@Tags			Cluster
@Summary		创建Cluster
@Description	创建Cluster
@Accept			json
@Produce		json
@Param			param	body		models.Cluster									true	"表单"
@Success		200		{object}	handlers.ResponseStruct{Data=models.Cluster}	"Cluster"
@Router			/v1/cluster [post]
@Security		JWT

func (*ClusterHandler) PutCluster

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

PutCluster 修改Cluster

@Tags			Cluster
@Summary		修改Cluster
@Description	修改Cluster
@Accept			json
@Produce		json
@Param			cluster_id	path		uint											true	"cluster_id"
@Param			param		body		models.Cluster									true	"表单"
@Success		200			{object}	handlers.ResponseStruct{Data=models.Cluster}	"Cluster"
@Router			/v1/cluster/{cluster_id} [put]
@Security		JWT

func (*ClusterHandler) RegistRouter

func (h *ClusterHandler) RegistRouter(rg *gin.RouterGroup)

func (*ClusterHandler) RetrieveCluster

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

RetrieveCluster Cluster详情

@Tags			Cluster
@Summary		Cluster详情
@Description	get Cluster详情
@Accept			json
@Produce		json
@Param			cluster_id	path		uint											true	"cluster_id"
@Success		200			{object}	handlers.ResponseStruct{Data=models.Cluster}	"Cluster"
@Router			/v1/cluster/{cluster_id} [get]
@Security		JWT

func (*ClusterHandler) ValidateKubeConfig

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

ValidateKubeConfig 添加cluster前的kubeconfig检测接口,验证kubeconfig,返回集群信息和可用的storageClass列表

@Tags			Cluster
@Summary		添加cluster前的kubeconfig检测接口,验证kubeconfig,返回集群信息和可用的storageClass列表
@Description	添加cluster前的kubeconfig检测接口,验证kubeconfig,返回集群信息和可用的storageClass列表
@Accept			json
@Produce		json
@Param			param	body		ValidateKubeConfigReq									true	"表单"
@Success		200		{object}	handlers.ResponseStruct{Data=ValidateKubeConfigResp}	"Cluster"
@Router			/v1/cluster/validate-kubeconfig [post]
@Security		JWT

type ClusterQuota

type ClusterQuota struct {
	statistics.ClusterStatistics
	OversoldConfig datatypes.JSON `json:"oversoldConfig"`
}

type ValidateKubeConfigReq

type ValidateKubeConfigReq struct {
	KubeConfig string `json:"kubeconfig" binding:"json"`
}

type ValidateKubeConfigResp

type ValidateKubeConfigResp struct {
	ServerInfo     *kversion.Info `json:"serverInfo,omitempty"`
	StorageClasses []string       `json:"storageClasses,omitempty"`

	// 判断是否存在installer,若存在即可加为控制集群
	ExistInstaller bool                       `json:"existInstaller"`
	GlobalValues   pluginmanager.GlobalValues `json:"globalValues"`
	ClusterName    string                     `json:"clusterName"`
	Connectable    bool                       `json:"connectable,omitempty"`
	Message        string                     `json:"message,omitempty"`
}

Jump to

Keyboard shortcuts

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