2020-09-27 16:27:46 +08:00
|
|
|
package model
|
|
|
|
|
2021-06-30 20:47:39 +08:00
|
|
|
import "github.com/goodrain/rainbond/worker/server/pb"
|
|
|
|
|
2020-09-27 16:27:46 +08:00
|
|
|
// AppPort -
|
|
|
|
type AppPort struct {
|
|
|
|
ServiceID string `json:"service_id" validate:"required"`
|
|
|
|
ContainerPort int `json:"container_port" validate:"required"`
|
|
|
|
PortAlias string `json:"port_alias" validate:"required"`
|
|
|
|
K8sServiceName string `json:"k8s_service_name" validate:"required"`
|
|
|
|
}
|
2020-09-28 16:43:27 +08:00
|
|
|
|
|
|
|
// AppStatus -
|
|
|
|
type AppStatus struct {
|
2021-07-22 16:01:08 +08:00
|
|
|
AppID string `json:"app_id"`
|
|
|
|
AppName string `json:"app_name"`
|
2021-05-11 10:32:55 +08:00
|
|
|
Status string `json:"status"`
|
2021-05-12 11:39:38 +08:00
|
|
|
CPU *int64 `json:"cpu"`
|
2021-07-22 16:01:08 +08:00
|
|
|
GPU *int64 `json:"gpu"`
|
2021-05-11 10:32:55 +08:00
|
|
|
Memory *int64 `json:"memory"`
|
|
|
|
Disk int64 `json:"disk"`
|
|
|
|
Phase string `json:"phase"`
|
|
|
|
Version string `json:"version"`
|
|
|
|
Overrides []string `json:"overrides"`
|
|
|
|
Conditions []*AppStatusCondition `json:"conditions"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// AppStatusCondition is the conditon of app status.
|
|
|
|
type AppStatusCondition struct {
|
|
|
|
Type string `json:"type"`
|
|
|
|
Status bool `json:"status"`
|
|
|
|
Reason string `json:"reason"`
|
|
|
|
Message string `json:"message"`
|
2021-04-16 16:27:21 +08:00
|
|
|
}
|
2021-04-17 15:47:59 +08:00
|
|
|
|
|
|
|
// AppService -
|
|
|
|
type AppService struct {
|
2021-06-30 20:47:39 +08:00
|
|
|
ServiceName string `json:"service_name"`
|
|
|
|
Address string `json:"address"`
|
|
|
|
Ports []*pb.AppService_Port `json:"ports"`
|
|
|
|
OldPods []*AppPod `json:"oldPods"`
|
|
|
|
Pods []*AppPod `json:"pods"`
|
2021-04-17 15:47:59 +08:00
|
|
|
}
|
|
|
|
|
2021-04-23 10:03:15 +08:00
|
|
|
// ByServiceName implements sort.Interface for []*AppService based on
|
|
|
|
// the ServiceName field.
|
|
|
|
type ByServiceName []*AppService
|
|
|
|
|
|
|
|
func (a ByServiceName) Len() int { return len(a) }
|
|
|
|
func (a ByServiceName) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
|
|
|
|
func (a ByServiceName) Less(i, j int) bool { return a[i].ServiceName < a[j].ServiceName }
|
|
|
|
|
2021-05-12 11:39:38 +08:00
|
|
|
// AppPod -
|
2021-04-17 15:47:59 +08:00
|
|
|
type AppPod struct {
|
|
|
|
PodName string `json:"pod_name"`
|
|
|
|
PodStatus string `json:"pod_status"`
|
|
|
|
}
|
2021-04-27 11:13:54 +08:00
|
|
|
|
|
|
|
// ByPodName implements sort.Interface for []*AppPod based on
|
|
|
|
// the PodName field.
|
|
|
|
type ByPodName []*AppPod
|
|
|
|
|
|
|
|
func (a ByPodName) Len() int { return len(a) }
|
|
|
|
func (a ByPodName) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
|
|
|
|
func (a ByPodName) Less(i, j int) bool { return a[i].PodName < a[j].PodName }
|