options

package
v0.3.10-0-alpha2 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2022 License: Apache-2.0 Imports: 38 Imported by: 5

Documentation

Index

Constants

View Source
const (
	DefaultQuotaUnlimit = "unlimit"
	DefaultQuotaZero    = "zero"
	DefaultQuotaDefault = "default"
)
View Source
const (
	LockMethodInMemory = "inmemory"
	LockMethodEtcd     = "etcd"
)
View Source
const (
	MIN_REFRESH_INTERVAL_SECONDS = 30
)

Variables

This section is empty.

Functions

func OnBaseOptionsChange

func OnBaseOptionsChange(oOpts, nOpts interface{}) bool

func OnCommonOptionsChange

func OnCommonOptionsChange(oOpts, nOpts interface{}) bool

func OnDBOptionsChange

func OnDBOptionsChange(oOpts, nOpts interface{}) bool

func ParseOptions

func ParseOptions(optStruct interface{}, args []string, configFileName string, serviceType string)

func StartOptionManager

func StartOptionManager(option interface{}, refreshSeconds int, serviceType, serviceVersion string, onChange TOptionsChangeFunc)

func StartOptionManagerWithSessionDriver

func StartOptionManagerWithSessionDriver(options interface{}, refreshSeconds int, serviceType, serviceVersion string, onChange TOptionsChangeFunc, session IServiceConfigSession)

Types

type BaseOptions

type BaseOptions struct {
	Region string `help:"Region name or ID" alias:"auth-region"`

	Port    int    `help:"The port that the service runs on" alias:"bind-port"`
	Address string `help:"The IP address to serve on (set to 0.0.0.0 for all interfaces)" default:"0.0.0.0" alias:"bind-host"`

	DebugClient bool `help:"Switch on/off mcclient debugs" default:"false"`

	LogLevel        string `help:"log level" default:"info" choices:"debug|info|warn|error"`
	LogVerboseLevel int    `help:"log verbosity level" default:"0"`
	LogFilePrefix   string `help:"prefix of log files"`

	CorsHosts []string `help:"List of hostname that allow CORS"`
	TempPath  string   `help:"Path for store temp file, at least 40G space" default:"/opt/yunion/tmp"`

	ApplicationID      string `help:"Application ID"`
	RequestWorkerCount int    `default:"8" help:"Request worker thread count, default is 8"`

	EnableSsl   bool   `help:"Enable https"`
	SslCaCerts  string `help:"ssl certificate ca root file, separating ca and cert file is not encouraged" alias:"ca-file"`
	SslCertfile string `help:"ssl certification file, normally combines all the certificates in the chain" alias:"cert-file"`
	SslKeyfile  string `help:"ssl certification private key file" alias:"key-file"`

	NotifyAdminUsers  []string `` /* 188-byte string literal not displayed */
	NotifyAdminGroups []string `` /* 171-byte string literal not displayed */

	// EnableRbac                       bool `help:"Switch on Role-based Access Control" default:"true"`
	RbacDebug                        bool `help:"turn on rbac debug log" default:"false"`
	RbacPolicyRefreshIntervalSeconds int  `help:"policy refresh interval in seconds, default half a minute" default:"30"`

	ConfigSyncPeriodSeconds int `help:"service config sync interval in seconds, default 30 minutes" default:"1800"`

	IsSlaveNode        bool `help:"Slave mode"`
	CronJobWorkerCount int  `help:"Cron job worker count" default:"4"`

	EnableQuotaCheck  bool   `help:"enable quota check" default:"false"`
	DefaultQuotaValue string `help:"default quota value" choices:"unlimit|zero|default" default:"default"`

	CalculateQuotaUsageIntervalSeconds int `help:"interval to calculate quota usages, default 30 minutes" default:"900"`

	NonDefaultDomainProjects bool `help:"allow projects in non-default domains" default:"false" json:",allowfalse"`

	TimeZone string `help:"time zone" default:"Asia/Shanghai"`

	DomainizedNamespace bool `help:"turn on global name space, default is on" default:"false" json:"domainized_namespace,allowfalse"`

	ApiServer string `help:"URL to access frontend webconsole"`

	CustomizedPrivatePrefixes []string `help:"customized private prefixes"`

	structarg.BaseOptions

	GlobalHTTPProxy  string `help:"Global http proxy"`
	GlobalHTTPSProxy string `help:"Global https proxy"`

	IgnoreNonrunningGuests bool `` /* 126-byte string literal not displayed */

	PlatformName  string            `help:"identity name of this platform" default:"Cloudpods"`
	PlatformNames map[string]string `help:"identity name of this platform by language"`
}

func (*BaseOptions) GetPlatformName

func (opt *BaseOptions) GetPlatformName(lang language.Tag) string

func (*BaseOptions) HttpTransportProxyFunc

