constants

package
v0.0.0-...-99a0925 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2026 License: Apache-2.0, BSD-2-Clause Imports: 2 Imported by: 0

Documentation

Overview

Package constants contains all of the application wide constant values used throughout Cube Master.

Index

Constants

View Source
const (
	SelectorPreFilterID     = "PreFilter"
	SelectorBackoffFilterID = "Backoff"
	SelectorFilterID        = "Filter"
	SelectorScoreID         = "Score"
	SelectorPostScoreID     = "PostScore"
)
View Source
const (
	SelectCtxReqKey    = "create_req"
	SelectCtxConfKey   = "select_conf"
	SelectCtxResCpuKey = "create_res_cpu"
	SelectCtxResMemKey = "create_res_mem"
)
View Source
const (
	AnnotationsNetID            = "com.netid"
	AnnotationsInvokePort       = "com.invoke_port"
	AnnotationsExposedPort      = "com.exposed_ports"
	AnnotationsVIPs             = "com.vips"
	AnnotationsDebug            = "com.cube.debug"
	AnnotationsCollectMemOnExit = "com.cube.collect_memory"

	AnnotationsNodeAffinityClusterLabel = "com.nodeaffinity.cluster.label"

	AnnotationsNodeAffinityInstanceType = "com.nodeaffinity.instancetype"

	AnnotationsNodeAffinitySelector = "com.nodeaffinity.selector"
)
View Source
const (
	CubeAnnotationsPrefix                   = "cube.master"
	CubeAnnotationsVIPs                     = "cube.master.vips"
	CubeAnnotationsBlkQos                   = "cube.master.blk.qos"
	CubeAnnotationsFSQos                    = "cube.master.fs.qos"
	CubeAnnotationsNetWork                  = "cube.master.net"
	CubeAnnotationsImageName                = "cube.master.image.username"
	CubeAnnotationsImageToken               = "cube.master.image.token"
	CubeAnnotationsInsVirtualPrivateCloud   = "cube.master.instance.virtual_private_cloud"
	CubeAnnotationsInsDataDisk              = "cube.master.instance.data_disk"
	CubeAnnotationsInsUserData              = "cube.master.instance.user_data"
	CubeAnnotationsInsType                  = "cube.master.instance.type"
	CubeAnnotationsKillReason               = "cube.master.instance.kill_reason"
	CubeAnnotationsInsSecurityGroupIDS      = "cube.master.instance.sg_ids"
	CubeAnnotationsInsRetainIP              = "cube.master.instance.retain_ip"
	CubeAnnotationsInsRegion                = "cube.master.instance.region"
	CubeAnnotationsInsHostIP                = "cube.master.instance.host_ip"
	CubeAnnotationsInsHostUUID              = "cube.master.instance.host_uuid"
	CubeAnnotationsInsHostCpuTotal          = "cube.master.instance.host_cpu_total"
	CubeAnnotationsInsHostVirtualQuotaArray = "cube.master.instance.host_virtual_quota_array"
	CubeAnnotationsPICMode                  = "cube.master.instance.pic_mode"
	CubeAnnotationsDisableVmCgroup          = "cube.master.disable_vm_cgroup"
	CubeAnnotationsDisableHostCgroup        = "cube.master.disable_host_cgroup"
	CubeAnnotationsUpdateAction             = "cube.master.update_action"
	CubeAnnotationsTerminateFatalEvent      = "cube.master.terminate_fatal_event"
	CubeAnnotationsCloadPrefix              = "cloud.tencent.com"
	CubeAnnotationsNumaNode                 = "cube.master.instance.numa_node"
	CubeAnnotationsFallbackToSlowPath       = "cube.master.fallback_to_slow_path"
	CubeAnnotationsSystemDiskSize           = "cube.master.system_disk_size"

	CubeAnnotationsAppSnapshotCreate         = "cube.master.appsnapshot.create"
	CubeAnnotationAppSnapshotTemplateID      = "cube.master.appsnapshot.template.id"
	CubeAnnotationAppSnapshotVersion         = "cube.master.appsnapshot.version"
	CubeAnnotationAppSnapshotTemplateVersion = "cube.master.appsnapshot.template.version"
	CubeAnnotationRuntimeSnapshotID          = "cube.master.runtime.snapshot.id"
	// CubeAnnotationDesiredSandboxID asks Cubelet createid to reuse this
	// sandbox ID (Resume-from-pause same-ID recreate).
	CubeAnnotationDesiredSandboxID = "cube.master.desired.sandbox.id"
	// CubeAnnotationPauseSnapshotID is the pause snapshot id allocated by
	// Master (same snap-* format as normal snapshots). DB Kind=pause_snapshot;
	// Cubelet only keeps the local catalog under that id.
	CubeAnnotationPauseSnapshotID = "cube.master.pause.snapshot.id"
	// CubeAnnotationPauseKeepTombstone is used by Cubelet's in-process Destroy
	// after PauseToSnapshot (Master no longer issues a separate Destroy RPC).
	CubeAnnotationPauseKeepTombstone = "cube.pause.keep_tombstone"
	// CubeAnnotationPauseDeleteTombstone removes the PAUSED CubeBox store row
	// when the user deletes a paused sandbox.
	CubeAnnotationPauseDeleteTombstone = "cube.pause.delete_tombstone"
	// CubeAnnotationPauseError surfaces a terminal Pause failure on Info/List
	// (sandbox record kept; Resume rejected). Pause snaps stay internal.
	CubeAnnotationPauseError                = "cube.pause.error"
	CubeAnnotationRuntimeSnapshotAttachedAt = "cube.master.runtime.snapshot.attached_at"
	CubeAnnotationRootfsArtifactID          = "cube.master.rootfs.artifact.id"
	CubeAnnotationRootfsArtifactJobID       = "cube.master.rootfs.artifact.job_id"
	CubeAnnotationRootfsArtifactURL         = "cube.master.rootfs.artifact.url"
	CubeAnnotationRootfsArtifactToken       = "cube.master.rootfs.artifact.token"
	CubeAnnotationRootfsArtifactSHA256      = "cube.master.rootfs.artifact.sha256"
	CubeAnnotationRootfsArtifactSizeBytes   = "cube.master.rootfs.artifact.size_bytes"
	CubeAnnotationWritableLayerSize         = "cube.master.rootfs.writable_layer_size"
	CubeAnnotationTemplateSpecFingerprint   = "cube.master.template.spec_fingerprint"
	// CubeAnnotationCreateTimeEnvVars stores the serialized create-time env map
	// that CubeMaster passes to cubelet for envd initialization.
	CubeAnnotationCreateTimeEnvVars = "cube.master.internal.create_time_env_vars"
	CubeAnnotationEnableIvshmem     = "cube.master.enable_ivshmem"

	CubeAnnotationsVirtiofsCache = "cube.master.virtiofs.cache"

	CubeAnnotationsInjectEnvd      = "cube.master.inject_envd"
	CubeAnnotationsInjectEnvdOptIn = "true"
	CubeEnvdInImagePath            = "/usr/local/bin/envd"
	MaxEnvdPayloadBytes            = 16 * 1024 * 1024

	// CubeAnnotationComponentsPrefix is the namespace for pre-installed
	// runtime-component metadata carried on templates/sandboxes.
	CubeAnnotationComponentsPrefix = "cube.master.components."
	// CubeAnnotationComponentEnvdVersion carries the real envd semantic version
	// collected at template-creation time and propagated to sandbox instances.
	CubeAnnotationComponentEnvdVersion = "cube.master.components.envd.version"
	// Component version annotations (dir name → version string).
	CubeAnnotationComponentCubeShimVersion   = "cube.master.components.cube-shim.version"
	CubeAnnotationComponentCubeKernelVersion = "cube.master.components.cube-kernel-scf.version"
	CubeAnnotationComponentCubeImageVersion  = "cube.master.components.cube-image.version"
	CubeAnnotationComponentCubeAgentVersion  = "cube.master.components.cube-agent.version"
)
View Source
const (
	CubeAnnotationsUseNetFileCache = "cube.instance.use_netfile_cache"
	CubeAnnotationCollectMemOnExit = "cube.instance.collect_memory"

	UpdateActionAddDevice    = "addDevice"
	UpdateActionRemoveDevice = "removeDevice"
)
View Source
const (
	CubeExtNumaKey = "cube-ext-numa"

	CubeExtQueueKey = "cube-ext-queue"
)
View Source
const (
	CubeMasterServiceID     string = "cubemaster-service"
	CubeMasterTemplateID    string = "cubemaster-template"
	CubeMasterInnerId       string = "cubemaster-inner"
	CubeMasterNetworkGet    string = "cubemaster-network-get"
	CubeMasterScheduleId    string = "cubemaster-schedule"
	CubeboxServiceID        string = "cubebox-service"
	ExtInfoCubeE2E          string = "cube-e2e"
	CubeMasterInnerRetryID  string = "cubemaster-inner-retry"
	CubeMasterInnerHandleID string = "cubemaster-inner-handle"
	// CubeMasterPostRedisID / CubeMasterPostSpecID split the
	// post-create write phase that runs after cubelet returns into
	// the bypass-proxy Redis HSET and the sandbox_spec MySQL upsert,
	// so observers can tell which leg of the post-create work is
	// expensive on a per-request basis.
	CubeMasterPostRedisID string = "cubemaster-post-redis"
	CubeMasterPostSpecID  string = "cubemaster-post-spec"
)
View Source
const (
	CubeMasterServiceIDLocalCache = "cubemaster-nodeinfo"
	Caller                        = "X-Caller"
	CallerHostIP                  = "X-Cube-Caller-Host-IP"
	RequestID                     = "X-RequestID"
	RetCode                       = "X-RetCode"
	MySQL                         = "MySQL"
	Redis                         = "Redis"
	CubeLet                       = "CubeLet"
	ActionLoadDBAll               = "loadall"
	ActionLoadDBByIDs             = "loadbyids"
	ActionLoadDBByIndex           = "loadbyindex"
	ActionBufferHandle            = "bufferhandle"
	ActionDBCreate                = "dbcreate"
	ActionDBUpdate                = "dbupdate"
	ActionDBGetById               = "dbgetbyid"
	ActionDBDelete                = "dbdelete"
	ActionDBGetByIndex            = "dbgetbyindex"
	ActionTemplateResolve         = "templateresolve"
	ActionTemplateGetDefinition   = "templategetdefinition"
	ActionTemplateLocality        = "templatelocality"
	ActionTemplateCacheHit        = "templatecachehit"
	ActionTemplateCacheMiss       = "templatecachemiss"
	ActionTemplateLocalityHit     = "templatelocalityhit"
	ActionTemplateLocalityMiss    = "templatelocalitymiss"
	ActionTemplateReplicaFallback = "templatereplicadbfallback"
	// ActionTemplateResolve* split the integral templateresolve trace
	// (already emitted as a single ActionTemplateResolve span) into the
	// four sub-stages of dealCubeboxCreateReqWithTemplateCenter so that
	// hot-path latency can be attributed precisely:
	//   - tpl-resolve-request  : GetTemplateRequest (cache hit ≈ 0ms)
	//   - tpl-resolve-locality : EnsureTemplateLocalityReady
	//   - tpl-resolve-kind     : GetTemplateKind (now cached)
	//   - tpl-resolve-bind     : bind*Replica + snapshot view lookups
	ActionTemplateResolveRequest  = "tpl-resolve-request"
	ActionTemplateResolveLocality = "tpl-resolve-locality"
	ActionTemplateResolveKind     = "tpl-resolve-kind"
	ActionTemplateResolveBind     = "tpl-resolve-bind"
)
View Source
const (
	HeartbeatHealth                = "LIVE"
	HostStatusRunning              = "RUNNING"
	MetadataTableName              = "t_cube_host_info"
	HostTypeTableName              = "t_cube_host_type"
	HostSubInfoTableName           = "t_cube_sub_host_info"
	InstanceInfoTableName          = "t_cube_instance_info"
	InstanceUserDataTableName      = "t_cube_instance_userdata"
	NodeMetaRegistrationTable      = "t_cube_node_registration"
	NodeMetaStatusTable            = "t_cube_node_status"
	NodeComponentVersionTable      = "t_cube_node_component_version"
	TemplateDefinitionTableName    = "t_cube_template_definition"
	TemplateReplicaTableName       = "t_cube_template_replica"
	RootfsArtifactTableName        = "t_cube_rootfs_artifact"
	TemplateImageJobTableName      = "t_cube_template_image_job"
	SnapshotRuntimeRefTableName    = "t_cube_snapshot_runtime_ref"
	SnapshotRuntimeActiveTableName = "t_cube_snapshot_runtime_active"
	SandboxSpecTableName           = "t_cube_sandbox_spec"
	// ArtifactNodePlacementTableName records on which nodes an ext4 rootfs
	// artifact is physically present, independent of replica lifecycle, so the
	// last-owner-cleanup / GC paths can enumerate every node that ever held an
	// artifact even after the referencing replica rows are gone.
	ArtifactNodePlacementTableName = "t_cube_artifact_node_placement"
)
View Source
const (
	WeightFactorReqCpu                = "req_cpu"
	WeightFactorReqMem                = "req_mem"
	WeightFactorMvmNum                = "mvm_num"
	WeightFactorQuotaCpu              = "quota_cpu_usage"
	WeightFactorQuotaMem              = "quota_mem_usage"
	WeightFactorCpuUtil               = "cpu_util"
	WeightFactorMemUsage              = "mem_usage"
	WeightFactorCpuLoadUsage          = "cpu_load"
	WeightFactorMetricUpdate          = "metric_update"
	WeightFactorLocalMetricUpdate     = "metric_local_update_at"
	WeightFactorCreateConcurrentLimit = "create_concurrent_limit"
	WeightFactorRealTimeCreateNum     = "realtime_create_num"
	WeightFactorLocalCreateNum        = "local_create_num"
	WeightFactorActiveWhiteList       = "active_whitelist"
	WeightFactorNegativeWhiteList     = "negative_whitelist"
	WeightFactorDataDiskUsage         = "data_disk_usage"
	WeightFactorStorageDiskUsage      = "storage_disk_usage"
	WeightFactorSysDiskUsage          = "sys_disk_usage"
	WeightFactorImageID               = "image_id"
	WeightFactorTemplateID            = "template_id"
)
View Source
const (
	AuthCubeVersion     = "cube_version"
	AuthUserID          = "cube_user_id"
	AuthTimestamp       = "cube_timestamp"
	AuthNonce           = "cube_nonce"
	AuthSignatureMethod = "cube_sgn_method"
	AuthSignature       = "cube_signature"
)
View Source
const (
	InstanceStatePending     = "PENDING"
	InstanceStateRunning     = "RUNNING"
	InstanceStateFailed      = "LAUNCH_FAILED"
	InstanceStateStopped     = "STOPPED"
	InstanceStateShutdown    = "SHUTDOWN"
	InstanceStateTerminating = "TERMINATING"
	InstanceStateTerminated  = "TERMINATED"
)
View Source
const (
	TaskStatusRunning = "RUNNING"
	TaskStatusSuccess = "SUCCESS"
	TaskStatusFailed  = "FAILED"
)
View Source
const (
	AffinityKeyCPUType             = "kubernetes.io/cpu-type"
	AffinityKeyZone                = "topology.kubernetes.io/zone"
	AffinityKeyClusterID           = "topology.kubernetes.io/cluster-id"
	AffinityKeyDisaterRecoverGroup = "topology.kubernetes.io/disaster-recover-group-id"
	AffinityKeyMemorySize          = "kubernetes.io/memory-size"
	AffinityKeyCPUCores            = "kubernetes.io/cpu-cores"
	AffinityKeyInstanceType        = "kubernetes.io/instance-type"

	// LabelSchedulingDisabled is the control-plane reserved label that marks a
	// node as cordoned: new sandboxes must not be scheduled onto it. The only
	// legal persisted representations are key-absent (enabled) or value "true"
	// (disabled). Owned exclusively by the isolation API; Cubelet register and
	// the generic label API must never create, overwrite, or delete it.
	LabelSchedulingDisabled = "cube.cloud.tencentcloud.com/scheduling-disabled"
	// LabelSchedulingDisabledValue is the only legal value for LabelSchedulingDisabled.
	LabelSchedulingDisabledValue = "true"
)
View Source
const (
	FilterVpcID = "vpc-id"

	FilterInstanceID = "instance-id"

	FilterPrivateIPAddress = "private-ip-address"

	FilterInstanceState = "instance-state"

	FilterZone = "zone"

	FilterCPUType = "cpu-type"
)
View Source
const (
	RuntimeHandlerCube = "cube"
	RuntimeHandlerRunc = "runc"
)
View Source
const (
	DefaultInstanceTypeName = "default"
)

