config

package
v0.0.0-...-6ac6f58 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: Apache-2.0, BSD-3-Clause, MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//CRMOperatorMesos define
	CRMOperatorMesos = "mesos"
	//CRMOperatorK8S define
	CRMOperatorK8S = "k8s"
	//CRMOperatorDCMac define
	CRMOperatorDCMac = "dc_mac"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CertConfig

type CertConfig struct {
	CAFile   string
	CertFile string
	KeyFile  string
	CertPwd  string
	IsSSL    bool
}

CertConfig configuration of Cert.

type ContainerResourceConfig

type ContainerResourceConfig struct {
	Enable                     bool           `json:"crm_enable"`
	Operator                   string         `json:"crm_operator"`
	KubeConfigPath             string         `json:"crm_kubeconfig_path"`
	BcsAPIToken                string         `json:"crm_bcs_api_token"`
	BcsAPIAddress              string         `json:"crm_bcs_api_address"`
	BcsNamespace               string         `json:"crm_bcs_namespace"`
	EnableBCSApiGw             bool           `json:"crm_bcs_apigw_enable" value:"false"`
	BcsCPUPerInstance          float64        `json:"crm_bcs_cpu_per_instance"`
	BcsMemPerInstance          float64        `json:"crm_bcs_mem_per_instance"`
	BcsStoragePerInstance      float64        `json:"crm_bcs_storage_per_instance,omitempty"`
	BcsCPUPerInstanceOffset    float64        `json:"crm_bcs_cpu_per_instance_offset"`
	BcsMemPerInstanceOffset    float64        `json:"crm_bcs_mem_per_instance_offset"`
	BcsCPULimitPerInstance     float64        `json:"crm_bcs_cpu_limit_per_instance,omitempty"`
	BcsMemLimitPerInstance     float64        `json:"crm_bcs_mem_limit_per_instance,omitempty"`
	BcsStorageLimitPerInstance float64        `json:"crm_bcs_storage_limit_per_instance,omitempty"`
	InstanceType               []InstanceType `json:"instance_type"`
	BcsClusterID               string         `json:"crm_bcs_cluster_id"`
	BcsClusterType             string         `json:"crm_bcs_cluster_type"`
	BcsAppTemplate             string         `json:"crm_bcs_template_file"`
	BcsGroupLabelKey           string         `json:"crm_bcs_group_label_key"`
	BcsPlatformLabelKey        string         `json:"crm_bcs_platform_label_key"`
	BcsDisableWinHostNW        bool           `json:"crm_bcs_disable_win_host_network"`

	MySQLStorage     string `json:"crm_resource_mysql"`
	MySQLDatabase    string `json:"crm_resource_mysql_db"`
	MySQLTable       string `json:"crm_resource_mysql_table"`
	MySQLUser        string `json:"crm_resource_mysql_user"`
	MySQLPwd         string `json:"crm_resource_mysql_pwd"`
	MysqlTableOption string `json:"crm_resource_mysql_table_option"`
	MysqlSkipEnsure  bool   `json:"crm_resource_mysql_skip_ensure"`

	BcsAPIPool *net.ConnectPool
}

ContainerResourceConfig defines configs for resource from bcs.

type DirectResourceConfig

type DirectResourceConfig struct {
	Enable     bool        `json:"direct_enable" value:"false" usage:"enable direct resource manager"`
	ListenPort uint        `json:"direct_resource_port" value:"" usage:"port to listen for direct resource agent report"`
	ListenIP   string      `json:"direct_resource_ip" value:"" usage:"ip to listen for direct resource agent report"`
	ServerCert *CertConfig // cert of the server

	Agent4OneTask bool `` /* 128-byte string literal not displayed */

	MySQLStorage     string `json:"direct_resource_mysql" value:"" usage:"mysql address for storage"`
	MySQLDatabase    string `json:"direct_resource_mysql_db" value:"" usage:"mysql database for connecting."`
	MySQLUser        string `json:"direct_resource_mysql_user" value:"root" usage:"mysql username"`
	MySQLPwd         string `json:"direct_resource_mysql_pwd" value:"" usage:"mysql password, encrypted"`
	MysqlTableOption string `json:"direct_resource_mysql_table_option" value:"" usage:"mysql table option"`
}

DirectResourceConfig defines configs for resource which agent connect to us directly.

type EngineApisJobConfig

