cluster

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2023 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 3 more Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(kubeconfig string)

func Avg

func Avg(numbers []float64) float64

func Create

func Create(c *gin.Context)

Create Add cluster @Summary Add cluster @Description Add cluster @Tags Cluster @Accept json @Produce json @param Authorization header string true "Authorization" @Param createCluster body cluster.CreateClusterRequest true "The cluster info" @Success 200 {object} model.ClusterModel @Router /v1/cluster [post]

func Delete

func Delete(c *gin.Context)

GetList Delete the cluster completely @Summary Delete the cluster completely @Description Delete the cluster completely @Tags Cluster @Accept json @Produce json @Param Authorization header string true "Authorization" @Param id path uint64 true "Cluster ID" @Success 200 {object} api.Response "{"code":0,"message":"OK","data":null}" @Router /v1/cluster/{id} [delete]

func DivFloat64

func DivFloat64(a float64, b float64) float64

func DivInt64

func DivInt64(a int64, b int64) float64

func GenNamespace

func GenNamespace(c *gin.Context)

GenNamespace @Summary Gen Namespace @Description gen namespace for mesh dev space @Tags Cluster @Accept json @Produce json @param Authorization header string true "Authorization" @Param cluster path string true "cluster id" @Success 200 {object} cluster.Namespace "{"code":0,"message":"OK","data":cluster.Namespace}" @Router /v1/cluster/{id}/gen_namespace [get]

func GetDetail

func GetDetail(c *gin.Context)

@Summary Get cluster details @Description Get cluster details @Tags Cluster @Accept json @Produce json @param Authorization header string true "Authorization" @Param id path string true "Cluster ID" @Success 200 {object} model.ClusterModel "include kubeconfig" @Router /v1/cluster/{id}/detail [get]

func GetDevSpaceClusterList

func GetDevSpaceClusterList(c *gin.Context)

GetDevSpaceClusterList Get the devSpace cluster list @Summary Get the cluster list which user can create devSpace @Description Get the cluster list which user can create devSpace @Tags Cluster @Accept json @Produce json @param Authorization header string true "Authorization" @Success 200 {object} model.ClusterList "{"code":0,"message":"OK","data":model.ClusterList}" @Router /v2/dev_space/cluster [get]

func GetFromCache

func GetFromCache(kubeconfig string) []model.Resource

func GetList

func GetList(c *gin.Context)

GetList Get the cluster list @Summary Get the cluster list @Description Get the cluster list @Tags Cluster @Accept json @Produce json @param Authorization header string true "Authorization" @Success 200 {object} model.ClusterListVo "{"code":0,"message":"OK","data":model.ClusterListVo}" @Router /v1/cluster [get]

func GetSpaceDetail

func GetSpaceDetail(c *gin.Context)

@Summary Details of a development environment in the cluster @Description Get cluster development environment details through cluster id and development environment id @Tags Cluster @Accept json @Produce json @param Authorization header string true "Authorization" @Param id path string true "Cluster ID" @Param space_id path string true "DevSpace ID" @Success 200 {object} model.ClusterUserModel "include kubeconfig" @Router /v1/cluster/{id}/dev_space/{space_id}/detail [get]

func GetSpaceList

func GetSpaceList(c *gin.Context)

@Summary Cluster dev space list @Description Cluster entrance to obtain cluster development environment @Tags Cluster @Accept json @Produce json @param Authorization header string true "Authorization" @Param id path string true "Cluster ID" @Success 200 {object} model.ClusterUserModel "kubeconfig" @Router /v1/cluster/{id}/dev_space [get]

func GetStorageClass

func GetStorageClass(c *gin.Context)

@Summary Get cluster storageClass from cluster list @Description Get cluster storageClass from cluster list @Tags Cluster @Accept json @Produce json @param Authorization header string true "Authorization" @Param id path string true "Cluster ID" @Success 200 {object} cluster.StorageClassResponse "include kubeconfig" @Router /v1/cluster/{id}/storage_class [get]

func GetStorageClassByKubeConfig

func GetStorageClassByKubeConfig(c *gin.Context)

@Summary Get cluster storageClass from create cluster @Description Get cluster storageClass from create cluster @Tags Cluster @Accept json @Produce json @param Authorization header string true "Authorization" @Param createCluster body cluster.StorageClassRequest true "The cluster info" @Success 200 {object} cluster.StorageClassResponse "include kubeconfig" @Router /v1/cluster/kubeconfig/storage_class [post]

func HasPrivilegeToSomeCluster

func HasPrivilegeToSomeCluster(c *gin.Context, clusterId uint64) (*model.ClusterModel, error)

HasPrivilegeToSomeCluster include - * devspace - * cluster

func Init

func Init()

in case of resource leak

func ListByUser

func ListByUser(c *gin.Context)

list permitted dev_space by user distinct by cluster id

func Merge

func Merge(availableKubeConfigs map[string]string)

remove unneeded kubeconfig goroutines

func Migrate

func Migrate(c *gin.Context)

func Remove

func Remove(kubeconfig string)

func Update

func Update(c *gin.Context)

@Summary Update cluster @Description Update cluster @Tags Cluster @Accept json @Produce json @param Authorization header string true "Authorization" @Param id path string true "Cluster ID" @Param createCluster body cluster.UpdateClusterRequest true "The cluster info" @Success 200 {object} model.ClusterModel "include kubeconfig" @Router /v1/cluster/{id} [put]

Types

type Cluster

type Cluster struct {
	CertificateAuthorityData string
	Server                   string
}

type ClusterDetailResponse

type ClusterDetailResponse struct {
	ID           uint64    `json:"id"`
	Name         string    `json:"name"`
	Info         string    `json:"info"`
	UserId       uint64    `json:"user_id"`
	Server       string    `json:"server"`
	KubeConfig   string    `json:"kubeconfig"`
	StorageClass string    `json:"storage_class"`
	CreatedAt    time.Time `gorm:"column:created_at" json:"created_at"`
}

type ClusterSafeList

type ClusterSafeList struct {
	ClusterList []*model.ClusterList
	Lock        *sync.Mutex
}

type ClusterStatus

type ClusterStatus struct {
	ClusterId       uint64
	Ready           bool
	NotReadyMessage string
}

type ClusterUserMigrateRequest

type ClusterUserMigrateRequest struct {
	Migrate []NsAndUsers
}

type Clusters

type Clusters struct {
	Cluster Cluster
	Name    string
}

type CreateClusterRequest

type CreateClusterRequest struct {
	Name           string `json:"name" binding:"required"`
	KubeConfig     string `json:"kubeconfig" binding:"required" example:"base64encode(value)"`
	StorageClass   string `json:"storage_class"`
	ExtraApiServer string `json:"extra_api_server" binding:"omitempty,url"`
}

type KubeConfig

type KubeConfig struct {
	Clusters []Clusters
}

type Namespace

type Namespace struct {
	Namespace string `json:"namespace"`
}

type NsAndUsers

type NsAndUsers struct {
	Namespace string
	Users     []string
}

type StorageClassRequest

type StorageClassRequest struct {
	KubeConfig string `json:"kubeconfig" example:"base64encode(value)"`
}

type StorageClassResponse

type StorageClassResponse struct {
	TypeName []string `json:"type_name"`
}

type UpdateClusterRequest

type UpdateClusterRequest struct {
	StorageClass string `json:"storage_class"`
}

Jump to

Keyboard shortcuts

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