Variables

This section is empty.

Functions

func CurrentCaller

func CurrentCaller(ctx context.Context) string

func GetAppSnapshotVersion

func GetAppSnapshotVersion(annotations map[string]string) string

func GetBackoffNodeSelector

func GetBackoffNodeSelector(ctx context.Context) interface{}

func GetHostIP

func GetHostIP(ctx context.Context) string

func GetNodeSelector

func GetNodeSelector(ctx context.Context) interface{}

func GetPodID

func GetPodID(ctx context.Context) string

func GetPodIP

func GetPodIP(ctx context.Context) string

func GetPreferredSchedulingTerms

func GetPreferredSchedulingTerms(ctx context.Context) interface{}

func GetProxySubAccountUin

func GetProxySubAccountUin(ctx context.Context) string

func GetProxyUserAppID

func GetProxyUserAppID(ctx context.Context) *int64

func GetProxyUserUin

func GetProxyUserUin(ctx context.Context) string

func GetUA

func GetUA(ctx context.Context) string

func GetUserData

func GetUserData(ctx context.Context) string

func HasAppSnapshotTemplateVersion

func HasAppSnapshotTemplateVersion(annotations map[string]string) bool

func IsWithDataDisk

func IsWithDataDisk(ctx context.Context) bool

func NormalizeAppSnapshotAnnotations

