instanceinfo

package
v1.3.0-rc.0...-12c9840 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ServicePhaseHealthy   = "Healthy"
	ServicePhaseUnHealthy = "UnHealthy"

	InstancePhaseRunning   = "Running"
	InstancePhaseHealthy   = "Healthy"
	InstancePhaseUnHealthy = "UnHealthy"
	InstancePhaseDead      = "Dead"

	PodPhasePending   = "Pending"
	PodPhaseRunning   = "Running"
	PodPhaseSucceeded = "Succeeded"
	PodPhaseFailed    = "Failed"
	PodPhaseUnknown   = "Unknown"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AddonPrebuild

type AddonPrebuild struct {
	ID                uint64    `gorm:"primary_key"`
	ApplicationID     string    `gorm:"type:varchar(32)"`
	GitBranch         string    `gorm:"type:varchar(128)"`
	Env               string    `gorm:"type:varchar(10)"`
	RuntimeID         string    `gorm:"type:varchar(32)"`
	RoutingInstanceID string    `gorm:"type:varchar(64)"`
	InstanceID        string    `gorm:"type:varchar(64)"`
	InstanceName      string    `gorm:"type:varchar(128)"`
	AddonName         string    `gorm:"type:varchar(128)"`
	Plan              string    `gorm:"column:addon_class;type:varchar(64)"`
	Options           string    `gorm:"type:varchar(1024)"`
	Config            string    `gorm:"type:varchar(1024)"`
	BuildFrom         int       `gorm:"type:int(1);default:0"`            // 0: dice.yml 来源 1: 重新分析
	DeleteStatus      int       `gorm:"type:int(1),column:delete_status"` // 0: 未删除,1: diceyml删除,2: 重新分析删除
	Deleted           string    `gorm:"column:is_deleted"`
	CreatedAt         time.Time `gorm:"column:create_time"`
	UpdatedAt         time.Time `gorm:"column:update_time"`
}

func (AddonPrebuild) TableName

func (AddonPrebuild) TableName() string

type Client

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

func New

func New(db *dbengine.DBEngine) *Client

func (*Client) CreateHPAEventInfo

func (c *Client) CreateHPAEventInfo(hpaEvent dbclient.HPAEventInfo) error

func (*Client) CreateVPARecommendation

func (c *Client) CreateVPARecommendation(vpaRecommendation dbclient.RuntimeVPAContainerRecommendation) error

func (*Client) DeletedOldVPARecommendations

func (c *Client) DeletedOldVPARecommendations(interval int) error

func (*Client) GetLatestVPARecommendation

func (c *Client) GetLatestVPARecommendation(runtimeId uint64, ruleId, serviceName, containerName string) (dbclient.RuntimeVPAContainerRecommendation, error)

func (*Client) GetRuntimeID

func (c *Client) GetRuntimeID(instanceID string) (string, error)

func (*Client) InstanceReader

func (c *Client) InstanceReader() *InstanceReader

func (*Client) InstanceWriter

func (c *Client) InstanceWriter() *instanceWriter

func (*Client) PodReader

func (c *Client) PodReader() *PodReader

func (*Client) PodWriter

func (c *Client) PodWriter() *podWriter

func (*Client) ServiceReader

func (c *Client) ServiceReader() *ServiceReader

func (*Client) ServiceWriter

func (c *Client) ServiceWriter() *serviceWriter

func (*Client) UpdateClusterInfo

func (c *Client) UpdateClusterInfo(clusterName, clusterInfo string) error

type ClusterInfo

type ClusterInfo struct {
	ClusterName string `gorm:"column:name"`
	ClusterInfo string `gorm:"column:cluster_info"`
}

func (ClusterInfo) TableName

func (ClusterInfo) TableName() string

type InstanceInfo

type InstanceInfo struct {
	dbengine.BaseModel
	Cluster   string `gorm:"type:varchar(64);index"`
	Namespace string `gorm:"type:varchar(64);index"`
	Name      string `gorm:"type:varchar(64);index"`

	// Information obtained from env
	OrgName             string `gorm:"type:varchar(64);index"`
	OrgID               string `gorm:"type:varchar(64);index"`
	ProjectName         string `gorm:"type:varchar(64);index"`
	ProjectID           string `gorm:"type:varchar(64);index"`
	ApplicationName     string
	EdgeApplicationName string
	EdgeSite            string
	ApplicationID       string
	RuntimeName         string
	RuntimeID           string
	ServiceName         string
	Workspace           string `gorm:"type:varchar(10)"`
	// addon, stateless-service
	ServiceType string `gorm:"type:varchar(64)"`
	AddonID     string

	Meta string
	// If it is k8s, the value is "k8s"
	TaskID string `gorm:"type:varchar(150);index"`

	Phase       InstancePhase
	Message     string
	ContainerID string `gorm:"type:varchar(100);index"`
	ContainerIP string
	HostIP      string
	StartedAt   time.Time
	FinishedAt  *time.Time
	ExitCode    int
	CpuOrigin   float64
	MemOrigin   int
	CpuRequest  float64
	MemRequest  int
	CpuLimit    float64
	MemLimit    int
	Image       string
}

