constant

package
v1.0.0-beta.14 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2024 License: AGPL-3.0 Imports: 2 Imported by: 11

Documentation

Index

Constants

View Source
const (
	// CRDAPIVersionAnnotationKey indicates the CRD API version of the object.
	CRDAPIVersionAnnotationKey = "kubeblocks.io/crd-api-version"

	KubeBlocksGenerationKey              = "kubeblocks.io/generation"
	ClusterSnapshotAnnotationKey         = "kubeblocks.io/cluster-snapshot"          // ClusterSnapshotAnnotationKey saves the snapshot of cluster.
	EncryptedSystemAccountsAnnotationKey = "kubeblocks.io/encrypted-system-accounts" // EncryptedSystemAccountsAnnotationKey saves the encrypted system accounts.
	OpsRequestAnnotationKey              = "kubeblocks.io/ops-request"               // OpsRequestAnnotationKey OpsRequest annotation key in Cluster
	ReconcileAnnotationKey               = "kubeblocks.io/reconcile"                 // ReconcileAnnotationKey Notify k8s object to reconcile
	RestartAnnotationKey                 = "kubeblocks.io/restart"                   // RestartAnnotationKey the annotation which notices the StatefulSet/DeploySet to restart
	RestoreFromBackupAnnotationKey       = "kubeblocks.io/restore-from-backup"
	RestoreDoneAnnotationKey             = "kubeblocks.io/restore-done"
	BackupSourceTargetAnnotationKey      = "kubeblocks.io/backup-source-target" // RestoreFromBackupAnnotationKey specifies the component to recover from the backup.

	KBAppClusterUIDKey                   = "apps.kubeblocks.io/cluster-uid"
	BackupPolicyTemplateAnnotationKey    = "apps.kubeblocks.io/backup-policy-template"
	PVLastClaimPolicyAnnotationKey       = "apps.kubeblocks.io/pv-last-claim-policy"
	LastRoleSnapshotVersionAnnotationKey = "apps.kubeblocks.io/last-role-snapshot-version"
	ComponentScaleInAnnotationKey        = "apps.kubeblocks.io/component-scale-in" // ComponentScaleInAnnotationKey specifies whether the component is scaled in

	// SkipImmutableCheckAnnotationKey specifies to skip the mutation check for the object.
	// The mutation check is only applied to the fields that are declared as immutable.
	SkipImmutableCheckAnnotationKey = "apps.kubeblocks.io/skip-immutable-check"

	// NodeSelectorOnceAnnotationKey adds nodeSelector in podSpec for one pod exactly once
	NodeSelectorOnceAnnotationKey = "workloads.kubeblocks.io/node-selector-once"
)

annotations defined by KubeBlocks

View Source
const (
	KBAppMultiClusterPlacementKey   = "apps.kubeblocks.io/multi-cluster-placement"
	MultiClusterServicePlacementKey = "apps.kubeblocks.io/multi-cluster-service-placement"
)

annotations for multi-cluster