func (self *BaseOptions) HttpTransportProxyFunc() httputils.TransportProxyFunc

type CommonOptions

type CommonOptions struct {
	AuthURL            string `help:"Keystone auth URL" alias:"auth-uri"`
	AdminUser          string `help:"Admin username"`
	AdminDomain        string `help:"Admin user domain" default:"Default"`
	AdminPassword      string `help:"Admin password" alias:"admin-passwd"`
	AdminProject       string `help:"Admin project" default:"system" alias:"admin-tenant-name"`
	AdminProjectDomain string `help:"Domain of Admin project" default:"Default"`
	AuthTokenCacheSize uint32 `help:"Auth token Cache Size" default:"2048"`

	TenantCacheExpireSeconds int `help:"expire seconds of cached tenant/domain info. defailt 15 minutes" default:"900"`

	SessionEndpointType string `help:"Client session end point type"`

	BaseOptions
}

type DBOptions

type DBOptions struct {
	SqlConnection string `help:"SQL connection string" alias:"connection"`

	Clickhouse string `help:"Connection string for click house"`

	OpsLogWithClickhouse   bool `help:"store operation logs with clickhouse" default:"false"`
	EnableDBChecksumTables bool `help:"Enable DB tables with record checksum for consistency"`
	DBChecksumSkipInit     bool `help:"Skip DB tables with record checksum calculation when init" default:"false"`

	AutoSyncTable   bool `help:"Automatically synchronize table changes if differences are detected"`
	ExitAfterDBInit bool `help:"Exit program after db initialization" default:"false"`

	GlobalVirtualResourceNamespace bool `help:"Per project namespace or global namespace for virtual resources" default:"false"`
	DebugSqlchemy                  bool `default:"false" help:"Print SQL executed by sqlchemy"`

	QueryOffsetOptimization bool `help:"apply query offset optimization"`

	HistoricalUniqueName bool `help:"use historically unique name" default:"false"`

	LockmanMethod string `help:"method for lock synchronization" choices:"inmemory|etcd" default:"inmemory"`

	OpsLogMaxKeepMonths int `help:"maximal months of logs to keep, default 6 months" default:"6"`

	SplitableMaxDurationHours int `help:"maximal number of hours that a splitable segement lasts, default 30 days" default:"720"`

	EtcdOptions

	EtcdLockPrefix string `help:"prefix of etcd lock records" default:"/onecloud/lockman"`
	EtcdLockTTL    int    `help:"ttl of etcd lock records" default:"5"`
}

func (*DBOptions) GetClickhouseConnStr

func (opt *DBOptions) GetClickhouseConnStr() (string, string, error)

func (*DBOptions) GetDBConnection

func (opt *DBOptions) GetDBConnection() (string, string, error)

type EtcdOptions

type EtcdOptions struct {
	EtcdEndpoints     []string `help:"endpoints of etcd cluster"`
	EtcdUsername      string   `help:"username of etcd cluster"`
	EtcdPassword      string   `help:"password of etcd cluster"`
	EtcdUseTLS        bool     `help:"use tls transport to connect etcd cluster" default:"false"`
	EtcdSkipTLSVerify bool     `help:"skip tls verification" default:"false"`
	EtcdCacert        string   `help:"path to cacert for connecting to etcd cluster"`
	EtcdCert          string   `help:"path to cert file for connecting to etcd cluster"`
	EtcdKey           string   `help:"path to key file for connecting to etcd cluster"`
}

func (*EtcdOptions) GetEtcdTLSConfig

func (opt *EtcdOptions) GetEtcdTLSConfig() (*tls.Config, error)

type HostCommonOptions

type HostCommonOptions struct {
	CommonOptions

	ExecutorSocketPath     string `help:"Executor socket path" default:"/var/run/onecloud/exec.sock"`
	DeployServerSocketPath string `help:"Deploy server listen socket path" default:"/var/run/onecloud/deploy.sock"`

	EnableRemoteExecutor bool `help:"Enable remote executor" default:"false"`
}

type IServiceConfigSession

type IServiceConfigSession interface {
	Merge(opts interface{}, serviceType string, serviceVersion string) bool
	Upload()
	IsRemote() bool
}

type SOptionManager

type SOptionManager struct {
	watcher.SInformerSyncManager
	// contains filtered or unexported fields
}
var (
	OptionManager *SOptionManager
)

func (*SOptionManager) DoSync

func (manager *SOptionManager) DoSync(first bool) (time.Duration, error)

func (*SOptionManager) Name

func (manager *SOptionManager) Name() string

func (*SOptionManager) NeedSync

func (manager *SOptionManager) NeedSync(dat *jsonutils.JSONDict) bool

type TOptionsChangeFunc

type TOptionsChangeFunc func(oldOpts, newOpts interface{}) bool

Jump to

Keyboard shortcuts

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