Documentation ¶
Index ¶
- Constants
- Variables
- func GetProjectIDWithScene(projectID, scene string) string
- type APIResponse
- type BcsAgentAttribute
- type BcsClusterAgentInfo
- type BcsClusterResource
- type BcsContainerStatus
- type BcsPodIndex
- type BcsPodStatus
- type BcsReplicaControllerStatus
- type CMakeArgs
- type Ccache
- type ClientStatusType
- type CommandType
- type ContainerPort
- type ContainerStatus
- type DistccClientInfo
- type DistccServerInfo
- type DistccServerSets
- type ExtraVars
- type FBAgentAttribute
- type FBClusterAgentInfo
- type FBClusterResource
- type FbSummaryInfo
- type HeartBeat
- type HeartBeatType
- type MesosValueRanges
- type MesosValueScalar
- type MesosValueSet
- type MesosValueText
- type MesosValueType
- type ObjectMeta
- type PodStatus
- type ReplicaControllerStatus
- type ResourceItem
- type ResourceRequirements
- type ServerErrCode
- type ServerInfo
- type ServerStatusType
Constants ¶
const ( ClientExtraKeyCompileResult string = "compileresult" ClientExtraKeyCmd string = "cmd" ClientExtraKeyRunDir string = "run_dir" ClientExtraKeyStartTime string = "start_time" ClientExtraKeyEndTime string = "end_time" )
const (
ClientHeartBeatTickTime = 5 * time.Second
)
const (
ProjectIDBlockSep = "_"
)
Variables ¶
var AllServerStatusList = []ServerStatusType{ ServerStatusStaging, ServerStatusStarting, ServerStatusRunning, ServerStatusFailed, ServerStatusFinish, }
Functions ¶
func GetProjectIDWithScene ¶
GetProjectIDWithScene return the real projectID If scene is empty, just return projectID which is given else, return the string made up with both projectID and scene
Types ¶
type APIResponse ¶
type APIResponse struct { Code int `json:"code"` Message string `json:"message"` Data interface{} `json:"data"` }
APIResponse define the api response body data.
type BcsAgentAttribute ¶
type BcsAgentAttribute struct { Name string `json:"name,omitempty"` Type MesosValueType `json:"type,omitempty"` Scalar *MesosValueScalar `json:"scalar,omitempty"` Ranges []*MesosValueRanges `json:"ranges,omitempty"` Set *MesosValueSet `json:"set,omitempty"` Text *MesosValueText `json:"text,omitempty"` }
BcsAgentAttribute define the bcs single agent's attributes.
type BcsClusterAgentInfo ¶
type BcsClusterAgentInfo struct { HostName string `json:"hostname"` IP string `json:"ip"` DiskTotal float64 `json:"disktotal"` MemTotal float64 `json:"memtotal"` CPUTotal float64 `json:"cputotal"` DiskUsed float64 `json:"diskused"` MemUsed float64 `json:"memused"` CPUUsed float64 `json:"cpuused"` Disabled bool `json:"disabled"` HostAttributes []*BcsAgentAttribute `json:"host_attributes"` Attributes []*BcsAgentAttribute `json:"attributes"` RegisteredTime int64 `json:"registered_time"` ReRegisteredTime int64 `json:"reregistered_time"` }
BcsClusterAgentInfo describe the bcs single agent resource report status.
type BcsClusterResource ¶
type BcsClusterResource struct { DiskTotal float64 `json:"disktotal"` MemTotal float64 `json:"memtotal"` CPUTotal float64 `json:"cputotal"` DiskUsed float64 `json:"diskused"` MemUsed float64 `json:"memused"` CPUUsed float64 `json:"cpuused"` Agents []BcsClusterAgentInfo `json:"agents"` }
BcsClusterResource describe the bcs cluster resource report status.
type BcsContainerStatus ¶
type BcsContainerStatus struct { Name string `json:"name"` ContainerID string `json:"containerID"` RestartCount int32 `json:"restartCount, omitempty"` Status ContainerStatus `json:"status, omitempty"` LastStatus ContainerStatus `json:"lastStatus, omitempty"` TerminateExitCode int `json:"exitcode, omitempty"` Image string `json:"image"` Message string `json:"message, omitempty"` StartTime time.Time `json:"startTime,omitempty"` LastUpdateTime time.Time `json:"lastUpdateTime,omitempty"` FinishTime time.Time `json:"finishTime,omitempty"` Ports []ContainerPort `json:"containerPort,omitempty"` Command string `json:"command,omitempty"` Args []string `json:"args,omitempty"` Network string `json:"networkMode,omitempty"` Labels map[string]string `json:"labels,omitempty"` Resources ResourceRequirements `json:"resources,omitempty"` Env map[string]string `json:"env,omitempty"` }
BcsContainerStatus define container status
type BcsPodIndex ¶
type BcsPodIndex struct {
Name string `json:"name"`
}
BcsPodIndex describe the pod name data in application status.
type BcsPodStatus ¶
type BcsPodStatus struct { ObjectMeta `json:"metadata"` RcName string `json:"rcname, omitempty"` Status PodStatus `json:"status, omitempty"` LastStatus PodStatus `json:"lastStatus, omitempty"` HostIP string `json:"hostIP, omitempty"` HostName string `json:"hostName"` PodIP string `json:"podIP, omitempty"` Message string `json:"message, omitempty"` StartTime time.Time `json:"startTime, omitempty"` LastUpdateTime time.Time `json:"lastUpdateTime, omitempty"` ReportTime time.Time `json:"reportTime, omitempty"` ContainerStatuses []*BcsContainerStatus `json:"containerStatuses, omitempty"` BcsMessage string `json:"bcsMessage, omitempty"` }
BcsPodStatus define pod status
type BcsReplicaControllerStatus ¶
type BcsReplicaControllerStatus struct { ObjectMeta `json:"metadata"` CreateTime time.Time `json:"createTime"` LastUpdateTime time.Time `json:"lastUpdateTime,omitempty"` ReportTime time.Time `json:"reportTime,omitempty"` Status ReplicaControllerStatus `json:"status"` LastStatus ReplicaControllerStatus `json:"lastStatus,omitempty"` Message string `json:"message, omitempty"` Pods []*BcsPodIndex `json:"pods"` // Instance is the number of requested instance Instance int `json:"instance"` // BuildedInstance is the number of actual instance BuildedInstance int `json:"buildedInstance"` // RunningInstance is the number of running status instance RunningInstance int `json:"runningInstance"` }
BcsReplicaControllerStatus define ReplicaController status
type Ccache ¶
type Ccache struct { CacheDir string `json:"cache_dir"` PrimaryConfig string `json:"primary_config"` SecondaryConfig string `json:"secondary_config"` DirectHit int `json:"cache_direct_hit"` PreprocessedHit int `json:"cache_preprocessed_hit"` CacheMiss int `json:"cache_miss"` CalledForLink int `json:"called_for_link"` CalledForPreProcessing int `json:"called_for_processing"` UnsupportedSourceLanguage int `json:"unsupported_source_language"` NoInputFile int `json:"no_input_file"` FilesInCache int `json:"files_in_cache"` CacheSize string `json:"cache_size"` MaxCacheSize string `json:"max_cache_size"` }
type ClientStatusType ¶
type ClientStatusType string
const ( ClientStatusSuccess ClientStatusType = "success" ClientStatusFailed ClientStatusType = "failed" )
type CommandType ¶
type CommandType string
const ( CommandMake CommandType = "make" CommandCmake CommandType = "cmake" CommandBazel CommandType = "bazel" CommandBlade CommandType = "blade" CommandNinja CommandType = "ninja" CommandFBuild CommandType = "FBuild.exe" )
type ContainerPort ¶
type ContainerPort struct { //each named port in a pod must have a unique name. Name string `json:"name"` HostPort int `json:"hostPort,omitempty"` ContainerPort int `json:"containerPort"` HostIP string `json:"hostIP,omitempty"` Protocol string `json:"protocol"` }
ContainerPort represents a network port in a single container
type ContainerStatus ¶
type ContainerStatus string
ContainerStatus define the bcs container status.
const ( ContainerStaging ContainerStatus = "Staging" ContainerStarting ContainerStatus = "Starting" ContainerRunning ContainerStatus = "Running" ContainerKilling ContainerStatus = "Killing" ContainerKilled ContainerStatus = "Killed" ContainerFinish ContainerStatus = "Finish" ContainerFailed ContainerStatus = "Failed" ContainerError ContainerStatus = "Error" )
There are the valid statuses of container
type DistccClientInfo ¶
type DistccClientInfo struct { TaskID string `json:"task_id"` Status ClientStatusType `json:"status"` //only StatusFailed & StatusFinish Ccache *Ccache `json:"ccache"` Message string `json:"message"` //if status=StatusFailed, them it is failed message Extra map[string]string `json:"envs"` // fb summary FbSummary FbSummaryInfo }
DistccClientInfo define distcc client information
type DistccServerInfo ¶
type DistccServerInfo struct { TaskID string `json:"task_id"` Hosts string `json:"hosts"` Cmds string `json:"cmds"` GccVersion string `json:"gcc_version"` Envs map[string]string `json:"envs"` UnsetEnvs []string `json:"unset_envs"` Status ServerStatusType `json:"status"` Message string `json:"message"` //if status=StatusFailed, them it is failed message QueueNumber int `json:"queue_number"` //current queue number of the task CCacheEnabled bool `json:"ccache_enabled"` //whether open ccache // compiler settings CCCompiler string `json:"cc_compiler"` CXXCompiler string `json:"cxx_compiler"` JobServer uint `json:"job_server"` DistccHosts string `json:"distcc_hosts"` }
distcc server info
type DistccServerSets ¶
type DistccServerSets struct { ProjectId string `json:"project_id"` BuildId string `json:"build_id"` ClientIp string `json:"client_ip"` User string `json:"user"` Message string `json:"message"` ClientCPU int `json:"client_cpu"` ClientVersion string `json:"client_version"` GccVersion string `json:"gcc_version"` City string `json:"city"` RunDir string `json:"run_dir"` Params string `json:"params"` //自定义参数 CCacheEnabled *bool `json:"ccache_enabled"` // command define the target to be called, such as make, bazel, /data/custom/make etc. Command string `json:"command,omitempty"` CommandType CommandType `json:"command_type,omitempty"` // extra_vars includes the extra params need by client ExtraVars ExtraVars `json:"extra_vars,omitempty"` }
DistccServerSets define apply for distcc server information
type FBAgentAttribute ¶
type FBClusterAgentInfo ¶
type FBClusterAgentInfo struct { HostName string `json:"hostname"` IP string `json:"ip"` DiskTotal float64 `json:"disktotal"` MemTotal float64 `json:"memtotal"` CPUTotal float64 `json:"cputotal"` DiskUsed float64 `json:"diskused"` MemUsed float64 `json:"memused"` CPUUsed float64 `json:"cpuused"` Disabled bool `json:"disabled"` Attributes []FBAgentAttribute `json:"attributes"` }
type FBClusterResource ¶
type FbSummaryInfo ¶
type FbSummaryInfo struct { LibraryBuilt int `json:"library_built"` LibraryCacheHit int `json:"library_cache_hit"` LibraryCPUTime float32 `json:"library_cpu_time"` ObjectBuilt int `json:"object_built"` ObjectCacheHit int `json:"object_cache_hit"` ObjectCPUTime float32 `json:"object_cpu_time"` ExeBuilt int `json:"exe_built"` ExeCacheHit int `json:"exe_cache_hit"` ExeCPUTime float32 `json:"exe_cpu_time"` CacheHits int `json:"cache_hits"` CacheMisses int `json:"cache_misses"` CacheStores int `json:"cache_stores"` RealCompileTime float32 `json:"real_compile_time"` LocalCompileTime float32 `json:"local_compile_time"` RemoteCompileTime float32 `json:"remote_compile_time"` }
type HeartBeat ¶
type HeartBeat struct { TaskID string `json:"task_id"` Type HeartBeatType `json:"type"` }
client & server heartbeat mechanism
type HeartBeatType ¶
type HeartBeatType string
const ( HeartBeatPing HeartBeatType = "ping" HeartBeatPong HeartBeatType = "pong" )
type MesosValueRanges ¶
MesosValueRanges range value type.
type MesosValueScalar ¶
type MesosValueScalar struct {
Value float64 `json:"value"`
}
MesosValueScalar scalar value type.
type MesosValueSet ¶
type MesosValueSet struct {
Item []string `json:"item"`
}
MesosValueSet set value type.
type MesosValueText ¶
type MesosValueText struct {
Value string `json:"value"`
}
MesosValueText text value type.
type MesosValueType ¶
type MesosValueType int32
type ObjectMeta ¶
type ObjectMeta struct { Name string `json:"name"` NameSpace string `json:"namespace"` CreationTimestamp time.Time `json:"creationTimestamp,omitempty"` Labels map[string]string `json:"labels,omitempty"` Annotations map[string]string `json:"annotations,omitempty"` ClusterName string `json:"clusterName,omitempty"` }
ObjectMeta define the bcs resource meta data.
type ReplicaControllerStatus ¶
type ReplicaControllerStatus string
ReplicaControllerStatus define the bcs application status.
const ( RCStaging ReplicaControllerStatus = "Staging" RCDeploying ReplicaControllerStatus = "Deploying" RCRunning ReplicaControllerStatus = "Running" RCOperating ReplicaControllerStatus = "Operating" RCFinish ReplicaControllerStatus = "Finish" RCError ReplicaControllerStatus = "Error" )
type ResourceItem ¶
type ResourceItem struct { CPU string `json:"cpu,omitempty"` Mem string `json:"memory,omitempty"` Storage string `json:"storage,omitempty"` }
ResourceItem define the resource.
type ResourceRequirements ¶
type ResourceRequirements struct { Limits ResourceItem `json:"limits,omitempty"` Requests ResourceItem `json:"requests,omitempty"` }
ResourceRequirements describes the compute resource requirement
type ServerErrCode ¶
type ServerErrCode int
const ( ServerErrOK ServerErrCode = iota ServerErrInvalidParam ServerErrRequestResourceFailed ServerErrRequestTaskInfoFailed ServerErrUpdateHeartbeatFailed ServerErrReleaseResourceFailed ServerErrPreProcessFailed ServerErrRedirectFailed ServerErrEncodeJSONFailed ServerErrListTaskFailed ServerErrListProjectFailed ServerErrListWhiteListFailed ServerErrListGccFailed ServerErrUpdateProjectFailed ServerErrUpdateWhiteListFailed ServerErrUpdateGccFailed ServerErrDeleteProjectFailed ServerErrDeleteWhiteListFailed ServerErrDeleteGccFailed ServerErrOperatorNoSpecific ServerErrGetServersFailed ServerErrGetCMakeArgsFailed ServerErrServerInternalError ServerErrReportResourceError ServerErrListWorkerFailed ServerErrUpdateWorkerFailed ServerErrDeleteWorkerFailed ServerErrListWorkStatsFailed )
func (ServerErrCode) String ¶
func (sec ServerErrCode) String() string
type ServerInfo ¶
type ServerInfo struct { IP string `json:"ip"` Port uint `json:"port"` MetricPort uint `json:"metric_port"` ResourcePort uint `json:"resource_port"` HostName string `json:"hostname"` Scheme string `json:"scheme"` //http, https Version string `json:"version"` Cluster string `json:"cluster"` Pid int `json:"pid"` }
ServerInfo base server information
type ServerStatusType ¶
type ServerStatusType string
const ( ServerStatusStaging ServerStatusType = "staging" ServerStatusStarting ServerStatusType = "starting" ServerStatusRunning ServerStatusType = "running" ServerStatusFailed ServerStatusType = "failed" ServerStatusFinish ServerStatusType = "finish" )