func (InstanceInfo) Metadata

func (i InstanceInfo) Metadata(k string) (string, bool)

func (InstanceInfo) TableName

func (InstanceInfo) TableName() string

type InstancePhase

type InstancePhase string

type InstanceReader

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

func (*InstanceReader) ByAddonID

func (r *InstanceReader) ByAddonID(id string) *InstanceReader

func (*InstanceReader) ByApplicationID

func (r *InstanceReader) ByApplicationID(id string) *InstanceReader

func (*InstanceReader) ByApplicationName

func (r *InstanceReader) ByApplicationName(name string) *InstanceReader

func (*InstanceReader) ByCluster

func (r *InstanceReader) ByCluster(clustername string) *InstanceReader

func (*InstanceReader) ByContainerID

func (r *InstanceReader) ByContainerID(id string) *InstanceReader

func (*InstanceReader) ByEdgeApplicationName

func (r *InstanceReader) ByEdgeApplicationName(name string) *InstanceReader

func (*InstanceReader) ByEdgeSite

func (r *InstanceReader) ByEdgeSite(name string) *InstanceReader

func (*InstanceReader) ByFinishedTime

func (r *InstanceReader) ByFinishedTime(beforeNday int) *InstanceReader

func (*InstanceReader) ByHostIP

func (r *InstanceReader) ByHostIP(ips ...string) *InstanceReader

func (*InstanceReader) ByInstanceIP

func (r *InstanceReader) ByInstanceIP(ips ...string) *InstanceReader

func (*InstanceReader) ByMetaLike

func (r *InstanceReader) ByMetaLike(s string) *InstanceReader

func (*InstanceReader) ByName

func (r *InstanceReader) ByName(name string) *InstanceReader

func (*InstanceReader) ByNamespace

func (r *InstanceReader) ByNamespace(ns string) *InstanceReader

func (*InstanceReader) ByNotTaskID

func (r *InstanceReader) ByNotTaskID(id string) *InstanceReader

func (*InstanceReader) ByOrgID

func (r *InstanceReader) ByOrgID(id string) *InstanceReader

func (*InstanceReader) ByOrgName

func (r *InstanceReader) ByOrgName(name string) *InstanceReader

func (*InstanceReader) ByPhase

func (r *InstanceReader) ByPhase(phase string) *InstanceReader

func (*InstanceReader) ByPhases

func (r *InstanceReader) ByPhases(phases ...string) *InstanceReader

func (*InstanceReader) ByProjectID

func (r *InstanceReader) ByProjectID(id string) *InstanceReader

func (*InstanceReader) ByProjectName

func (r *InstanceReader) ByProjectName(name string) *InstanceReader

func (*InstanceReader) ByRuntimeID

func (r *InstanceReader) ByRuntimeID(id string) *InstanceReader

func (*InstanceReader) ByRuntimeName

func (r *InstanceReader) ByRuntimeName(name string) *InstanceReader

func (*InstanceReader) ByService

func (r *InstanceReader) ByService(name string) *InstanceReader

func (*InstanceReader) ByServiceType

func (r *InstanceReader) ByServiceType(tp string) *InstanceReader

func (*InstanceReader) ByTaskID

func (r *InstanceReader) ByTaskID(id string) *InstanceReader

func (*InstanceReader) ByUpdatedTime

func (r *InstanceReader) ByUpdatedTime(beforeNSecs int) *InstanceReader

func (*InstanceReader) ByWorkspace

func (r *InstanceReader) ByWorkspace(ws string) *InstanceReader

func (*InstanceReader) Do

func (r *InstanceReader) Do() ([]InstanceInfo, error)

func (*InstanceReader) Limit

func (r *InstanceReader) Limit(n int) *InstanceReader

type PodInfo

type PodInfo struct {
	dbengine.BaseModel
	Cluster   string `gorm:"type:varchar(64);index"`
	Namespace string `gorm:"type:varchar(64);index"`
	Name      string `gorm:"type:varchar(64);index"`

	// Information obtained from env
	OrgName         string `gorm:"type:varchar(64);index"`
	OrgID           string `gorm:"type:varchar(64);index"`
	ProjectName     string `gorm:"type:varchar(64);index"`
	ProjectID       string `gorm:"type:varchar(64);index"`
	ApplicationName string
	ApplicationID   string
	RuntimeName     string
	RuntimeID       string
	ServiceName     string
	Workspace       string `gorm:"type:varchar(10)"`
	// addon, stateless-service
	ServiceType string `gorm:"type:varchar(64)"`
	AddonID     string

	Uid          string `gorm:"index"`
	K8sNamespace string `gorm:"index"`
	PodName      string `gorm:"index"`

	Phase     PodPhase
	Message   string
	PodIP     string
	HostIP    string
	StartedAt *time.Time

	MemRequest int
	MemLimit   int
	CpuRequest float64
	CpuLimit   float64
}

func (PodInfo) TableName

func (PodInfo) TableName() string

type PodPhase

type PodPhase string