func NormalizeAppSnapshotAnnotations(annotations map[string]string)

func SetAppSnapshotVersion

func SetAppSnapshotVersion(annotations map[string]string, version string)

func WithBackoffNodeSelector

func WithBackoffNodeSelector(ctx context.Context, value interface{}) context.Context

func WithCallerContext

func WithCallerContext(ctx context.Context, caller string) context.Context

func WithDataDisks

func WithDataDisks(ctx context.Context) context.Context

func WithHostIP

func WithHostIP(ctx context.Context, value string) context.Context

func WithNodeSelector

func WithNodeSelector(ctx context.Context, value interface{}) context.Context

func WithPodID

func WithPodID(ctx context.Context, value string) context.Context

func WithPodIP

func WithPodIP(ctx context.Context, value string) context.Context

func WithPreferredSchedulingTerms

func WithPreferredSchedulingTerms(ctx context.Context, value interface{}) context.Context

func WithProxySubAccountUin

func WithProxySubAccountUin(ctx context.Context, value string) context.Context

func WithProxyUserAppID

func WithProxyUserAppID(ctx context.Context, value int64) context.Context

func WithProxyUserUin

func WithProxyUserUin(ctx context.Context, value string) context.Context

func WithUA

func WithUA(ctx context.Context, value string) context.Context

func WithUserData

func WithUserData(ctx context.Context, value string) context.Context

Types

This section is empty.

Jump to

Keyboard shortcuts

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