View Source
const (
	BackupNameKeyForRestore           = "name"
	BackupNamespaceKeyForRestore      = "namespace"
	VolumeRestorePolicyKeyForRestore  = "volumeRestorePolicy"
	DoReadyRestoreAfterClusterRunning = "doReadyRestoreAfterClusterRunning"
	RestoreTimeKeyForRestore          = "restoreTime"
	EnvForRestore                     = "restoreEnv"
	ParametersForRestore              = "restoreParameters"
	ConnectionPassword                = "connectionPassword"
	EncryptedSystemAccounts           = "encryptedSystemAccounts"
)
View Source
const (
	TPLRenderToolPath     = "/bin/config_render"
	ConfigManagerToolPath = "/bin/reloader"

	// ConfigurationTplLabelPrefixKey clusterdefinition using tpl
	ConfigurationTplLabelPrefixKey         = "config.kubeblocks.io/tpl"
	ConfigurationConstraintsLabelPrefixKey = "config.kubeblocks.io/constraints"

	// CMInsLastReconfigurePhaseKey defines the current phase
	CMInsLastReconfigurePhaseKey = "config.kubeblocks.io/last-applied-reconfigure-phase"

	// ConfigurationRevision defines the current revision
	// TODO support multi version
	ConfigurationRevision          = "config.kubeblocks.io/configuration-revision"
	LastConfigurationRevisionPhase = "config.kubeblocks.io/revision-reconcile-phase"

	// Deprecated: only compatible with version 0.6, will be removed in 0.8
	// CMInsEnableRerenderTemplateKey is used to enable rerender template
	CMInsEnableRerenderTemplateKey = "config.kubeblocks.io/enable-rerender"
)
View Source
const (
	CMConfigurationSpecProviderLabelKey    = "config.kubeblocks.io/config-spec"    // CMConfigurationSpecProviderLabelKey is ComponentConfigSpec name
	CMConfigurationCMKeysLabelKey          = "config.kubeblocks.io/configmap-keys" // CMConfigurationCMKeysLabelKey Specify configmap keys
	CMConfigurationTemplateNameLabelKey    = "config.kubeblocks.io/config-template-name"
	CMTemplateNameLabelKey                 = "config.kubeblocks.io/template-name"
	CMConfigurationTypeLabelKey            = "config.kubeblocks.io/config-type"
	CMInsConfigurationHashLabelKey         = "config.kubeblocks.io/config-hash"
	CMInsCurrentConfigurationHashLabelKey  = "config.kubeblocks.io/update-config-hash"
	CMConfigurationConstraintsNameLabelKey = "config.kubeblocks.io/config-constraints-name"
	CMConfigurationTemplateVersion         = "config.kubeblocks.io/config-template-version"
)
View Source
const (
	DisableUpgradeInsConfigurationAnnotationKey = "config.kubeblocks.io/disable-reconfigure"
	LastAppliedConfigAnnotationKey              = "config.kubeblocks.io/last-applied-configuration"
	LastAppliedOpsCRAnnotationKey               = "config.kubeblocks.io/last-applied-ops-name"
	UpgradePolicyAnnotationKey                  = "config.kubeblocks.io/reconfigure-policy"
	KBParameterUpdateSourceAnnotationKey        = "config.kubeblocks.io/reconfigure-source"
	UpgradeRestartAnnotationKey                 = "config.kubeblocks.io/restart"
	ConfigAppliedVersionAnnotationKey           = "config.kubeblocks.io/config-applied-version"
)
View Source
const (
	ConfigSidecarName        = "config-manager"
	ConfigManagerGPRCPortEnv = "CONFIG_MANAGER_GRPC_PORT"
	ConfigManagerLogLevel    = "CONFIG_MANAGER_LOG_LEVEL"

	PodMinReadySecondsEnv = "POD_MIN_READY_SECONDS"
	ConfigTemplateType    = "tpl"
	ConfigInstanceType    = "instance"

	ReconfigureManagerSource  = "manager"
	ReconfigureUserSource     = "ops"
	ReconfigureTemplateSource = "external-template"

	ConfigManagerPortName = "config-manager"
)
View Source
const (
	APIGroup = "kubeblocks.io"
	AppName  = "kubeblocks"

	RBACRoleName = "kubeblocks-cluster-pod-role"
)
View Source
const (
	KBServiceAccountName = "KUBEBLOCKS_SERVICEACCOUNT_NAME"
	KBToolsImage         = "KUBEBLOCKS_TOOLS_IMAGE"
	KBImagePullPolicy    = "KUBEBLOCKS_IMAGE_PULL_POLICY"
	KBImagePullSecrets   = "KUBEBLOCKS_IMAGE_PULL_SECRETS"
)
View Source
const (
	StatefulSetKind           = "StatefulSet"
	PodKind                   = "Pod"
	JobKind                   = "Job"
	VolumeSnapshotKind        = "VolumeSnapshot"
	ServiceKind               = "Service"
	SecretKind                = "Secret"
	ConfigMapKind             = "ConfigMap"
	PersistentVolumeClaimKind = "PersistentVolumeClaim"
	PersistentVolumeKind      = "PersistentVolume"
	ConfigurationKind         = "Configuration"
	RoleBindingKind           = "RoleBinding"
	ServiceAccountKind        = "ServiceAccount"
	EventKind                 = "Event"
)
View Source
const (
	AccountNameForSecret   = "username"
	AccountPasswdForSecret = "password"
)

username and password are keys in created secrets for others to refer to.

View Source
const (
	KubernetesClusterDomainEnv = "KUBERNETES_CLUSTER_DOMAIN"
	DefaultDNSDomain           = "cluster.local"
)
View Source
const (
	KBPrefix                = "KB"
	KBLowerPrefix           = "kb"
	SlashScalingLowerSuffix = "scaling"
)
View Source
const (
	KubeblocksAPIConversionTypeAnnotationName = "api.kubeblocks.io/converted"
	SourceAPIVersionAnnotationName            = "api.kubeblocks.io/source"

	MigratedAPIVersion = "migrated"
)
View Source
const (
	KBEnvClusterName     = "KB_CLUSTER_NAME"
	KBEnvClusterUID      = "KB_CLUSTER_UID"
	KBEnvClusterCompName = "KB_CLUSTER_COMP_NAME"
)