type PodReader

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

func (*PodReader) ByAddonID

func (r *PodReader) ByAddonID(id string) *PodReader

func (*PodReader) ByApplicationID

func (r *PodReader) ByApplicationID(id string) *PodReader

func (*PodReader) ByApplicationName

func (r *PodReader) ByApplicationName(name string) *PodReader

func (*PodReader) ByCluster

func (r *PodReader) ByCluster(clustername string) *PodReader

func (*PodReader) ByK8SNamespace

func (r *PodReader) ByK8SNamespace(namespace string) *PodReader

func (*PodReader) ByName

func (r *PodReader) ByName(name string) *PodReader

func (*PodReader) ByNamespace

func (r *PodReader) ByNamespace(ns string) *PodReader

func (*PodReader) ByOrgID

func (r *PodReader) ByOrgID(id string) *PodReader

func (*PodReader) ByOrgName

func (r *PodReader) ByOrgName(name string) *PodReader

func (*PodReader) ByPhase

func (r *PodReader) ByPhase(phase string) *PodReader

func (*PodReader) ByPhases

func (r *PodReader) ByPhases(phases ...string) *PodReader

func (*PodReader) ByPodName

func (r *PodReader) ByPodName(podname string) *PodReader

func (*PodReader) ByProjectID

func (r *PodReader) ByProjectID(id string) *PodReader

func (*PodReader) ByProjectName

func (r *PodReader) ByProjectName(name string) *PodReader

func (*PodReader) ByRuntimeID

func (r *PodReader) ByRuntimeID(id string) *PodReader

func (*PodReader) ByRuntimeName

func (r *PodReader) ByRuntimeName(name string) *PodReader

func (*PodReader) ByService

func (r *PodReader) ByService(name string) *PodReader

func (*PodReader) ByServiceType

func (r *PodReader) ByServiceType(tp string) *PodReader

func (*PodReader) ByUid

func (r *PodReader) ByUid(uid string) *PodReader

func (*PodReader) ByUpdatedTime

func (r *PodReader) ByUpdatedTime(beforeNSecs int) *PodReader

func (*PodReader) ByWorkspace

func (r *PodReader) ByWorkspace(ws string) *PodReader

func (*PodReader) Do

func (r *PodReader) Do() ([]PodInfo, error)

func (*PodReader) Limit

func (r *PodReader) Limit(n int) *PodReader

type ServiceInfo

type ServiceInfo struct {
	dbengine.BaseModel
	Cluster   string
	Namespace string `gorm:"type:varchar(64);index"`
	Name      string `gorm:"type:varchar(64);index"`

	// Information obtained from env
	OrgName         string `gorm:"type:varchar(64);index"`
	OrgID           string `gorm:"type:varchar(64);index"`
	ProjectName     string `gorm:"type:varchar(64);index"`
	ProjectID       string `gorm:"type:varchar(64);index"`
	ApplicationName string
	ApplicationID   string
	RuntimeName     string
	RuntimeID       string
	ServiceName     string
	Workspace       string `gorm:"type:varchar(10)"`
	// addon, stateless-service
	ServiceType string `gorm:"type:varchar(64)"`

	Meta string

	Phase      ServicePhase
	Message    string
	StartedAt  time.Time
	FinishedAt *time.Time
}

func (ServiceInfo) TableName

func (ServiceInfo) TableName() string

type ServicePhase

type ServicePhase string

type ServiceReader

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

func (*ServiceReader) ByApplicationID

func (r *ServiceReader) ByApplicationID(id string) *ServiceReader

func (*ServiceReader) ByApplicationName

func (r *ServiceReader) ByApplicationName(name string) *ServiceReader

func (*ServiceReader) ByName

func (r *ServiceReader) ByName(name string) *ServiceReader

func (*ServiceReader) ByNamespace

func (r *ServiceReader) ByNamespace(ns string) *ServiceReader

func (*ServiceReader) ByOrgID

func (r *ServiceReader) ByOrgID(id string) *ServiceReader

func (*ServiceReader) ByOrgName

func (r *ServiceReader) ByOrgName(name string) *ServiceReader

func (*ServiceReader) ByProjectID

func (r *ServiceReader) ByProjectID(id string) *ServiceReader

func (*ServiceReader) ByProjectName

func (r *ServiceReader) ByProjectName(name string) *ServiceReader

func (*ServiceReader) ByRuntimeID

func (r *ServiceReader) ByRuntimeID(id string) *ServiceReader

func (*ServiceReader) ByRuntimeName

func (r *ServiceReader) ByRuntimeName(name string) *ServiceReader

func (*ServiceReader) ByService

func (r *ServiceReader) ByService(name string) *ServiceReader

func (*ServiceReader) ByServiceType

func (r *ServiceReader) ByServiceType(tp string) *ServiceReader

func (*ServiceReader) ByWorkspace

func (r *ServiceReader) ByWorkspace(ws string) *ServiceReader

func (*ServiceReader) Do

func (r *ServiceReader) Do() ([]ServiceInfo, error)

Jump to

Keyboard shortcuts

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