type EngineApisJobConfig struct {
	Enable bool `json:"engine_apisjob_enable" value:"false" usage:"enable engine apisjob"`

	QueueResourceAllocater map[string]ResourceAllocater `json:"queue_resource_allocater"`

	MySQLStorage     string `json:"engine_apisjob_mysql" value:"" usage:"mysql address for storage"`
	MySQLDatabase    string `json:"engine_apisjob_mysql_db" value:"" usage:"mysql database for connecting."`
	MySQLUser        string `json:"engine_apisjob_mysql_user" value:"root" usage:"mysql username"`
	MySQLPwd         string `json:"engine_apisjob_mysql_pwd" value:"" usage:"mysql password, encrypted"`
	MySQLDebug       bool   `json:"engine_apisjob_mysql_debug" value:"false" usage:"if true, will output raw sql"`
	MysqlTableOption string `json:"engine_apisjob_mysql_table_option" value:"" usage:"mysql table option"`
}

EngineApisJobConfig define the apis engine config.

type EngineDistCCBrokerConfig

type EngineDistCCBrokerConfig struct {
	GccVersion     string `json:"gcc_version"`
	City           string `json:"city"`
	Instance       int    `json:"instance"`
	ConstNum       int    `json:"const_num"`
	JobPerInstance int    `json:"job_per_instance"`
	Allow          string `json:"allow"`
}

EngineDistCCBrokerConfig define the broker config used by engine distcc.

type EngineDistCCConfig

type EngineDistCCConfig struct {
	Enable bool `json:"engine_distcc_enable" value:"false" usage:"enable engine distcc"`

	MySQLStorage     string `json:"engine_distcc_mysql" value:"" usage:"mysql address for storage"`
	MySQLDatabase    string `json:"engine_distcc_mysql_db" value:"" usage:"mysql database for connecting."`
	MySQLUser        string `json:"engine_distcc_mysql_user" value:"root" usage:"mysql username"`
	MySQLPwd         string `json:"engine_distcc_mysql_pwd" value:"" usage:"mysql password, encrypted"`
	MySQLDebug       bool   `json:"engine_distcc_mysql_debug" value:"false" usage:"if true, will output raw sql"`
	MysqlTableOption string `json:"engine_distcc_mysql_table_option" value:"" usage:"mysql table option"`

	QueueResourceAllocater map[string]ResourceAllocater `json:"queue_resource_allocater"`
	LeastJobServer         int                          `json:"least_job_server" value:"144" usage:"least job server for remote compiles"`
	JobServerTimesToCPU    float64                      `json:"job_server_times_to_cpu" value:"1.5" usage:"job server times to cpu"`
	BrokerConfig           []EngineDistCCBrokerConfig   `json:"broker_config"`
}

EngineDistCCConfig define the distcc engine config.

type EngineDistCCMacConfig

type EngineDistCCMacConfig struct {
	Enable bool `json:"engine_distcc_mac_enable" value:"false" usage:"enable engine distcc_mac"`

	MySQLStorage     string `json:"engine_distcc_mac_mysql" value:"" usage:"mysql address for storage"`
	MySQLDatabase    string `json:"engine_distcc_mac_mysql_db" value:"" usage:"mysql database for connecting."`
	MySQLUser        string `json:"engine_distcc_mac_mysql_user" value:"root" usage:"mysql username"`
	MySQLPwd         string `json:"engine_distcc_mac_mysql_pwd" value:"" usage:"mysql password, encrypted"`
	MySQLDebug       bool   `json:"engine_distcc_mac_mysql_debug" value:"false" usage:"if true, will output raw sql"`
	MysqlTableOption string `json:"engine_distcc_mac_mysql_table_option" value:"" usage:"mysql table option"`

	LeastJobServer      int     `json:"engine_distcc_mac_least_job_server" value:"144" usage:"least job server for remote compiles"`
	JobServerTimesToCPU float64 `json:"engine_distcc_mac_job_server_times_to_cpu" value:"1.5" usage:"job server times to cpu"`
}

EngineDistCCMacConfig define the distcc_mac engine config.

type EngineDisttaskBrokerConfig

type EngineDisttaskBrokerConfig struct {
	WorkerVersion   string                        `json:"worker_version"`
	Scene           string                        `json:"scene"`
	City            string                        `json:"city"`
	Instance        int                           `json:"instance"`
	ConstNum        int                           `json:"const_num"`
	IdleKeepSeconds int                           `json:"idle_keep_seconds" value:"-1" usage:"seconds to keep with idle status before release"`
	ReleaseLoop     bool                          `json:"release_loop" value:"false" usage:"whether realease resource with loop until succeed"`
	JobPerInstance  int                           `json:"job_per_instance"`
	Allow           string                        `json:"allow"`
	Volumes         []EngineDisttaskBrokerVolumes `json:"volumes"`
}