Cluster

View Source
const (
	KBEnvCompName     = "KB_COMP_NAME"
	KBEnvCompReplicas = "KB_COMP_REPLICAS"
)

Component

View Source
const (
	// ReasonNotFoundCR referenced custom resource not found
	ReasonNotFoundCR = "NotFound"
	// ReasonRefCRUnavailable  referenced custom resource is unavailable
	ReasonRefCRUnavailable = "Unavailable"
	// ReasonDeletedCR deleted custom resource
	ReasonDeletedCR = "DeletedCR"
	// ReasonDeletingCR deleting custom resource
	ReasonDeletingCR = "DeletingCR"
	// ReasonCreatedCR created custom resource
	ReasonCreatedCR = "CreatedCR"
	// ReasonRunTaskFailed run task failed
	ReasonRunTaskFailed = "RunTaskFailed"
	// ReasonDeleteFailed delete failed
	ReasonDeleteFailed = "DeleteFailed"
)
View Source
const (
	DBClusterFinalizerName         = "cluster.kubeblocks.io/finalizer"
	DBComponentFinalizerName       = "component.kubeblocks.io/finalizer"
	ConfigFinalizerName            = "config.kubeblocks.io/finalizer"
	ServiceDescriptorFinalizerName = "servicedescriptor.kubeblocks.io/finalizer"
	OpsRequestFinalizerName        = "opsrequest.kubeblocks.io/finalizer"
)

kubeblocks.io well-known finalizers

View Source
const (
	EnableRBACManager = "EnableRBACManager"

	ManagedNamespacesFlag = "managed-namespaces"
)
View Source
const (
	// HostNetworkAnnotationKey defines the feature gate to enable the host-network for specified components or shardings.
	HostNetworkAnnotationKey = "kubeblocks.io/host-network"

	// FeatureReconciliationInCompactModeAnnotationKey indicates that the controller should run in compact mode,
	// means to try the best to cutoff useless objects.
	FeatureReconciliationInCompactModeAnnotationKey = "kubeblocks.io/compact-mode"

	// FeatureGateInPlacePodVerticalScaling specifies to enable in-place pod vertical scaling
	// NOTE: This feature depends on the InPlacePodVerticalScaling feature of the K8s cluster in which the KubeBlocks runs.
	FeatureGateInPlacePodVerticalScaling = "IN_PLACE_POD_VERTICAL_SCALING"
)
View Source
const (
	AppVersionLabelKey = "app.kubernetes.io/version"

	AppManagedByLabelKey = "app.kubernetes.io/managed-by"

	AppNameLabelKey      = "app.kubernetes.io/name"
	AppComponentLabelKey = "app.kubernetes.io/component"

	AppInstanceLabelKey = "app.kubernetes.io/instance"
)

k8s recommended well-known label keys

View Source
const (
	ClusterDefLabelKey            = "clusterdefinition.kubeblocks.io/name"
	ShardingDefLabelKey           = "shardingdefinition.kubeblocks.io/name"
	ComponentDefinitionLabelKey   = "componentdefinition.kubeblocks.io/name"
	ComponentVersionLabelKey      = "componentversion.kubeblocks.io/name"
	SidecarDefLabelKey            = "sidecardefinition.kubeblocks.io/name"
	ServiceDescriptorNameLabelKey = "servicedescriptor.kubeblocks.io/name"
	AddonNameLabelKey             = "extensions.kubeblocks.io/addon-name"

	KBAppComponentLabelKey    = "apps.kubeblocks.io/component-name"
	KBAppShardingNameLabelKey = "apps.kubeblocks.io/sharding-name"

	KBAppComponentInstanceTemplateLabelKey = "apps.kubeblocks.io/instance-template"
	PVCNameLabelKey                        = "apps.kubeblocks.io/pvc-name"
	VolumeClaimTemplateNameLabelKey        = "apps.kubeblocks.io/vct-name"
	KBAppPodNameLabelKey                   = "apps.kubeblocks.io/pod-name"

	RoleLabelKey           = "kubeblocks.io/role" // RoleLabelKey consensusSet and replicationSet role label key
	KBAppServiceVersionKey = "apps.kubeblocks.io/service-version"
	AccessModeLabelKey     = "workloads.kubeblocks.io/access-mode"
	ReadyWithoutPrimaryKey = "kubeblocks.io/ready-without-primary"
)

