handler

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2018 License: MIT Imports: 29 Imported by: 3

Documentation

Index

Constants

View Source
const (
	B  = 1
	KB = 1024 * B
	MB = 1024 * KB
	GB = 1024 * MB
)

Variables

This section is empty.

Functions

func AppNameDuplicateChecker

func AppNameDuplicateChecker(ctx iris.Context)

check whether a app name exist in db

func ApplyVersion

func ApplyVersion(ctx iris.Context)

the ApplyVersion handler to apply a version config that created before. this handler will replace a version with the specified one, that is to remove the resources of the previous version config and then create the resources about the specified version config

func CPUCheck

func CPUCheck(c iris.Context)

@Summary Checks the cpu usage @Description Checks the cpu usage @Tags sd @Accept json @Produce json @Success 200 {string} plain "CRITICAL - Load average: 1.78, 1.99, 2.02 | Cores: 2" @Router /sd/cpu [get]

func ConfigDeployment

func ConfigDeployment(version_config model.VersionConfig) *appsv1b1.Deployment

config the Deployment with version_config struct and return the pointer of the deployment object

func ConfigService

func ConfigService(version_config model.VersionConfig) *apiv1.Service

config the service with the version_config struct and return the pointer of the service object

func ConfirmUser

func ConfirmUser(ctx iris.Context)

func CreateApp

func CreateApp(ctx iris.Context)

create a new app

func CreateNS

func CreateNS(ctx iris.Context)

func CreateService

func CreateService(ctx iris.Context)

create a service

func CreateUser

func CreateUser(ctx iris.Context)

func CreateVersion

func CreateVersion(ctx iris.Context)

the CreateVersion handler just to create a version config and store it to database and it doesn't create any resources in the cluster, you can create resources by applying one version config that created before. That is to send a request to the ApplyVersion handler

func DeleteApp

func DeleteApp(ctx iris.Context)

delete an app, dangerous action. it will delete all the resources which belongs to this app. such as services,versions and the deployment,service in the cluster

func DeleteDeploymentAndServiceInCluster

func DeleteDeploymentAndServiceInCluster(version_config model.VersionConfig) error

func DeleteNS

func DeleteNS(ctx iris.Context)

func DeleteService

func DeleteService(ctx iris.Context)

delete a service by id, dangerous action. If the service has active version, then we will delete the active version's deployment and service in the cluster, and all the version records of the service including the service record itself. If the service not have a active version,that is to say there is no deployment and service of the service that asked to delete in the cluster, so we will just to delete all the version records of the service including the service record itself.

func DeleteUser

func DeleteUser(ctx iris.Context)

func DeleteVersion

func DeleteVersion(ctx iris.Context)

the DeleteVersion handler will delete the version config information first, if the version config that requested to be deleted is being used at that time, then the resources about the version config will be removed in the cluster too.

func DiskCheck

func DiskCheck(c iris.Context)

@Summary Checks the disk usage @Description Checks the disk usage @Tags sd @Accept json @Produce json @Success 200 {string} plain "OK - Free space: 17233MB (16GB) / 51200MB (50GB) | Used: 33%" @Router /sd/disk [get]

func GetApp

func GetApp(ctx iris.Context)

get app info

func GetAppList

func GetAppList(ctx iris.Context)

get app list

func GetCommandOutput

func GetCommandOutput(ns, pod_name, container_name string, cmd []string) (string, error)

func GetLog

func GetLog(ctx iris.Context)

get log from a container, this handler need namespace, pod name and container name

func GetPod

func GetPod(ctx iris.Context)

get useful pod messages from specified namespace

func GetService

func GetService(ctx iris.Context)

get a service info by svc_name

func GetServiceList

func GetServiceList(ctx iris.Context)

get all services or services that belongs to an app

func GetUser

func GetUser(ctx iris.Context)

func GetUserList

func GetUserList(ctx iris.Context)

func GetVersion

func GetVersion(ctx iris.Context)

the GetVersion handler is to get detail information of a version

func GetVersionList

func GetVersionList(ctx iris.Context)

the GetVersionList handler can get all the Version config information in the database or just to get the version config that belongs to one service.

func Handle404

func Handle404(ctx iris.Context)

func HealthCheck

func HealthCheck(c iris.Context)

@Summary Shows OK as the ping-pong result @Description Shows OK as the ping-pong result @Tags sd @Accept json @Produce json @Success 200 {string} plain "OK" @Router /sd/health [get]

func ListNS

func ListNS(ctx iris.Context)

func RAMCheck

func RAMCheck(c iris.Context)

@Summary Checks the ram usage @Description Checks the ram usage @Tags sd @Accept json @Produce json @Success 200 {string} plain "OK - Free space: 402MB (0GB) / 8192MB (8GB) | Used: 4%" @Router /sd/ram [get]

func ResendMail

func ResendMail(ctx iris.Context)

邮箱验证邮件过期,重发

func Scale

func Scale(ctx iris.Context)

func SendResponse

func SendResponse(c iris.Context, err error, data interface{})

func ServiceNameDuplicateChecker

func ServiceNameDuplicateChecker(ctx iris.Context)

check whether a service name exist in db

func SignToken

func SignToken(ctx iris.Context)

func Terminal

func Terminal(ctx iris.Context)

func UnapplyVersion

func UnapplyVersion(ctx iris.Context)

the UnapplyVersion handler just to STOP a being used Version config, that is to delete the resources of the version config in the cluster, but the version config information is still exist in the database, so you can apply it to create the resources again.

func UpdateApp

func UpdateApp(ctx iris.Context)

update the info of a app

func UpdateService

func UpdateService(ctx iris.Context)

update app_id or/and svc_name or/and svc_desc

func UpdateUser

func UpdateUser(ctx iris.Context)

func UpdateVersion

func UpdateVersion(ctx iris.Context)

the UpdateVersion handler

func UserInfoDuplicateChecker

func UserInfoDuplicateChecker(ctx iris.Context)

Types

type Nsmsg

type Nsmsg struct {
	Name       string            `json:"name"`
	Status     v1.NamespacePhase `json:"status"`
	CreateTime string            `json:"create_time"`
}

type PodMessage

type PodMessage struct {
	PodName    string            `json:"pod_name"`
	Containers []string          `json:"containers"`
	PodStatus  v1.PodPhase       `json:"pod_status"`
	PodLabels  map[string]string `json:"pod_labels"`
}

直接返回pods *v1.PodList会返回太多无用信息,所以这里做了一层过滤,只选择其中有用的信息 以减少带宽和响应时间。如需增加其他信息,修改PodMessage结构和SelectMessage函数即可

Jump to

Keyboard shortcuts

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