EngineDisttaskBrokerConfig define the broker config used by engine disttask.

type EngineDisttaskBrokerVolumes

type EngineDisttaskBrokerVolumes struct {
	HostDir      string `json:"host_dir"`
	ContainerDir string `json:"container_dir"`
}

EngineDisttaskBrokerVolumes describe the volumes for broker

type EngineDisttaskConfig

type EngineDisttaskConfig struct {
	Enable bool `json:"engine_disttask_enable" value:"false" usage:"enable engine disttask"`

	MySQLStorage     string `json:"engine_disttask_mysql" value:"" usage:"mysql address for storage"`
	MySQLDatabase    string `json:"engine_disttask_mysql_db" value:"" usage:"mysql database for connecting."`
	MySQLUser        string `json:"engine_disttask_mysql_user" value:"root" usage:"mysql username"`
	MySQLPwd         string `json:"engine_disttask_mysql_pwd" value:"" usage:"mysql password, encrypted"`
	MySQLDebug       bool   `json:"engine_disttask_mysql_debug" value:"false" usage:"if true, will output raw sql"`
	MysqlTableOption string `json:"engine_disttask_mysql_table_option" value:"" usage:"mysql table option"`

	QueueResourceAllocater map[string]ResourceAllocater `json:"queue_resource_allocater"`
	LeastJobServer         int                          `json:"disttask_least_job_server" value:"144" usage:"least job server for remote compiles"`
	JobServerTimesToCPU    float64                      `json:"disttask_job_server_times_to_cpu" value:"1.5" usage:"job server times to cpu"`
	BrokerConfig           []EngineDisttaskBrokerConfig `json:"disttask_broker_config"`
}

EngineDisttaskConfig define the disttask engine config.

type EngineDisttaskQueueConfig

type EngineDisttaskQueueConfig struct {
	QueueName      string  `json:"queue_name"`
	CPUPerInstance float64 `json:"cpu_per_instance"`
	MemPerInstance float64 `json:"mem_per_instance"`
}

EngineDisttaskQueueConfig define the specific config for some queue.

type EngineFastBuildConfig

type EngineFastBuildConfig struct {
	Enable bool `json:"engine_fastbuild_enable" value:"false" usage:"enable engine fastbuild"`

	MySQLStorage     string `json:"engine_fastbuild_mysql" value:"" usage:"mysql address for storage"`
	MySQLDatabase    string `json:"engine_fastbuild_mysql_db" value:"" usage:"mysql database for connecting."`
	MySQLUser        string `json:"engine_fastbuild_mysql_user" value:"root" usage:"mysql username"`
	MySQLPwd         string `json:"engine_fastbuild_mysql_pwd" value:"" usage:"mysql password, encrypted"`
	MySQLDebug       bool   `json:"engine_fastbuild_mysql_debug" value:"false" usage:"if true, will output raw sql"`
	MysqlTableOption string `json:"engine_fastbuild_mysql_table_option" value:"" usage:"mysql table option"`

	TaskMaxRunningSeconds             int32  `json:"task_max_running_seconds" value:"" usage:"task max running seconds for fastbuild"`
	TaskBKMainNoSubTaskTimeoutSeconds int32  `json:"task_bkmain_nosubtask_timeout_seconds" value:"" usage:"task timeout seconds for bk-main no subtask"`
	SpecialFBCmd                      string `json:"special_fb_cmd" value:"" usage:"special fb cmd"`
}

EngineFastBuildConfig define the fastbuild engine config.

type InstanceType

type InstanceType struct {
	Platform             string  `json:"platform"`
	Group                string  `json:"group"`
	CPUPerInstance       float64 `json:"cpu_per_instance"`
	MemPerInstance       float64 `json:"mem_per_instance"`
	CPUPerInstanceOffset float64 `json:"cpu_per_instance_offset"`
	MemPerInstanceOffset float64 `json:"mem_per_instance_offset"`
	CPULimitPerInstance  float64 `json:"cpu_limit_per_instance,omitempty"`
	MemLimitPerInstance  float64 `json:"mem_limit_per_instance,omitempty"`
}

InstanceType define type of an instance

type K8sResourceConfig