labels defined by KubeBlocks

View Source
const (
	OpsRequestTypeLabelKey      = "operations.kubeblocks.io/ops-type"
	OpsRequestNameLabelKey      = "operations.kubeblocks.io/ops-name"
	OpsRequestNamespaceLabelKey = "operations.kubeblocks.io/ops-namespace"
)

labels

View Source
const (
	QueueEndTimeAnnotationKey          = "operations.kubeblocks.io/queue-end-time"
	DisableHAAnnotationKey             = "operations.kubeblocks.io/disable-ha"
	RelatedOpsAnnotationKey            = "operations.kubeblocks.io/related-ops"
	OpsDependentOnSuccessfulOpsAnnoKey = "operations.kubeblocks.io/dependent-on-successful-ops" // OpsDependentOnSuccessfulOpsAnnoKey wait for the dependent ops to succeed before executing the current ops. If it fails, this ops will also fail.
	IgnoreHscaleValidateAnnoKey        = "apps.kubeblocks.io/ignore-strict-horizontal-scale-validation"
)

annotations

View Source
const (
	ComponentResourcePayload = "component-resource"
	ReplicasPayload          = "replicas"
	BinaryVersionPayload     = "binary-version"
)
View Source
const (
	Primary   = "primary"
	Secondary = "secondary"

	Leader    = "leader"
	Follower  = "follower"
	Learner   = "learner"
	Candidate = "candidate"
)
View Source
const (
	ServiceDescriptorUsernameKey = "username"
	ServiceDescriptorPasswordKey = "password"
	ServiceDescriptorEndpointKey = "endpoint"
	ServiceDescriptorHostKey     = "host"
	ServiceDescriptorPortKey     = "port"
)
View Source
const (
	ServiceKindPostgreSQL    = "postgresql"
	ServiceKindMongoDB       = "mongodb"
	ServiceKindClickHouse    = "clickhouse"
	ServiceKindZookeeper     = "zookeeper"
	ServiceKindElasticSearch = "elasticsearch"
)
View Source
const (
	CfgKeyServerInfo                    = "_KUBE_SERVER_INFO"
	CfgKeyCtrlrMgrNS                    = "CM_NAMESPACE"
	CfgKeyCtrlrMgrAffinity              = "CM_AFFINITY"
	CfgKeyCtrlrMgrNodeSelector          = "CM_NODE_SELECTOR"
	CfgKeyCtrlrMgrTolerations           = "CM_TOLERATIONS"
	CfgKeyCtrlrReconcileRetryDurationMS = "CM_RECON_RETRY_DURATION_MS"       // accept time
	CfgRecoverVolumeExpansionFailure    = "RECOVER_VOLUME_EXPANSION_FAILURE" // refer to feature gates RecoverVolumeExpansionFailure of k8s.
	CfgKeyProvider                      = "KUBE_PROVIDER"
	CfgHostPortConfigMapName            = "HOST_PORT_CM_NAME"
	CfgHostPortIncludeRanges            = "HOST_PORT_INCLUDE_RANGES"
	CfgHostPortExcludeRanges            = "HOST_PORT_EXCLUDE_RANGES"

	// addon config keys
	CfgKeyAddonJobTTL        = "ADDON_JOB_TTL"
	CfgAddonJobImgPullPolicy = "ADDON_JOB_IMAGE_PULL_POLICY"

	// data plane config key
	CfgKeyDataPlaneTolerations = "DATA_PLANE_TOLERATIONS"
	CfgKeyDataPlaneAffinity    = "DATA_PLANE_AFFINITY"

	// storage config keys
	CfgKeyDefaultStorageClass = "DEFAULT_STORAGE_CLASS"

	// customized encryption key for encrypting the password of connection credential.
	CfgKeyDPEncryptionKey                = "DP_ENCRYPTION_KEY"
	CfgKeyDPBackupEncryptionSecretKeyRef = "DP_BACKUP_ENCRYPTION_SECRET_KEY_REF"
	CfgKeyDPBackupEncryptionAlgorithm    = "DP_BACKUP_ENCRYPTION_ALGORITHM"

	CfgKBReconcileWorkers = "KUBEBLOCKS_RECONCILE_WORKERS"
	CfgClientQPS          = "CLIENT_QPS"
	CfgClientBurst        = "CLIENT_BURST"

	CfgRegistries     = "registries"
	I18nResourcesName = "I18N_RESOURCES_NAME"
)