type K8sResourceConfig struct {
	Enable         bool                                `json:"crm_enable"`
	Operator       string                              `json:"crm_operator"`
	K8sClusterList map[string]*ContainerResourceConfig `json:"k8s_cluster_list"`

	MySQLStorage     string `json:"crm_resource_mysql"`
	MySQLDatabase    string `json:"crm_resource_mysql_db"`
	MySQLTable       string `json:"crm_resource_mysql_table"`
	MySQLUser        string `json:"crm_resource_mysql_user"`
	MySQLPwd         string `json:"crm_resource_mysql_pwd"`
	MysqlTableOption string `json:"crm_resource_mysql_table_option"`
	MysqlSkipEnsure  bool   `json:"crm_resource_mysql_skip_ensure"`
}

K8sResourceConfig define new k8s with cluster list

type ResourceAllocater

type ResourceAllocater struct {
	AllocateByTimeMap map[string]float64 `json:"allocate_by_time_map"`
	TimeSlot          []TimeSlot         `json:"time_slot"`
}

ResourceAllocater define

type ServerConfig

type ServerConfig struct {
	conf.FileConfig
	conf.ServiceConfig
	conf.LogConfig
	conf.ProcessConfig
	conf.ServerOnlyCertConfig
	conf.LocalConfig
	conf.MetricConfig
	conf.CommonEngineConfig

	EtcdEndpoints string `json:"etcd_endpoints" value:"" usage:"etcd endpoints for register and discover"`
	EtcdRootPath  string `json:"etcd_root_path" value:"" usage:"etcd root path"`
	EtcdCaFile    string `json:"etcd_ca_file" value:"" usage:"etcd ca file"`
	EtcdCertFile  string `json:"etcd_cert_file" value:"" usage:"etcd cert file"`
	EtcdKeyFile   string `json:"etcd_key_file" value:"" usage:"etcd key file"`
	EtcdKeyPwd    string `json:"etcd_key_password" value:"" usage:"etcd key password"`

	DebugMode bool `json:"debug" value:"false" usage:"*ATTENTION* debug mode will disable some handlers such as task heartbeat checking"`

	// engine apisjobs settings
	ApisJobQueueList    []string            `json:"apisjob_queue_list" value:"[]" usage:"queue name list for engine apisjob"`
	EngineApisJobConfig EngineApisJobConfig `json:"engine_apisjob"`

	// engine distcc settings
	DistCCQueueList      []string                         `json:"distcc_queue_list" value:"[]" usage:"queue name list for engine distcc"`
	DistccQueueShareType map[string]engine.QueueShareType `json:"distcc_queue_share_type" usage:"queue name map for share type, default is all allowed"`
	EngineDistCCConfig   EngineDistCCConfig               `json:"engine_distcc"`

	DisttaskQueueList      []string                         `json:"disttask_queue_list" value:"[]" usage:"queue name list for engine disttask"`
	DisttaskQueueShareType map[string]engine.QueueShareType `json:"disttask_queue_share_type" usage:"queue name map for share type, default is all allowed"`
	EngineDisttaskConfig   EngineDisttaskConfig             `json:"engine_disttask"`

	DistccMacQueueList    []string              `json:"distcc_mac_queue_list" value:"[]" usage:"queue name list for engine distcc_mac"`
	EngineDistCCMacConfig EngineDistCCMacConfig `json:"engine_distcc_mac"`

	// engine fastbuild settings
	FastBuildQueueList    []string              `json:"fastbuild_queue_list" value:"[]" usage:"queue name list for engine fastbuild"`
	EngineFastBuildConfig EngineFastBuildConfig `json:"engine_fastbuild"`

	// resource manager
	DirectResourceConfig DirectResourceConfig `json:"direct_resource"`

	ContainerResourceConfig ContainerResourceConfig `json:"container_resource"`

	K8sContainerResourceConfig ContainerResourceConfig `json:"k8s_container_resource"`

	K8sResourceConfigList K8sResourceConfig `json:"k8s_resource_list"`

	DCMacContainerResourceConfig ContainerResourceConfig `json:"dc_mac_container_resource"`

	// cert of the server
	ServerCert *CertConfig
}

ServerConfig define

func NewConfig

func NewConfig() *ServerConfig

NewConfig get a default server configuration.

func (*ServerConfig) Parse

func (dsc *ServerConfig) Parse()

Parse parse flags from commands and the config file and make some initialization.

type TimeSlot

type TimeSlot struct {
	StartTime string
	EndTime   string
	Value     float64
}

TimeSlot define resource ratio Value from StartTime to EndTime

Jump to

Keyboard shortcuts

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