config keys used in viper, DON'T refactor the value without careful inspections

View Source
const (
	APIVersionSupported = "api-version-supported"
)

APIVersionSupported specifies the API version supported by the operator.

View Source
const EmptyInsTemplateName = ""
View Source
const (
	FeatureGateIgnoreConfigTemplateDefaultMode = "IGNORE_CONFIG_TEMPLATE_DEFAULT_MODE"
)
View Source
const InvalidContainerPort int32 = 0
View Source
const (
	KBEnvNamespace = "KB_NAMESPACE"
)

Global

Variables

This section is empty.

Functions

func GenerateAccountSecretName added in v0.8.0

func GenerateAccountSecretName(clusterName, compName, name string) string

GenerateAccountSecretName generates the secret name of system accounts.

func GenerateClusterComponentEnvPattern added in v0.8.0

func GenerateClusterComponentEnvPattern(clusterName, compName string) string

GenerateClusterComponentEnvPattern generates cluster and component pattern

func GenerateClusterComponentName added in v0.8.0

func GenerateClusterComponentName(clusterName, compName string) string

GenerateClusterComponentName generates the cluster component name.

func GenerateClusterServiceName added in v0.8.0

func GenerateClusterServiceName(clusterName, svcName string) string

GenerateClusterServiceName generates the service name for cluster.

func GenerateComponentHeadlessServiceName added in v0.8.0

func GenerateComponentHeadlessServiceName(clusterName, compName, svcName string) string

GenerateComponentHeadlessServiceName generates the headless service name for component.

func GenerateComponentServiceName added in v0.8.0

func GenerateComponentServiceName(clusterName, compName, svcName string) string

GenerateComponentServiceName generates the service name for component.

func GenerateDefaultComponentHeadlessServiceName added in v0.8.0

func GenerateDefaultComponentHeadlessServiceName(clusterName, compName string) string

GenerateDefaultComponentHeadlessServiceName generates the default headless service name for component.

func GenerateDefaultComponentServiceName added in v0.8.0

func GenerateDefaultComponentServiceName(clusterName, compName string) string

GenerateDefaultComponentServiceName generates the default service name for component.

func GenerateDefaultServiceAccountName added in v0.8.0

func GenerateDefaultServiceAccountName(name string) string

GenerateDefaultServiceAccountName generates default service account name for a cluster.

func GeneratePodName added in v0.8.0

func GeneratePodName(clusterName, compName string, ordinal int) string

GeneratePodName generates the connection credential name for component.

func GenerateShardingNamePrefix added in v0.8.2

func GenerateShardingNamePrefix(shardingName string) string

GenerateShardingNamePrefix generates sharding name prefix.

func GenerateWorkloadNamePattern added in v0.9.0

func GenerateWorkloadNamePattern(clusterName, compName string) string

GenerateWorkloadNamePattern generates the workload name pattern

func GetClickHouseAlias

func GetClickHouseAlias() []string

GetClickHouseAlias get clickhouse alias

func GetClusterLabels

func GetClusterLabels(clusterName string, labels ...map[string]string) map[string]string

func GetCompEnvCMName

func GetCompEnvCMName(compObjName string) string

func GetCompLabels

func GetCompLabels(clusterName, compName string, labels ...map[string]string) map[string]string

func GetCompLabelsWithDef

func GetCompLabelsWithDef(clusterName, compName, compDef string, labels ...map[string]string) map[string]string

func GetConfigurationLabels

func GetConfigurationLabels(clusterName, compName, cmTplName string) map[string]string

func GetElasticSearchAlias

func GetElasticSearchAlias() []string

GetElasticSearchAlias get elasticsearch alias

func GetMongoDBAlias

func GetMongoDBAlias() []string

GetMongoDBAlias get mongodb alias

func GetPostgreSQLAlias

func GetPostgreSQLAlias() []string

GetPostgreSQLAlias get postgresql alias

func GetZookeeperAlias

func GetZookeeperAlias() []string

GetZookeeperAlias get zookeeper alias

func InheritedAnnotations

func InheritedAnnotations() []string

Types

type Key

type Key string
const DryRunContextKey Key = "dry-run"

DryRunContextKey tells the KB Controllers to do dry-run reconciliations

Jump to

Keyboard shortcuts

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