types

package
v1.6.4-dev-20241117 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2024 License: Apache-2.0 Imports: 27 Imported by: 23

Documentation

Index

Constants

View Source
const (
	SnapPrefix = "snap"
	VolPrefix  = "vol"

	VolumeNameKey   = "volumeName"
	SnapshotNameKey = "snapshotName"
)
View Source
const (
	LonghornManagerDaemonSetName = "longhorn-manager"
	LonghornManagerContainerName = LonghornManagerDaemonSetName
	LonghornUIDeploymentName     = "longhorn-ui"

	DriverDeployerName = "longhorn-driver-deployer"
	CSIAttacherName    = "csi-attacher"
	CSIProvisionerName = "csi-provisioner"
	CSIResizerName     = "csi-resizer"
	CSISnapshotterName = "csi-snapshotter"
	CSIPluginName      = "longhorn-csi-plugin"
)
View Source
const (
	DefaultSettingYAMLFileName = "default-setting.yaml"

	ValueEmpty   = "none"
	ValueUnknown = "unknown"

	// From `maximumChainLength` in longhorn-engine/pkg/replica/replica.go
	MaxSnapshotNum = 250
)
View Source
const (
	SettingTypeString     = SettingType("string")
	SettingTypeInt        = SettingType("int")
	SettingTypeBool       = SettingType("bool")
	SettingTypeDeprecated = SettingType("deprecated")
)
View Source
const (
	SettingNameBackupTarget                                             = SettingName("backup-target")
	SettingNameBackupTargetCredentialSecret                             = SettingName("backup-target-credential-secret")
	SettingNameAllowRecurringJobWhileVolumeDetached                     = SettingName("allow-recurring-job-while-volume-detached")
	SettingNameCreateDefaultDiskLabeledNodes                            = SettingName("create-default-disk-labeled-nodes")
	SettingNameDefaultDataPath                                          = SettingName("default-data-path")
	SettingNameDefaultEngineImage                                       = SettingName("default-engine-image")
	SettingNameDefaultInstanceManagerImage                              = SettingName("default-instance-manager-image")
	SettingNameDefaultBackingImageManagerImage                          = SettingName("default-backing-image-manager-image")
	SettingNameSupportBundleManagerImage                                = SettingName("support-bundle-manager-image")
	SettingNameReplicaSoftAntiAffinity                                  = SettingName("replica-soft-anti-affinity")
	SettingNameReplicaAutoBalance                                       = SettingName("replica-auto-balance")
	SettingNameStorageOverProvisioningPercentage                        = SettingName("storage-over-provisioning-percentage")
	SettingNameStorageMinimalAvailablePercentage                        = SettingName("storage-minimal-available-percentage")
	SettingNameStorageReservedPercentageForDefaultDisk                  = SettingName("storage-reserved-percentage-for-default-disk")
	SettingNameUpgradeChecker                                           = SettingName("upgrade-checker")
	SettingNameAllowCollectingLonghornUsage                             = SettingName("allow-collecting-longhorn-usage-metrics")
	SettingNameCurrentLonghornVersion                                   = SettingName("current-longhorn-version")
	SettingNameLatestLonghornVersion                                    = SettingName("latest-longhorn-version")
	SettingNameStableLonghornVersions                                   = SettingName("stable-longhorn-versions")
	SettingNameDefaultReplicaCount                                      = SettingName("default-replica-count")
	SettingNameDefaultDataLocality                                      = SettingName("default-data-locality")
	SettingNameDefaultLonghornStaticStorageClass                        = SettingName("default-longhorn-static-storage-class")
	SettingNameBackupstorePollInterval                                  = SettingName("backupstore-poll-interval")
	SettingNameTaintToleration                                          = SettingName("taint-toleration")
	SettingNameSystemManagedComponentsNodeSelector                      = SettingName("system-managed-components-node-selector")
	SettingNameCRDAPIVersion                                            = SettingName("crd-api-version")
	SettingNameAutoSalvage                                              = SettingName("auto-salvage")
	SettingNameAutoDeletePodWhenVolumeDetachedUnexpectedly              = SettingName("auto-delete-pod-when-volume-detached-unexpectedly")
	SettingNameRegistrySecret                                           = SettingName("registry-secret")
	SettingNameDisableSchedulingOnCordonedNode                          = SettingName("disable-scheduling-on-cordoned-node")
	SettingNameReplicaZoneSoftAntiAffinity                              = SettingName("replica-zone-soft-anti-affinity")
	SettingNameNodeDownPodDeletionPolicy                                = SettingName("node-down-pod-deletion-policy")
	SettingNameNodeDrainPolicy                                          = SettingName("node-drain-policy")
	SettingNameDetachManuallyAttachedVolumesWhenCordoned                = SettingName("detach-manually-attached-volumes-when-cordoned")
	SettingNamePriorityClass                                            = SettingName("priority-class")
	SettingNameDisableRevisionCounter                                   = SettingName("disable-revision-counter")
	SettingNameReplicaReplenishmentWaitInterval                         = SettingName("replica-replenishment-wait-interval")
	SettingNameConcurrentReplicaRebuildPerNodeLimit                     = SettingName("concurrent-replica-rebuild-per-node-limit")
	SettingNameConcurrentBackupRestorePerNodeLimit                      = SettingName("concurrent-volume-backup-restore-per-node-limit")
	SettingNameSystemManagedPodsImagePullPolicy                         = SettingName("system-managed-pods-image-pull-policy")
	SettingNameAllowVolumeCreationWithDegradedAvailability              = SettingName("allow-volume-creation-with-degraded-availability")
	SettingNameAutoCleanupSystemGeneratedSnapshot                       = SettingName("auto-cleanup-system-generated-snapshot")
	SettingNameAutoCleanupRecurringJobBackupSnapshot                    = SettingName("auto-cleanup-recurring-job-backup-snapshot")
	SettingNameConcurrentAutomaticEngineUpgradePerNodeLimit             = SettingName("concurrent-automatic-engine-upgrade-per-node-limit")
	SettingNameBackingImageCleanupWaitInterval                          = SettingName("backing-image-cleanup-wait-interval")
	SettingNameBackingImageRecoveryWaitInterval                         = SettingName("backing-image-recovery-wait-interval")
	SettingNameGuaranteedInstanceManagerCPU                             = SettingName("guaranteed-instance-manager-cpu")
	SettingNameKubernetesClusterAutoscalerEnabled                       = SettingName("kubernetes-cluster-autoscaler-enabled")
	SettingNameOrphanAutoDeletion                                       = SettingName("orphan-auto-deletion")
	SettingNameStorageNetwork                                           = SettingName("storage-network")
	SettingNameFailedBackupTTL                                          = SettingName("failed-backup-ttl")
	SettingNameRecurringSuccessfulJobsHistoryLimit                      = SettingName("recurring-successful-jobs-history-limit")
	SettingNameRecurringFailedJobsHistoryLimit                          = SettingName("recurring-failed-jobs-history-limit")
	SettingNameRecurringJobMaxRetention                                 = SettingName("recurring-job-max-retention")
	SettingNameSupportBundleFailedHistoryLimit                          = SettingName("support-bundle-failed-history-limit")
	SettingNameSupportBundleNodeCollectionTimeout                       = SettingName("support-bundle-node-collection-timeout")
	SettingNameDeletingConfirmationFlag                                 = SettingName("deleting-confirmation-flag")
	SettingNameEngineReplicaTimeout                                     = SettingName("engine-replica-timeout")
	SettingNameSnapshotDataIntegrity                                    = SettingName("snapshot-data-integrity")
	SettingNameSnapshotDataIntegrityImmediateCheckAfterSnapshotCreation = SettingName("snapshot-data-integrity-immediate-check-after-snapshot-creation")
	SettingNameSnapshotDataIntegrityCronJob                             = SettingName("snapshot-data-integrity-cronjob")
	SettingNameSnapshotMaxCount                                         = SettingName("snapshot-max-count")
	SettingNameRestoreVolumeRecurringJobs                               = SettingName("restore-volume-recurring-jobs")
	SettingNameRemoveSnapshotsDuringFilesystemTrim                      = SettingName("remove-snapshots-during-filesystem-trim")
	SettingNameFastReplicaRebuildEnabled                                = SettingName("fast-replica-rebuild-enabled")
	SettingNameReplicaFileSyncHTTPClientTimeout                         = SettingName("replica-file-sync-http-client-timeout")
	SettingNameBackupCompressionMethod                                  = SettingName("backup-compression-method")
	SettingNameBackupConcurrentLimit                                    = SettingName("backup-concurrent-limit")
	SettingNameRestoreConcurrentLimit                                   = SettingName("restore-concurrent-limit")
	SettingNameLogLevel                                                 = SettingName("log-level")
	SettingNameOfflineReplicaRebuilding                                 = SettingName("offline-replica-rebuilding")
	SettingNameReplicaDiskSoftAntiAffinity                              = SettingName("replica-disk-soft-anti-affinity")
	SettingNameAllowEmptyNodeSelectorVolume                             = SettingName("allow-empty-node-selector-volume")
	SettingNameAllowEmptyDiskSelectorVolume                             = SettingName("allow-empty-disk-selector-volume")
	SettingNameDisableSnapshotPurge                                     = SettingName("disable-snapshot-purge")
	SettingNameV1DataEngine                                             = SettingName("v1-data-engine")
	SettingNameV2DataEngine                                             = SettingName("v2-data-engine")
	SettingNameV2DataEngineHugepageLimit                                = SettingName("v2-data-engine-hugepage-limit")
	SettingNameV2DataEngineGuaranteedInstanceManagerCPU                 = SettingName("v2-data-engine-guaranteed-instance-manager-cpu")
)
View Source
const (
	SettingCategoryGeneral      = SettingCategory("general")
	SettingCategoryBackup       = SettingCategory("backup")
	SettingCategoryOrphan       = SettingCategory("orphan")
	SettingCategoryScheduling   = SettingCategory("scheduling")
	SettingCategoryDangerZone   = SettingCategory("danger Zone")
	SettingCategorySnapshot     = SettingCategory("snapshot")
	SettingCategoryV2DataEngine = SettingCategory("v2 data engine (Preview Feature)")
)
View Source
const (
	NodeDownPodDeletionPolicyDoNothing                             = NodeDownPodDeletionPolicy("do-nothing") // Kubernetes default behavior
	NodeDownPodDeletionPolicyDeleteStatefulSetPod                  = NodeDownPodDeletionPolicy("delete-statefulset-pod")
	NodeDownPodDeletionPolicyDeleteDeploymentPod                   = NodeDownPodDeletionPolicy("delete-deployment-pod")
	NodeDownPodDeletionPolicyDeleteBothStatefulsetAndDeploymentPod = NodeDownPodDeletionPolicy("delete-both-statefulset-and-deployment-pod")
)
View Source
const (
	NodeDrainPolicyBlockForEviction                      = NodeDrainPolicy("block-for-eviction")
	NodeDrainPolicyBlockForEvictionIfContainsLastReplica = NodeDrainPolicy("block-for-eviction-if-contains-last-replica")
	NodeDrainPolicyBlockIfContainsLastReplica            = NodeDrainPolicy("block-if-contains-last-replica")
	NodeDrainPolicyAllowIfReplicaIsStopped               = NodeDrainPolicy("allow-if-replica-is-stopped")
	NodeDrainPolicyAlwaysAllow                           = NodeDrainPolicy("always-allow")
)
View Source
const (
	SystemManagedPodsImagePullPolicyNever        = SystemManagedPodsImagePullPolicy("never")
	SystemManagedPodsImagePullPolicyIfNotPresent = SystemManagedPodsImagePullPolicy("if-not-present")
	SystemManagedPodsImagePullPolicyAlways       = SystemManagedPodsImagePullPolicy("always")
)
View Source
const (
	CNIAnnotationNetworks      = CNIAnnotation("k8s.v1.cni.cncf.io/networks")
	CNIAnnotationNetworkStatus = CNIAnnotation("k8s.v1.cni.cncf.io/network-status")

	// CNIAnnotationNetworksStatus is deprecated since Multus v3.6 and completely removed in v4.0.0.
	// This exists to support older Multus versions.
	// Ref: https://github.com/longhorn/longhorn/issues/6953
	CNIAnnotationNetworksStatus = CNIAnnotation("k8s.v1.cni.cncf.io/networks-status")
)
View Source
const (
	SupportBundleNameFmt = "support-bundle-%v"

	SupportBundleManagerApp      = "support-bundle-manager"
	SupportBundleManagerLabelKey = "rancher/supportbundle"

	SupportBundleURLPort        = 8080
	SupportBundleURLStatusFmt   = "http://%s:%v/status"
	SupportBundleURLDownloadFmt = "http://%s:%v/bundle"

	SupportBundleDownloadTimeout = 24 * time.Hour
)
View Source
const (
	SystemRolloutDirTemp = "/tmp"

	SystemBackupExtension           = ".zip"
	SystemBackupSubDirLonghorn      = "longhorn"
	SystemBackupSubDirKubernetes    = "kubernetes"
	SystemBackupSubDirAPIExtensions = "apiextensions"
	SystemBackupSubDirYaml          = "yamls"
)
View Source
const (
	LonghornKindNode                = "Node"
	LonghornKindVolume              = "Volume"
	LonghornKindVolumeAttachment    = "VolumeAttachment"
	LonghornKindEngine              = "Engine"
	LonghornKindReplica             = "Replica"
	LonghornKindBackup              = "Backup"
	LonghornKindSnapshot            = "Snapshot"
	LonghornKindEngineImage         = "EngineImage"
	LonghornKindInstanceManager     = "InstanceManager"
	LonghornKindShareManager        = "ShareManager"
	LonghornKindBackingImage        = "BackingImage"
	LonghornKindBackingImageManager = "BackingImageManager"
	LonghornKindRecurringJob        = "RecurringJob"
	LonghornKindSetting             = "Setting"
	LonghornKindSupportBundle       = "SupportBundle"
	LonghornKindSystemRestore       = "SystemRestore"
	LonghornKindOrphan              = "Orphan"

	LonghornKindBackingImageDataSource = "BackingImageDataSource"

	LonghornKindEngineImageList  = "EngineImageList"
	LonghornKindRecurringJobList = "RecurringJobList"
	LonghornKindSettingList      = "SettingList"
	LonghornKindVolumeList       = "VolumeList"

	KubernetesKindClusterRole           = "ClusterRole"
	KubernetesKindClusterRoleBinding    = "ClusterRoleBinding"
	KubernetesKindConfigMap             = "ConfigMap"
	KubernetesKindDaemonSet             = "DaemonSet"
	KubernetesKindDeployment            = "Deployment"
	KubernetesKindJob                   = "Job"
	KubernetesKindPersistentVolume      = "PersistentVolume"
	KubernetesKindPersistentVolumeClaim = "PersistentVolumeClaim"
	KubernetesKindPodSecurityPolicy     = "PodSecurityPolicy"
	KubernetesKindRole                  = "Role"
	KubernetesKindRoleBinding           = "RoleBinding"
	KubernetesKindService               = "Service"
	KubernetesKindServiceAccount        = "ServiceAccount"
	KubernetesKindStorageClass          = "StorageClass"

	KubernetesKindClusterRoleList           = "ClusterRoleList"
	KubernetesKindClusterRoleBindingList    = "ClusterRoleBindingList"
	KubernetesKindConfigMapList             = "ConfigMapList"
	KubernetesKindDaemonSetList             = "DaemonSetList"
	KubernetesKindDeploymentList            = "DeploymentList"
	KubernetesKindPersistentVolumeList      = "PersistentVolumeList"
	KubernetesKindPersistentVolumeClaimList = "PersistentVolumeClaimList"
	KubernetesKindPodSecurityPolicyList     = "PodSecurityPolicyList"
	KubernetesKindRoleList                  = "RoleList"
	KubernetesKindRoleBindingList           = "RoleBindingList"
	KubernetesKindServiceList               = "ServiceList"
	KubernetesKindServiceAccountList        = "ServiceAccountList"
	KubernetesKindStorageClassList          = "StorageClassList"

	APIExtensionsKindCustomResourceDefinition = "CustomResourceDefinition"

	APIExtensionsKindCustomResourceDefinitionList = "CustomResourceDefinitionList"

	CRDAPIVersionV1alpha1 = "longhorn.rancher.io/v1alpha1"
	CRDAPIVersionV1beta1  = "longhorn.io/v1beta1"
	CRDAPIVersionV1beta2  = "longhorn.io/v1beta2"
	CurrentCRDAPIVersion  = CRDAPIVersionV1beta2
)
View Source
const (
	DefaultAPIPort                   = 9500
	DefaultConversionWebhookPort     = 9501
	DefaultAdmissionWebhookPort      = 9502
	DefaultRecoveryBackendServerPort = 9503

	EngineBinaryDirectoryInContainer = "/engine-binaries/"
	EngineBinaryDirectoryOnHost      = "/var/lib/longhorn/engine-binaries/"
	ReplicaHostPrefix                = "/host"
	EngineBinaryName                 = "longhorn"

	UnixDomainSocketDirectoryInContainer = "/host/var/lib/longhorn/unix-domain-socket/"
	UnixDomainSocketDirectoryOnHost      = "/var/lib/longhorn/unix-domain-socket/"

	BackingImageManagerDirectory = "/backing-images/"
	BackingImageFileName         = "backing"

	TLSDirectoryInContainer = "/tls-files/"
	TLSSecretName           = "longhorn-grpc-tls"
	TLSCAFile               = "ca.crt"
	TLSCertFile             = "tls.crt"
	TLSKeyFile              = "tls.key"

	DefaultBackupTargetName = "default"

	LonghornNodeKey     = "longhornnode"
	LonghornDiskUUIDKey = "longhorndiskuuid"

	NodeCreateDefaultDiskLabelKey             = "node.longhorn.io/create-default-disk"
	NodeCreateDefaultDiskLabelValueTrue       = "true"
	NodeCreateDefaultDiskLabelValueConfig     = "config"
	NodeDisableV2DataEngineLabelKey           = "node.longhorn.io/disable-v2-data-engine"
	NodeDisableV2DataEngineLabelKeyTrue       = "true"
	KubeNodeDefaultDiskConfigAnnotationKey    = "node.longhorn.io/default-disks-config"
	KubeNodeDefaultNodeTagConfigAnnotationKey = "node.longhorn.io/default-node-tags"

	LastAppliedTolerationAnnotationKeySuffix = "last-applied-tolerations"

	ConfigMapResourceVersionKey = "configmap-resource-version"
	UpdateSettingFromLonghorn   = "update-setting-from-longhorn"

	DeleteCustomResourceOnly = "delete-custom-resource-only"

	KubernetesStatusLabel = "KubernetesStatus"
	KubernetesReplicaSet  = "ReplicaSet"
	KubernetesStatefulSet = "StatefulSet"
	RecurringJobLabel     = "RecurringJob"

	VolumeRecurringJobInfoLabel     = "VolumeRecurringJobInfo"
	VolumeRecurringJobRestorePrefix = "restored-recurring-job-"

	LonghornLabelKeyPrefix = "longhorn.io"

	LonghornLabelRecurringJobKeyPrefixFmt = "recurring-%s.longhorn.io"
	LonghornLabelVolumeSettingKeyPrefix   = "setting.longhorn.io"

	LonghornLabelEngineImage                = "engine-image"
	LonghornLabelInstanceManager            = "instance-manager"
	LonghornLabelNode                       = "node"
	LonghornLabelDiskUUID                   = "disk-uuid"
	LonghornLabelInstanceManagerType        = "instance-manager-type"
	LonghornLabelInstanceManagerImage       = "instance-manager-image"
	LonghornLabelVolume                     = "longhornvolume"
	LonghornLabelShareManager               = "share-manager"
	LonghornLabelShareManagerImage          = "share-manager-image"
	LonghornLabelShareManagerConfigMap      = "share-manager-configmap"
	LonghornLabelBackingImage               = "backing-image"
	LonghornLabelBackingImageManager        = "backing-image-manager"
	LonghornLabelManagedBy                  = "managed-by"
	LonghornLabelSnapshotForCloningVolume   = "for-cloning-volume"
	LonghornLabelBackingImageDataSource     = "backing-image-data-source"
	LonghornLabelBackupVolume               = "backup-volume"
	LonghornLabelRecurringJob               = "job"
	LonghornLabelRecurringJobGroup          = "job-group"
	LonghornLabelRecurringJobSource         = "source"
	LonghornLabelOrphan                     = "orphan"
	LonghornLabelOrphanType                 = "orphan-type"
	LonghornLabelRecoveryBackend            = "recovery-backend"
	LonghornLabelCRDAPIVersion              = "crd-api-version"
	LonghornLabelVolumeAccessMode           = "volume-access-mode"
	LonghornLabelFollowGlobalSetting        = "follow-global-setting"
	LonghornLabelSystemRestore              = "system-restore"
	LonghornLabelLastSkippedSystemRestore   = "last-skipped-system-restored"
	LonghornLabelLastSkippedSystemRestoreAt = "last-skipped-system-restored-at"
	LonghornLabelLastSystemRestore          = "last-system-restored"
	LonghornLabelLastSystemRestoreAt        = "last-system-restored-at"
	LonghornLabelLastSystemRestoreBackup    = "last-system-restored-backup"
	LonghornLabelDataEngine                 = "data-engine"
	LonghornLabelVersion                    = "version"

	LonghornLabelValueEnabled = "enabled"
	LonghornLabelValueIgnored = "ignored"

	LonghornLabelExportFromVolume                 = "export-from-volume"
	LonghornLabelSnapshotForExportingBackingImage = "for-exporting-backing-image"

	KubernetesFailureDomainRegionLabelKey = "failure-domain.beta.kubernetes.io/region"
	KubernetesFailureDomainZoneLabelKey   = "failure-domain.beta.kubernetes.io/zone"
	KubernetesTopologyRegionLabelKey      = "topology.kubernetes.io/region"
	KubernetesTopologyZoneLabelKey        = "topology.kubernetes.io/zone"

	KubernetesClusterAutoscalerSafeToEvictKey = "cluster-autoscaler.kubernetes.io/safe-to-evict"

	LonghornDriverName = "driver.longhorn.io"

	DefaultDiskPrefix = "default-disk-"

	DeprecatedProvisionerName          = "rancher.io/longhorn"
	DepracatedDriverName               = "io.rancher.longhorn"
	DefaultStorageClassConfigMapName   = "longhorn-storageclass"
	DefaultDefaultSettingConfigMapName = "longhorn-default-setting"
	DefaultStorageClassName            = "longhorn"
	ControlPlaneName                   = "longhorn-manager"

	DefaultRecurringJobConcurrency = 10

	PVAnnotationLonghornVolumeSchedulingError = "longhorn.io/volume-scheduling-error"

	CniNetworkNone          = ""
	StorageNetworkInterface = "lhnet1"

	KubeAPIQPS   = 50
	KubeAPIBurst = 100
)
View Source
const (
	EnvNodeName       = "NODE_NAME"
	EnvPodNamespace   = "POD_NAMESPACE"
	EnvPodIP          = "POD_IP"
	EnvServiceAccount = "SERVICE_ACCOUNT"

	BackupStoreTypeS3     = "s3"
	BackupStoreTypeCIFS   = "cifs"
	BackupStoreTypeAZBlob = "azblob"

	AWSIAMRoleAnnotation = "iam.amazonaws.com/role"
	AWSIAMRoleArn        = "AWS_IAM_ROLE_ARN"
	AWSAccessKey         = "AWS_ACCESS_KEY_ID"
	AWSSecretKey         = "AWS_SECRET_ACCESS_KEY"
	AWSEndPoint          = "AWS_ENDPOINTS"
	AWSCert              = "AWS_CERT"

	CIFSUsername = "CIFS_USERNAME"
	CIFSPassword = "CIFS_PASSWORD"

	AZBlobAccountName = "AZBLOB_ACCOUNT_NAME"
	AZBlobAccountKey  = "AZBLOB_ACCOUNT_KEY"
	AZBlobEndpoint    = "AZBLOB_ENDPOINT"
	AZBlobCert        = "AZBLOB_CERT"

	HTTPSProxy = "HTTPS_PROXY"
	HTTPProxy  = "HTTP_PROXY"
	NOProxy    = "NO_PROXY"

	VirtualHostedStyle = "VIRTUAL_HOSTED_STYLE"

	OptionFromBackup          = "fromBackup"
	OptionNumberOfReplicas    = "numberOfReplicas"
	OptionStaleReplicaTimeout = "staleReplicaTimeout"
	OptionBaseImage           = "baseImage"
	OptionFrontend            = "frontend"
	OptionDiskSelector        = "diskSelector"
	OptionNodeSelector        = "nodeSelector"

	// DefaultStaleReplicaTimeout in minutes. 48h by default
	DefaultStaleReplicaTimeout = "2880"

	ImageChecksumNameLength             = 8
	InstanceManagerSuffixChecksumLength = 32
)
View Source
const (
	WebhookTypeConversion = "conversion"
	WebhookTypeAdmission  = "admission"

	ValidatingWebhookName        = "longhorn-webhook-validator"
	MutatingWebhookName          = "longhorn-webhook-mutator"
	ConversionWebhookServiceName = "longhorn-conversion-webhook"
	AdmissionWebhookServiceName  = "longhorn-admission-webhook"

	CaName   = "longhorn-webhook-ca"
	CertName = "longhorn-webhook-tls"
)
View Source
const (
	BackingImageDataSourcePodNamePrefix = "backing-image-ds-"
)
View Source
const (
	KubernetesMinVersion = "v1.18.0"
)

Variables

View Source
var (
	SettingDefinitionBackupTarget = SettingDefinition{
		DisplayName: "Backup Target",
		Description: "The endpoint used to access the backupstore. NFS, CIFS and S3 are supported.",
		Category:    SettingCategoryBackup,
		Type:        SettingTypeString,
		Required:    false,
		ReadOnly:    false,
	}

	SettingDefinitionBackupTargetCredentialSecret = SettingDefinition{
		DisplayName: "Backup Target Credential Secret",
		Description: "The name of the Kubernetes secret associated with the backup target.",
		Category:    SettingCategoryBackup,
		Type:        SettingTypeString,
		Required:    false,
		ReadOnly:    false,
	}

	SettingDefinitionAllowRecurringJobWhileVolumeDetached = SettingDefinition{
		DisplayName: "Allow Recurring Job While Volume Is Detached",
		Description: "If this setting is enabled, Longhorn will automatically attaches the volume and takes snapshot/backup when it is the time to do recurring snapshot/backup. \n\n" +
			"Note that the volume is not ready for workload during the period when the volume was automatically attached. " +
			"Workload will have to wait until the recurring job finishes.",
		Category: SettingCategoryBackup,
		Type:     SettingTypeBool,
		Required: true,
		ReadOnly: false,
		Default:  "false",
	}

	SettingDefinitionBackupstorePollInterval = SettingDefinition{
		DisplayName: "Backupstore Poll Interval",
		Description: "In seconds. The backupstore poll interval determines how often Longhorn checks the backupstore for new backups. Set to 0 to disable the polling.",
		Category:    SettingCategoryBackup,
		Type:        SettingTypeInt,
		Required:    true,
		ReadOnly:    false,
		Default:     "300",
	}

	SettingDefinitionFailedBackupTTL = SettingDefinition{
		DisplayName: "Failed Backup Time to Live",
		Description: "In minutes. This setting determines how long Longhorn will keep the backup resource that was failed. Set to 0 to disable the auto-deletion.\n" +
			"Failed backups will be checked and cleaned up during backupstore polling which is controlled by **Backupstore Poll Interval** setting.\n" +
			"Hence this value determines the minimal wait interval of the cleanup. And the actual cleanup interval is multiple of **Backupstore Poll Interval**.\n" +
			"Disabling **Backupstore Poll Interval** also means to disable failed backup auto-deletion.\n\n",
		Category: SettingCategoryBackup,
		Type:     SettingTypeInt,
		Required: true,
		ReadOnly: false,
		Default:  "1440",
	}

	SettingDefinitionRestoreVolumeRecurringJobs = SettingDefinition{
		DisplayName: "Restore Volume Recurring Jobs",
		Description: "Restore recurring jobs from the backup volume on the backup target and create recurring jobs if not exist during a backup restoration.\n\n" +
			"Longhorn also supports individual volume setting. The setting can be specified on Backup page when making a backup restoration, this overrules the global setting.\n\n" +
			"The available volume setting options are: \n\n" +
			"- **ignored**. This is the default option that instructs Longhorn to inherit from the global setting.\n" +
			"- **enabled**. This option instructs Longhorn to restore recurring jobs/groups from the backup target forcibly.\n" +
			"- **disabled**. This option instructs Longhorn no restoring recurring jobs/groups should be done.\n",
		Category: SettingCategoryBackup,
		Type:     SettingTypeBool,
		Required: true,
		ReadOnly: false,
		Default:  "false",
	}

	SettingDefinitionCreateDefaultDiskLabeledNodes = SettingDefinition{
		DisplayName: "Create Default Disk on Labeled Nodes",
		Description: "Create default Disk automatically only on Nodes with the label " +
			"\"node.longhorn.io/create-default-disk=true\" if no other disks exist. If disabled, the default disk will " +
			"be created on all new nodes when each node is first added.",
		Category: SettingCategoryGeneral,
		Type:     SettingTypeBool,
		Required: true,
		ReadOnly: false,
		Default:  "false",
	}

	SettingDefinitionDefaultDataPath = SettingDefinition{
		DisplayName: "Default Data Path",
		Description: "Default path to use for storing data on a host",
		Category:    SettingCategoryGeneral,
		Type:        SettingTypeString,
		Required:    true,
		ReadOnly:    false,
		Default:     "/var/lib/longhorn/",
	}

	SettingDefinitionDefaultEngineImage = SettingDefinition{
		DisplayName: "Default Engine Image",
		Description: "The default engine image used by the manager. Can be changed on the manager starting command line only",
		Category:    SettingCategoryGeneral,
		Type:        SettingTypeString,
		Required:    true,
		ReadOnly:    true,
	}

	SettingDefinitionDefaultInstanceManagerImage = SettingDefinition{
		DisplayName: "Default Instance Manager Image",
		Description: "The default instance manager image used by the manager. Can be changed on the manager starting command line only",
		Category:    SettingCategoryGeneral,
		Type:        SettingTypeDeprecated,
		Required:    true,
		ReadOnly:    true,
	}

	SettingDefinitionDefaultBackingImageManagerImage = SettingDefinition{
		DisplayName: "Default Backing Image Manager Image",
		Description: "The default backing image manager image used by the manager. Can be changed on the manager starting command line only",
		Category:    SettingCategoryGeneral,
		Type:        SettingTypeDeprecated,
		Required:    true,
		ReadOnly:    true,
	}

	SettingDefinitionSupportBundleManagerImage = SettingDefinition{
		DisplayName: "Support Bundle Manager Image",
		Description: "The support bundle manager image for the support bundle generation.",
		Category:    SettingCategoryGeneral,
		Type:        SettingTypeString,
		Required:    true,
		ReadOnly:    false,
	}

	SettingDefinitionReplicaSoftAntiAffinity = SettingDefinition{
		DisplayName: "Replica Node Level Soft Anti-Affinity",
		Description: "Allow scheduling on nodes with existing healthy replicas of the same volume",
		Category:    SettingCategoryScheduling,
		Type:        SettingTypeBool,
		Required:    true,
		ReadOnly:    false,
		Default:     "false",
	}

	SettingDefinitionReplicaAutoBalance = SettingDefinition{
		DisplayName: "Replica Auto Balance",
		Description: "Enable this setting automatically rebalances replicas when discovered an available node.\n\n" +
			"The available global options are: \n\n" +
			"- **disabled**. This is the default option. No replica auto-balance will be done.\n" +
			"- **least-effort**. This option instructs Longhorn to balance replicas for minimal redundancy.\n" +
			"- **best-effort**. This option instructs Longhorn to balance replicas for even redundancy.\n\n" +
			"Longhorn also support individual volume setting. The setting can be specified on Volume page, this overrules the global setting.\n\n" +
			"The available volume setting options are: \n\n" +
			"- **ignored**. This is the default option that instructs Longhorn to inherit from the global setting.\n" +
			"- **disabled**. This option instructs Longhorn no replica auto-balance should be done.\n" +
			"- **least-effort**. This option instructs Longhorn to balance replicas for minimal redundancy.\n" +
			"- **best-effort**. This option instructs Longhorn to balance replicas for even redundancy.\n",
		Category: SettingCategoryScheduling,
		Type:     SettingTypeString,
		Required: true,
		ReadOnly: false,
		Default:  string(longhorn.ReplicaAutoBalanceDisabled),
		Choices: []string{
			string(longhorn.ReplicaAutoBalanceDisabled),
			string(longhorn.ReplicaAutoBalanceLeastEffort),
			string(longhorn.ReplicaAutoBalanceBestEffort),
		},
	}

	SettingDefinitionStorageOverProvisioningPercentage = SettingDefinition{
		DisplayName: "Storage Over Provisioning Percentage",
		Description: "The over-provisioning percentage defines how much storage can be allocated relative to the hard drive's capacity",
		Category:    SettingCategoryScheduling,
		Type:        SettingTypeInt,
		Required:    true,
		ReadOnly:    false,
		Default:     "100",
	}

	SettingDefinitionStorageMinimalAvailablePercentage = SettingDefinition{
		DisplayName: "Storage Minimal Available Percentage",
		Description: "If the minimum available disk capacity exceeds the actual percentage of available disk capacity, the disk becomes unschedulable until more space is freed up.",
		Category:    SettingCategoryScheduling,
		Type:        SettingTypeInt,
		Required:    true,
		ReadOnly:    false,
		Default:     "25",
	}

	SettingDefinitionStorageReservedPercentageForDefaultDisk = SettingDefinition{
		DisplayName: "Storage Reserved Percentage For Default Disk",
		Description: "The reserved percentage specifies the percentage of disk space that will not be allocated to the default disk on each new Longhorn node",
		Category:    SettingCategoryScheduling,
		Type:        SettingTypeInt,
		Required:    true,
		ReadOnly:    false,
		Default:     "30",
	}

	SettingDefinitionUpgradeChecker = SettingDefinition{
		DisplayName: "Enable Upgrade Checker",
		Description: "Upgrade Checker will check for new Longhorn version periodically. When there is a new version available, a notification will appear in the UI",
		Category:    SettingCategoryGeneral,
		Type:        SettingTypeBool,
		Required:    true,
		ReadOnly:    false,
		Default:     "true",
	}

	SettingDefinitionAllowCollectingLonghornUsageMetrics = SettingDefinition{
		DisplayName: "Allow Collecting Longhorn Usage Metrics",
		Description: "Enabling this setting will allow Longhorn to provide additional usage metrics to https://metrics.longhorn.io/.\n" +
			"This information will help us better understand how Longhorn is being used, which will ultimately contribute to future improvements.\n",
		Category: SettingCategoryGeneral,
		Type:     SettingTypeBool,
		Required: true,
		ReadOnly: false,
		Default:  "true",
	}

	SettingDefinitionCurrentLonghornVersion = SettingDefinition{
		DisplayName: "Current Longhorn Version",
		Description: "The current Longhorn version.",
		Category:    SettingCategoryGeneral,
		Type:        SettingTypeString,
		Required:    false,
		ReadOnly:    true,
		Default:     meta.Version,
	}

	SettingDefinitionLatestLonghornVersion = SettingDefinition{
		DisplayName: "Latest Longhorn Version",
		Description: "The latest version of Longhorn available. Updated by Upgrade Checker automatically",
		Category:    SettingCategoryGeneral,
		Type:        SettingTypeString,
		Required:    false,
		ReadOnly:    true,
	}

	SettingDefinitionStableLonghornVersions = SettingDefinition{
		DisplayName: "Stable Longhorn Versions",
		Description: "The latest stable version of every minor release line. Updated by Upgrade Checker automatically",
		Category:    SettingCategoryGeneral,
		Type:        SettingTypeString,
		Required:    false,
		ReadOnly:    true,
	}

	SettingDefinitionDefaultReplicaCount = SettingDefinition{
		DisplayName: "Default Replica Count",
		Description: "The default number of replicas when a volume is created from the Longhorn UI. For Kubernetes configuration, update the `numberOfReplicas` in the StorageClass",
		Category:    SettingCategoryGeneral,
		Type:        SettingTypeInt,
		Required:    true,
		ReadOnly:    false,
		Default:     "3",
	}

	SettingDefinitionDefaultDataLocality = SettingDefinition{
		DisplayName: "Default Data Locality",
		Description: "We say a Longhorn volume has data locality if there is a local replica of the volume on the same node as the pod which is using the volume.\n\n" +
			"This setting specifies the default data locality when a volume is created from the Longhorn UI. For Kubernetes configuration, update the `dataLocality` in the StorageClass\n\n" +
			"The available modes are: \n\n" +
			"- **disabled**. This is the default option. There may or may not be a replica on the same node as the attached volume (workload)\n" +
			"- **best-effort**. This option instructs Longhorn to try to keep a replica on the same node as the attached volume (workload). Longhorn will not stop the volume, even if it cannot keep a replica local to the attached volume (workload) due to environment limitation, e.g. not enough disk space, incompatible disk tags, etc.\n" +
			"- **strict-local**. This option enforces Longhorn keep the only one replica on the same node as the attached volume.\n",
		Category: SettingCategoryGeneral,
		Type:     SettingTypeString,
		Required: true,
		ReadOnly: false,
		Default:  string(longhorn.DataLocalityDisabled),
		Choices: []string{
			string(longhorn.DataLocalityDisabled),
			string(longhorn.DataLocalityBestEffort),
			string(longhorn.DataLocalityStrictLocal),
		},
	}

	SettingDefinitionDefaultLonghornStaticStorageClass = SettingDefinition{
		DisplayName: "Default Longhorn Static StorageClass Name",
		Description: "The 'storageClassName' is given to PVs and PVCs that are created for an existing Longhorn volume. The StorageClass name can also be used as a label, so it is possible to use a Longhorn StorageClass to bind a workload to an existing PV without creating a Kubernetes StorageClass object.",
		Category:    SettingCategoryGeneral,
		Type:        SettingTypeString,
		Required:    true,
		ReadOnly:    false,
		Default:     "longhorn-static",
	}

	SettingDefinitionTaintToleration = SettingDefinition{
		DisplayName: "Kubernetes Taint Toleration",
		Description: "If you want to dedicate nodes to just store Longhorn replicas and reject other general workloads, you can set tolerations for **all** Longhorn components and add taints to the nodes dedicated for storage. " +
			"Longhorn system contains user deployed components (e.g, Longhorn manager, Longhorn driver, Longhorn UI) and system managed components (e.g, instance manager, engine image, CSI driver, etc.) " +
			"This setting only sets taint tolerations for system managed components. " +
			"Depending on how you deployed Longhorn, you need to set taint tolerations for user deployed components in Helm chart or deployment YAML file. " +
			"All Longhorn volumes should be detached before modifying toleration settings. " +
			"We recommend setting tolerations during Longhorn deployment because the Longhorn system cannot be operated during the update. " +
			"Multiple tolerations can be set here, and these tolerations are separated by semicolon. For example: \n\n" +
			"* `key1=value1:NoSchedule; key2:NoExecute` \n\n" +
			"* `:` this toleration tolerates everything because an empty key with operator `Exists` matches all keys, values and effects \n\n" +
			"* `key1=value1:`  this toleration has empty effect. It matches all effects with key `key1` \n\n" +
			"Because `kubernetes.io` is used as the key of all Kubernetes default tolerations, it should not be used in the toleration settings.\n\n",
		Category: SettingCategoryDangerZone,
		Type:     SettingTypeString,
		Required: false,
		ReadOnly: false,
	}

	SettingDefinitionSystemManagedComponentsNodeSelector = SettingDefinition{
		DisplayName: "System Managed Components Node Selector",
		Description: "If you want to restrict Longhorn components to only run on particular set of nodes, you can set node selector for **all** Longhorn components. " +
			"Longhorn system contains user deployed components (e.g, Longhorn manager, Longhorn driver, Longhorn UI) and system managed components (e.g, instance manager, engine image, CSI driver, etc.) " +
			"You must follow the below order when set the node selector:\n\n" +
			"1. Set node selector for user deployed components in Helm chart or deployment YAML file depending on how you deployed Longhorn.\n\n" +
			"2. Set node selector for system managed components in here.\n\n" +
			"All Longhorn volumes should be detached before modifying node selector settings. " +
			"We recommend setting node selector during Longhorn deployment because the Longhorn system cannot be operated during the update. " +
			"Multiple label key-value pairs are separated by semicolon. For example: \n\n" +
			"* `label-key1=label-value1; label-key2=label-value2` \n\n" +
			"Please see the documentation at https://longhorn.io for more detailed instructions about changing node selector",
		Category: SettingCategoryDangerZone,
		Type:     SettingTypeString,
		Required: false,
		ReadOnly: false,
	}

	SettingDefinitionCRDAPIVersion = SettingDefinition{
		DisplayName: "Custom Resource API Version",
		Description: "The current customer resource's API version, e.g. longhorn.io/v1beta2. Set by manager automatically",
		Category:    SettingCategoryGeneral,
		Type:        SettingTypeString,
		Required:    true,
		ReadOnly:    true,
	}

	SettingDefinitionAutoSalvage = SettingDefinition{
		DisplayName: "Automatic salvage",
		Description: "If enabled, volumes will be automatically salvaged when all the replicas become faulty e.g. due to network disconnection. Longhorn will try to figure out which replica(s) are usable, then use them for the volume.",
		Category:    SettingCategoryGeneral,
		Type:        SettingTypeBool,
		Required:    true,
		ReadOnly:    false,
		Default:     "true",
	}

	SettingDefinitionAutoDeletePodWhenVolumeDetachedUnexpectedly = SettingDefinition{
		DisplayName: "Automatically Delete Workload Pod when The Volume Is Detached Unexpectedly",
		Description: "If enabled, Longhorn will automatically delete the workload pod that is managed by a controller (e.g. deployment, statefulset, daemonset, etc...) when Longhorn volume is detached unexpectedly (e.g. during Kubernetes upgrade, Docker reboot, or network disconnect). " +
			"By deleting the pod, its controller restarts the pod and Kubernetes handles volume reattachment and remount. \n\n" +
			"If disabled, Longhorn will not delete the workload pod that is managed by a controller. You will have to manually restart the pod to reattach and remount the volume. \n\n" +
			"**Note:** This setting doesn't apply to the workload pods that don't have a controller. Longhorn never deletes them.",
		Category: SettingCategoryGeneral,
		Type:     SettingTypeBool,
		Required: true,
		ReadOnly: false,
		Default:  "true",
	}

	SettingDefinitionRegistrySecret = SettingDefinition{
		DisplayName: "Registry secret",
		Description: "The Kubernetes Secret name",
		Category:    SettingCategoryGeneral,
		Type:        SettingTypeString,
		Required:    false,
		ReadOnly:    false,
		Default:     "",
	}

	SettingDefinitionDisableSchedulingOnCordonedNode = SettingDefinition{
		DisplayName: "Disable Scheduling On Cordoned Node",
		Description: `Disable Longhorn manager to schedule replica on Kubernetes cordoned node`,
		Category:    SettingCategoryScheduling,
		Type:        SettingTypeBool,
		Required:    true,
		ReadOnly:    false,
		Default:     "true",
	}

	SettingDefinitionReplicaZoneSoftAntiAffinity = SettingDefinition{
		DisplayName: "Replica Zone Level Soft Anti-Affinity",
		Description: "Allow scheduling new Replicas of Volume to the Nodes in the same Zone as existing healthy Replicas. Nodes don't belong to any Zone will be treated as in the same Zone. Notice that Longhorn relies on label `topology.kubernetes.io/zone=<Zone name of the node>` in the Kubernetes node object to identify the zone.",
		Category:    SettingCategoryScheduling,
		Type:        SettingTypeBool,
		Required:    true,
		ReadOnly:    false,
		Default:     "true",
	}

	SettingDefinitionNodeDownPodDeletionPolicy = SettingDefinition{
		DisplayName: "Pod Deletion Policy When Node is Down",
		Description: "Defines the Longhorn action when a Volume is stuck with a StatefulSet/Deployment Pod on a node that is down.\n" +
			"- **do-nothing** is the default Kubernetes behavior of never force deleting StatefulSet/Deployment terminating pods. Since the pod on the node that is down isn't removed, Longhorn volumes are stuck on nodes that are down.\n" +
			"- **delete-statefulset-pod** Longhorn will force delete StatefulSet terminating pods on nodes that are down to release Longhorn volumes so that Kubernetes can spin up replacement pods.\n" +
			"- **delete-deployment-pod** Longhorn will force delete Deployment terminating pods on nodes that are down to release Longhorn volumes so that Kubernetes can spin up replacement pods.\n" +
			"- **delete-both-statefulset-and-deployment-pod** Longhorn will force delete StatefulSet/Deployment terminating pods on nodes that are down to release Longhorn volumes so that Kubernetes can spin up replacement pods.\n",
		Category: SettingCategoryGeneral,
		Type:     SettingTypeString,
		Required: true,
		ReadOnly: false,
		Default:  string(NodeDownPodDeletionPolicyDoNothing),
		Choices: []string{
			string(NodeDownPodDeletionPolicyDoNothing),
			string(NodeDownPodDeletionPolicyDeleteStatefulSetPod),
			string(NodeDownPodDeletionPolicyDeleteDeploymentPod),
			string(NodeDownPodDeletionPolicyDeleteBothStatefulsetAndDeploymentPod),
		},
	}

	SettingDefinitionNodeDrainPolicy = SettingDefinition{
		DisplayName: "Node Drain Policy",
		Description: "Define the policy to use when a node with the last healthy replica of a volume is drained.\n" +
			"- **block-for-eviction** Longhorn will automatically evict all replicas and block the drain until eviction is complete.\n" +
			"- **block-for-eviction-if-contains-last-replica** Longhorn will automatically evict any replicas that don't have a healthy counterpart and block the drain until eviction is complete.\n" +
			"- **block-if-contains-last-replica** Longhorn will block the drain when the node contains the last healthy replica of a volume.\n" +
			"- **allow-if-replica-is-stopped** Longhorn will allow the drain when the node contains the last healthy replica of a volume but the replica is stopped. WARNING: possible data loss if the node is removed after draining. Select this option if you want to drain the node and do in-place upgrade/maintenance.\n" +
			"- **always-allow** Longhorn will allow the drain even though the node contains the last healthy replica of a volume. WARNING: possible data loss if the node is removed after draining. Also possible data corruption if the last replica was running during the draining.\n",
		Category: SettingCategoryGeneral,
		Type:     SettingTypeString,
		Required: true,
		ReadOnly: false,
		Default:  string(NodeDrainPolicyBlockIfContainsLastReplica),
		Choices: []string{
			string(NodeDrainPolicyBlockForEviction),
			string(NodeDrainPolicyBlockForEvictionIfContainsLastReplica),
			string(NodeDrainPolicyBlockIfContainsLastReplica),
			string(NodeDrainPolicyAllowIfReplicaIsStopped),
			string(NodeDrainPolicyAlwaysAllow),
		},
	}

	SettingDefinitionDetachManuallyAttachedVolumesWhenCordoned = SettingDefinition{
		DisplayName: "Detach Manually Attached Volumes When Cordoned",
		Description: "Automatically detach volumes that are attached manually when node is cordoned.",
		Category:    SettingCategoryGeneral,
		Type:        SettingTypeBool,
		Required:    true,
		ReadOnly:    false,
		Default:     "false",
	}

	SettingDefinitionPriorityClass = SettingDefinition{
		DisplayName: "Priority Class",
		Description: "The name of the Priority Class to set on the Longhorn components. This can help prevent Longhorn components from being evicted under Node Pressure. \n" +
			"Longhorn system contains user deployed components (e.g, Longhorn manager, Longhorn driver, Longhorn UI) and system managed components (e.g, instance manager, engine image, CSI driver, etc.) " +
			"Note that this setting only sets Priority Class for system managed components. " +
			"Depending on how you deployed Longhorn, you need to set Priority Class for user deployed components in Helm chart or deployment YAML file. \n",
		Category: SettingCategoryDangerZone,
		Required: false,
		ReadOnly: false,
	}

	SettingDefinitionDisableRevisionCounter = SettingDefinition{
		DisplayName: "Disable Revision Counter",
		Description: "This setting is only for volumes created by UI. By default, this is false meaning there will be a revision counter file to track every write to the volume. During salvage recovering Longhorn will pick the repica with largest revision counter as candidate to recover the whole volume. If revision counter is disabled, Longhorn will not track every write to the volume. During the salvage recovering, Longhorn will use the 'volume-head-xxx.img' file last modification time and file size to pick the replica candidate to recover the whole volume.",
		Category:    SettingCategoryGeneral,
		Type:        SettingTypeBool,
		Required:    true,
		ReadOnly:    false,
		Default:     "false",
	}

	SettingDefinitionReplicaReplenishmentWaitInterval = SettingDefinition{
		DisplayName: "Replica Replenishment Wait Interval",
		Description: "In seconds. The interval determines how long Longhorn will wait at least in order to reuse the existing data on a failed replica rather than directly creating a new replica for a degraded volume.\n" +
			"Warning: This option works only when there is a failed replica in the volume. And this option may block the rebuilding for a while in the case.",
		Category: SettingCategoryGeneral,
		Type:     SettingTypeInt,
		Required: true,
		ReadOnly: false,
		Default:  "600",
	}

	SettingDefinitionConcurrentReplicaRebuildPerNodeLimit = SettingDefinition{
		DisplayName: "Concurrent Replica Rebuild Per Node Limit",
		Description: "This setting controls how many replicas on a node can be rebuilt simultaneously. \n\n" +
			"Typically, Longhorn can block the replica starting once the current rebuilding count on a node exceeds the limit. But when the value is 0, it means disabling the replica rebuilding. \n\n" +
			"WARNING: \n\n" +
			"  - The old setting \"Disable Replica Rebuild\" is replaced by this setting. \n\n" +
			"  - Different from relying on replica starting delay to limit the concurrent rebuilding, if the rebuilding is disabled, replica object replenishment will be directly skipped. \n\n" +
			"  - When the value is 0, the eviction and data locality feature won't work. But this shouldn't have any impact to any current replica rebuild and backup restore.",
		Category: SettingCategoryDangerZone,
		Type:     SettingTypeInt,
		Required: true,
		ReadOnly: false,
		Default:  "5",
	}

	SettingDefinitionConcurrentVolumeBackupRestorePerNodeLimit = SettingDefinition{
		DisplayName: "Concurrent Volume Backup Restore Per Node Limit",
		Description: "This setting controls how many volumes on a node can restore the backup concurrently.\n\n" +
			"Longhorn blocks the backup restore once the restoring volume count exceeds the limit.\n\n" +
			"Set the value to **0** to disable backup restore.\n\n",
		Category: SettingCategoryGeneral,
		Type:     SettingTypeInt,
		Required: true,
		ReadOnly: false,
		Default:  "5",
	}

	SettingDefinitionSystemManagedPodsImagePullPolicy = SettingDefinition{
		DisplayName: "System Managed Pod Image Pull Policy",
		Description: "This setting defines the Image Pull Policy of Longhorn system managed pods, e.g. instance manager, engine image, CSI driver, etc. " +
			"The new Image Pull Policy will only apply after the system managed pods restart.",
		Category: SettingCategoryGeneral,
		Type:     SettingTypeString,
		Required: true,
		ReadOnly: false,
		Default:  string(SystemManagedPodsImagePullPolicyIfNotPresent),
		Choices: []string{
			string(SystemManagedPodsImagePullPolicyIfNotPresent),
			string(SystemManagedPodsImagePullPolicyNever),
			string(SystemManagedPodsImagePullPolicyAlways),
		},
	}

	SettingDefinitionAllowVolumeCreationWithDegradedAvailability = SettingDefinition{
		DisplayName: "Allow Volume Creation with Degraded Availability",
		Description: "This setting allows user to create and attach a volume that doesn't have all the replicas scheduled at the time of creation.",
		Category:    SettingCategoryScheduling,
		Type:        SettingTypeBool,
		Required:    true,
		ReadOnly:    false,
		Default:     "true",
	}

	SettingDefinitionAutoCleanupSystemGeneratedSnapshot = SettingDefinition{
		DisplayName: "Automatically Cleanup System Generated Snapshot",
		Description: "This setting enables Longhorn to automatically cleanup the system generated snapshot before and after replica rebuilding.",
		Category:    SettingCategorySnapshot,
		Type:        SettingTypeBool,
		Required:    true,
		ReadOnly:    false,
		Default:     "true",
	}

	SettingDefinitionAutoCleanupRecurringJobBackupSnapshot = SettingDefinition{
		DisplayName: "Automatically Cleanup Recurring Job Backup Snapshot",
		Description: "This setting enables Longhorn to automatically cleanup the snapshot generated by a recurring backup job.",
		Category:    SettingCategorySnapshot,
		Type:        SettingTypeBool,
		Required:    true,
		ReadOnly:    false,
		Default:     "true",
	}

	SettingDefinitionConcurrentAutomaticEngineUpgradePerNodeLimit = SettingDefinition{
		DisplayName: "Concurrent Automatic Engine Upgrade Per Node Limit",
		Description: "This setting controls how Longhorn automatically upgrades volumes' engines after upgrading Longhorn manager. " +
			"The value of this setting specifies the maximum number of engines per node that are allowed to upgrade to the default engine image at the same time. " +
			"If the value is 0, Longhorn will not automatically upgrade volumes' engines to default version.",
		Category: SettingCategoryGeneral,
		Type:     SettingTypeInt,
		Required: true,
		ReadOnly: false,
		Default:  "0",
	}

	SettingDefinitionBackingImageCleanupWaitInterval = SettingDefinition{
		DisplayName: "Backing Image Cleanup Wait Interval",
		Description: "In minutes. The interval determines how long Longhorn will wait before cleaning up the backing image file when there is no replica in the disk using it.",
		Category:    SettingCategoryGeneral,
		Type:        SettingTypeInt,
		Required:    true,
		ReadOnly:    false,
		Default:     "60",
	}

	SettingDefinitionBackingImageRecoveryWaitInterval = SettingDefinition{
		DisplayName: "Backing Image Recovery Wait Interval",
		Description: "In seconds. The interval determines how long Longhorn will wait before re-downloading the backing image file when all disk files of this backing image become failed or unknown. \n\n" +
			"WARNING: \n\n" +
			"  - This recovery only works for the backing image of which the creation type is \"download\". \n\n" +
			"  - File state \"unknown\" means the related manager pods on the pod is not running or the node itself is down/disconnected.",
		Category: SettingCategoryGeneral,
		Type:     SettingTypeInt,
		Required: true,
		ReadOnly: false,
		Default:  "300",
	}

	SettingDefinitionGuaranteedInstanceManagerCPU = SettingDefinition{
		DisplayName: "Guaranteed Instance Manager CPU for V1 Data Engine",
		Description: "Percentage of the total allocatable CPU resources on each node to be reserved for each instance manager pod when the V1 Data Engine is enabled. For example, 10 means 10% of the total CPU on a node will be allocated to each instance manager pod on this node. This will help maintain engine and replica stability during high node workload. \n\n" +
			"In order to prevent unexpected volume instance (engine/replica) crash as well as guarantee a relative acceptable IO performance, you can use the following formula to calculate a value for this setting: \n\n" +
			"`Guaranteed Instance Manager CPU = The estimated max Longhorn volume engine and replica count on a node * 0.1 / The total allocatable CPUs on the node * 100` \n\n" +
			"The result of above calculation doesn't mean that's the maximum CPU resources the Longhorn workloads require. To fully exploit the Longhorn volume I/O performance, you can allocate/guarantee more CPU resources via this setting. \n\n" +
			"If it's hard to estimate the usage now, you can leave it with the default value, which is 12%. Then you can tune it when there is no running workload using Longhorn volumes. \n\n" +
			"WARNING: \n\n" +
			"  - Value 0 means unsetting CPU requests for instance manager pods. \n\n" +
			"  - Considering the possible new instance manager pods in the further system upgrade, this integer value is range from 0 to 40. \n\n" +
			"  - One more set of instance manager pods may need to be deployed when the Longhorn system is upgraded. If current available CPUs of the nodes are not enough for the new instance manager pods, you need to detach the volumes using the oldest instance manager pods so that Longhorn can clean up the old pods automatically and release the CPU resources. And the new pods with the latest instance manager image will be launched then. \n\n" +
			"  - This global setting will be ignored for a node if the field \"InstanceManagerCPURequest\" on the node is set. \n\n" +
			"  - After this setting is changed, the v1 instance manager pod using this global setting will be automatically restarted without instances running on the v1 instance manager. \n\n",
		Category: SettingCategoryDangerZone,
		Type:     SettingTypeInt,
		Required: true,
		ReadOnly: false,
		Default:  "12",
	}

	SettingDefinitionKubernetesClusterAutoscalerEnabled = SettingDefinition{
		DisplayName: "Kubernetes Cluster Autoscaler Enabled (Experimental)",
		Description: "Setting that notifies Longhorn that the cluster is using the Kubernetes Cluster Autoscaler. \n\n" +
			"Longhorn prevents data loss by only allowing the Cluster Autoscaler to scale down a node that met all conditions: \n\n" +
			"  - No volume attached to the node \n\n" +
			"  - Is not the last node containing the replica of any volume. \n\n" +
			"  - Is not running backing image components pod. \n\n" +
			"  - Is not running share manager components pod. \n\n",
		Category: SettingCategoryGeneral,
		Type:     SettingTypeBool,
		Required: true,
		ReadOnly: false,
		Default:  "false",
	}

	SettingDefinitionOrphanAutoDeletion = SettingDefinition{
		DisplayName: "Orphan Auto-Deletion",
		Description: "This setting allows Longhorn to delete the orphan resource and its corresponding orphaned data automatically. \n\n" +
			"Orphan resources on down or unknown nodes will not be cleaned up automatically. \n\n",
		Category: SettingCategoryOrphan,
		Type:     SettingTypeBool,
		Required: true,
		ReadOnly: false,
		Default:  "false",
	}

	SettingDefinitionStorageNetwork = SettingDefinition{
		DisplayName: "Storage Network",
		Description: "Longhorn uses the storage network for in-cluster data traffic. Leave this blank to use the Kubernetes cluster network. \n\n" +
			"To segregate the storage network, input the pre-existing NetworkAttachmentDefinition in **<namespace>/<name>** format. \n\n" +
			"WARNING: \n\n" +
			"  - The cluster must have pre-existing Multus installed, and NetworkAttachmentDefinition IPs are reachable between nodes. \n\n" +
			"  - When applying the setting, Longhorn will try to restart all instance-manager, and backing-image-manager pods if all volumes are detached and eventually restart the instance manager pod without instances running on the instance manager. \n\n",
		Category: SettingCategoryDangerZone,
		Type:     SettingTypeString,
		Required: false,
		ReadOnly: false,
		Default:  CniNetworkNone,
	}

	SettingDefinitionRecurringSuccessfulJobsHistoryLimit = SettingDefinition{
		DisplayName: "Cronjob Successful Jobs History Limit",
		Description: "This setting specifies how many successful backup or snapshot job histories should be retained. \n\n" +
			"History will not be retained if the value is 0.",
		Category: SettingCategoryBackup,
		Type:     SettingTypeInt,
		Required: false,
		ReadOnly: false,
		Default:  "1",
	}

	SettingDefinitionRecurringFailedJobsHistoryLimit = SettingDefinition{
		DisplayName: "Cronjob Failed Jobs History Limit",
		Description: "This setting specifies how many failed backup or snapshot job histories should be retained.\n\n" +
			"History will not be retained if the value is 0.",
		Category: SettingCategoryBackup,
		Type:     SettingTypeInt,
		Required: false,
		ReadOnly: false,
		Default:  "1",
	}

	SettingDefinitionRecurringJobMaxRetention = SettingDefinition{
		DisplayName: "Maximum Retention Number for Recurring Job",
		Description: "This setting specifies how many snapshots or backups should be retained.",
		Category:    SettingCategoryBackup,
		Type:        SettingTypeInt,
		Required:    true,
		ReadOnly:    false,
		Default:     "100",
	}

	SettingDefinitionSupportBundleFailedHistoryLimit = SettingDefinition{
		DisplayName: "SupportBundle Failed History Limit",
		Description: "This setting specifies how many failed support bundles can exist in the cluster.\n\n" +
			"The retained failed support bundle is for analysis purposes and needs to clean up manually.\n\n" +
			"Set this value to **0** to have Longhorn automatically purge all failed support bundles.\n\n",
		Category: SettingCategoryGeneral,
		Type:     SettingTypeInt,
		Required: false,
		ReadOnly: false,
		Default:  "1",
	}

	SettingDefinitionSupportBundleNodeCollectionTimeout = SettingDefinition{
		DisplayName: "Timeout for Support Bundle Node Collection",
		Description: "In minutes. The timeout for collecting node bundles for support bundle generation. The default value is 30.\n\n" +
			"When the timeout is reached, the support bundle generation will proceed without requiring the collection of node bundles. \n\n",
		Category: SettingCategoryGeneral,
		Type:     SettingTypeInt,
		Required: true,
		ReadOnly: false,
		Default:  "30",
	}

	SettingDefinitionDeletingConfirmationFlag = SettingDefinition{
		DisplayName: "Deleting Confirmation Flag",
		Description: "This flag is designed to prevent Longhorn from being accidentally uninstalled which will lead to data lost. \n\n" +
			"Set this flag to **true** to allow Longhorn uninstallation. " +
			"If this flag **false**, Longhorn uninstallation job will fail.",
		Category: SettingCategoryGeneral,
		Type:     SettingTypeBool,
		Required: true,
		ReadOnly: false,
		Default:  "false",
	}

	SettingDefinitionEngineReplicaTimeout = SettingDefinition{
		DisplayName: "Timeout between Engine and Replica",
		Description: "In seconds. The setting specifies the timeout between the engine and replica(s), and the value should be between 8 to 30 seconds. The default value is 8 seconds.",
		Category:    SettingCategoryGeneral,
		Type:        SettingTypeInt,
		Required:    true,
		ReadOnly:    false,
		Default:     "8",
	}

	SettingDefinitionSnapshotDataIntegrity = SettingDefinition{
		DisplayName: "Snapshot Data Integrity",
		Description: "This setting allows users to enable or disable snapshot hashing and data integrity checking. \n\n" +
			"Available options are: \n\n" +
			"- **disabled**: Disable snapshot disk file hashing and data integrity checking. \n\n" +
			"- **enabled**: Enables periodic snapshot disk file hashing and data integrity checking. To detect the filesystem-unaware corruption caused by bit rot or other issues in snapshot disk files, Longhorn system periodically hashes files and finds corrupted ones. Hence, the system performance will be impacted during the periodical checking. \n\n" +
			"- **fast-check**: Enable snapshot disk file hashing and fast data integrity checking. Longhorn system only hashes snapshot disk files if their are not hashed or the modification time are changed. In this mode, filesystem-unaware corruption cannot be detected, but the impact on system performance can be minimized.",
		Category: SettingCategorySnapshot,
		Type:     SettingTypeString,
		Required: true,
		ReadOnly: false,
		Default:  string(longhorn.SnapshotDataIntegrityFastCheck),
		Choices: []string{
			string(longhorn.SnapshotDataIntegrityDisabled),
			string(longhorn.SnapshotDataIntegrityEnabled),
			string(longhorn.SnapshotDataIntegrityFastCheck),
		},
	}

	SettingDefinitionSnapshotDataIntegrityImmediateCheckAfterSnapshotCreation = SettingDefinition{
		DisplayName: "Immediate Snapshot Data Integrity Check After Creating a Snapshot",
		Description: "Hashing snapshot disk files impacts the performance of the system. The immediate snapshot hashing and checking can be disabled to minimize the impact after creating a snapshot.",
		Category:    SettingCategorySnapshot,
		Type:        SettingTypeBool,
		Required:    true,
		ReadOnly:    false,
		Default:     "false",
	}

	SettingDefinitionSnapshotDataIntegrityCronJob = SettingDefinition{
		DisplayName: "Snapshot Data Integrity Check CronJob",
		Description: "Unix-cron string format. The setting specifies when Longhorn checks the data integrity of snapshot disk files. \n\n" +
			"Warning: Hashing snapshot disk files impacts the performance of the system. It is recommended to run data integrity checks during off-peak times and to reduce the frequency of checks.",
		Category: SettingCategorySnapshot,
		Type:     SettingTypeString,
		Required: true,
		ReadOnly: false,
		Default:  "0 0 */7 * *",
	}

	SettingDefinitionSnapshotMaxCount = SettingDefinition{
		DisplayName: "Snapshot Maximum Count",
		Description: "Maximum snapshot count for a volume. The value should be between 2 to 250",
		Category:    SettingCategorySnapshot,
		Type:        SettingTypeInt,
		Required:    true,
		ReadOnly:    false,
		Default:     strconv.Itoa(MaxSnapshotNum),
	}

	SettingDefinitionRemoveSnapshotsDuringFilesystemTrim = SettingDefinition{
		DisplayName: "Remove Snapshots During Filesystem Trim",
		Description: "This setting allows Longhorn filesystem trim feature to automatically mark the latest snapshot and its ancestors as removed and stops at the snapshot containing multiple children.\n\n" +
			"Since Longhorn filesystem trim feature can be applied to the volume head and the followed continuous removed or system snapshots only, trying to trim a removed file from a valid snapshot will do nothing but the filesystem will discard this kind of in-memory trimmable file info. " +
			"Later on if you mark the snapshot as removed and want to retry the trim, you may need to unmount and remount the filesystem so that the filesystem can recollect the trimmable file info.",
		Category: SettingCategoryGeneral,
		Type:     SettingTypeBool,
		Required: true,
		ReadOnly: false,
		Default:  "false",
	}

	SettingDefinitionFastReplicaRebuildEnabled = SettingDefinition{
		DisplayName: "Fast Replica Rebuild Enabled",
		Description: "This setting enables the fast replica rebuilding feature. It relies on the checksums of snapshot disk files, so setting the snapshot-data-integrity to **enable** or **fast-check** is a prerequisite.",
		Category:    SettingCategoryGeneral,
		Type:        SettingTypeBool,
		Required:    true,
		ReadOnly:    false,
		Default:     "true",
	}

	SettingDefinitionReplicaFileSyncHTTPClientTimeout = SettingDefinition{
		DisplayName: "Timeout of HTTP Client to Replica File Sync Server",
		Description: "In seconds. The setting specifies the HTTP client timeout to the file sync server.",
		Category:    SettingCategoryGeneral,
		Type:        SettingTypeInt,
		Required:    true,
		ReadOnly:    false,
		Default:     "30",
	}

	SettingDefinitionBackupCompressionMethod = SettingDefinition{
		DisplayName: "Backup Compression Method",
		Description: "This setting allows users to specify backup compression method.\n\n" +
			"Available options are: \n\n" +
			"- **none**: Disable the compression method. Suitable for multimedia data such as encoded images and videos. \n\n" +
			"- **lz4**: Fast compression method. Suitable for flat files. \n\n" +
			"- **gzip**: A bit of higher compression ratio but relatively slow.",
		Category: SettingCategoryBackup,
		Type:     SettingTypeString,
		Required: true,
		ReadOnly: false,
		Default:  string(longhorn.BackupCompressionMethodLz4),
		Choices: []string{
			string(longhorn.BackupCompressionMethodNone),
			string(longhorn.BackupCompressionMethodLz4),
			string(longhorn.BackupCompressionMethodGzip),
		},
	}

	SettingDefinitionBackupConcurrentLimit = SettingDefinition{
		DisplayName: "Backup Concurrent Limit Per Backup",
		Description: "This setting controls how many worker threads per backup concurrently.",
		Category:    SettingCategoryBackup,
		Type:        SettingTypeInt,
		Required:    true,
		ReadOnly:    false,
		Default:     "2",
	}

	SettingDefinitionRestoreConcurrentLimit = SettingDefinition{
		DisplayName: "Restore Concurrent Limit Per Backup",
		Description: "This setting controls how many worker threads per restore concurrently.",
		Category:    SettingCategoryBackup,
		Type:        SettingTypeInt,
		Required:    true,
		ReadOnly:    false,
		Default:     "2",
	}

	SettingDefinitionLogLevel = SettingDefinition{
		DisplayName: "Log Level",
		Description: "The log level Panic, Fatal, Error, Warn, Info, Debug, Trace used in longhorn manager. By default Info.",
		Category:    SettingCategoryGeneral,
		Type:        SettingTypeString,
		Required:    true,
		ReadOnly:    false,
		Default:     "Info",
	}

	SettingDefinitionOfflineReplicaRebuilding = SettingDefinition{
		DisplayName: "Offline Replica Rebuilding",
		Description: "This setting allows users to enable the offline replica rebuilding for volumes using v2 data engine.",
		Category:    SettingCategoryV2DataEngine,
		Type:        SettingTypeString,
		Required:    true,
		ReadOnly:    false,
		Default:     string(longhorn.OfflineReplicaRebuildingEnabled),
		Choices: []string{
			string(longhorn.OfflineReplicaRebuildingEnabled),
			string(longhorn.OfflineReplicaRebuildingDisabled),
		},
	}

	SettingDefinitionV1DataEngine = SettingDefinition{
		DisplayName: "V1 Data Engine",
		Description: "Setting that allows you to enable the V1 Data Engine. \n\n" +
			"  - DO NOT CHANGE THIS SETTING WITH ATTACHED VOLUMES. Longhorn will block this setting update when there are attached v1 volumes. \n\n",
		Category: SettingCategoryDangerZone,
		Type:     SettingTypeBool,
		Required: true,
		ReadOnly: false,
		Default:  "true",
	}

	SettingDefinitionV2DataEngine = SettingDefinition{
		DisplayName: "V2 Data Engine",
		Description: "This setting allows users to activate v2 data engine which is based on SPDK. Currently, it is in the preview phase and should not be utilized in a production environment.\n\n" +
			"  - DO NOT CHANGE THIS SETTING WITH ATTACHED VOLUMES. Longhorn will block this setting update when there are attached v2 volumes. \n\n" +
			"  - When the V2 Data Engine is enabled, each instance-manager pod utilizes 1 CPU core. This high CPU usage is attributed to the spdk_tgt process running within each instance-manager pod. The spdk_tgt process is responsible for handling input/output (IO) operations and requires intensive polling. As a result, it consumes 100% of a dedicated CPU core to efficiently manage and process the IO requests, ensuring optimal performance and responsiveness for storage operations. \n\n",
		Category: SettingCategoryDangerZone,
		Type:     SettingTypeBool,
		Required: true,
		ReadOnly: false,
		Default:  "false",
	}

	SettingDefinitionV2DataEngineHugepageLimit = SettingDefinition{
		DisplayName: "Hugepage Size for V2 Data Engine",
		Description: "Hugepage size in MiB for v2 data engine",
		Category:    SettingCategoryV2DataEngine,
		Type:        SettingTypeInt,
		Required:    true,
		ReadOnly:    true,
		Default:     "2048",
	}

	SettingDefinitionV2DataEngineGuaranteedInstanceManagerCPU = SettingDefinition{
		DisplayName: "Guaranteed Instance Manager CPU for V2 Data Engine",
		Description: "Number of millicpus on each node to be reserved for each instance manager pod when the V2 Data Engine is enabled. By default, the Storage Performance Development Kit (SPDK) target daemon within each instance manager pod uses 1 CPU core. Configuring a minimum CPU usage value is essential for maintaining engine and replica stability, especially during periods of high node workload. \n\n" +
			"WARNING: \n\n" +
			"  - Value 0 means unsetting CPU requests for instance manager pods for v2 data engine. \n\n" +
			"  - This integer value is range from 1000 to 8000. \n\n" +
			"  - After this setting is changed, the v2 instance manager pod using this global setting will be automatically restarted without instances running on the v2 instance manager. \n\n",
		Category: SettingCategoryDangerZone,
		Type:     SettingTypeInt,
		Required: true,
		ReadOnly: false,
		Default:  "1250",
	}

	SettingDefinitionReplicaDiskSoftAntiAffinity = SettingDefinition{
		DisplayName: "Replica Disk Level Soft Anti-Affinity",
		Description: "Allow scheduling on disks with existing healthy replicas of the same volume",
		Category:    SettingCategoryScheduling,
		Type:        SettingTypeBool,
		Required:    true,
		ReadOnly:    false,
		Default:     "true",
	}

	SettingDefinitionAllowEmptyNodeSelectorVolume = SettingDefinition{
		DisplayName: "Allow Scheduling Empty Node Selector Volumes To Any Node",
		Description: "Allow replica of the volume without node selector to be scheduled on node with tags, default true",
		Category:    SettingCategoryScheduling,
		Type:        SettingTypeBool,
		Required:    true,
		ReadOnly:    false,
		Default:     "true",
	}

	SettingDefinitionAllowEmptyDiskSelectorVolume = SettingDefinition{
		DisplayName: "Allow Scheduling Empty Disk Selector Volumes To Any Disk",
		Description: "Allow replica of the volume without disk selector to be scheduled on disk with tags, default true",
		Category:    SettingCategoryScheduling,
		Type:        SettingTypeBool,
		Required:    true,
		ReadOnly:    false,
		Default:     "true",
	}

	SettingDefinitionDisableSnapshotPurge = SettingDefinition{
		DisplayName: "Disable Snapshot Purge",
		Description: "Temporarily prevent all attempts to purge volume snapshots",
		Category:    SettingCategoryDangerZone,
		Type:        SettingTypeBool,
		Required:    true,
		ReadOnly:    false,
		Default:     "false",
	}
)
View Source
var (
	LonghornSystemKey = "longhorn"
)
View Source
var (
	SettingNameList = []SettingName{
		SettingNameBackupTarget,
		SettingNameBackupTargetCredentialSecret,
		SettingNameAllowRecurringJobWhileVolumeDetached,
		SettingNameCreateDefaultDiskLabeledNodes,
		SettingNameDefaultDataPath,
		SettingNameDefaultEngineImage,
		SettingNameDefaultInstanceManagerImage,
		SettingNameDefaultBackingImageManagerImage,
		SettingNameSupportBundleManagerImage,
		SettingNameReplicaSoftAntiAffinity,
		SettingNameReplicaAutoBalance,
		SettingNameStorageOverProvisioningPercentage,
		SettingNameStorageMinimalAvailablePercentage,
		SettingNameStorageReservedPercentageForDefaultDisk,
		SettingNameUpgradeChecker,
		SettingNameAllowCollectingLonghornUsage,
		SettingNameCurrentLonghornVersion,
		SettingNameLatestLonghornVersion,
		SettingNameStableLonghornVersions,
		SettingNameDefaultReplicaCount,
		SettingNameDefaultDataLocality,
		SettingNameDefaultLonghornStaticStorageClass,
		SettingNameBackupstorePollInterval,
		SettingNameTaintToleration,
		SettingNameSystemManagedComponentsNodeSelector,
		SettingNameCRDAPIVersion,
		SettingNameAutoSalvage,
		SettingNameAutoDeletePodWhenVolumeDetachedUnexpectedly,
		SettingNameRegistrySecret,
		SettingNameDisableSchedulingOnCordonedNode,
		SettingNameReplicaZoneSoftAntiAffinity,
		SettingNameNodeDownPodDeletionPolicy,
		SettingNameNodeDrainPolicy,
		SettingNameDetachManuallyAttachedVolumesWhenCordoned,
		SettingNamePriorityClass,
		SettingNameDisableRevisionCounter,
		SettingNameReplicaReplenishmentWaitInterval,
		SettingNameConcurrentReplicaRebuildPerNodeLimit,
		SettingNameConcurrentBackupRestorePerNodeLimit,
		SettingNameSystemManagedPodsImagePullPolicy,
		SettingNameAllowVolumeCreationWithDegradedAvailability,
		SettingNameAutoCleanupSystemGeneratedSnapshot,
		SettingNameAutoCleanupRecurringJobBackupSnapshot,
		SettingNameConcurrentAutomaticEngineUpgradePerNodeLimit,
		SettingNameBackingImageCleanupWaitInterval,
		SettingNameBackingImageRecoveryWaitInterval,
		SettingNameGuaranteedInstanceManagerCPU,
		SettingNameKubernetesClusterAutoscalerEnabled,
		SettingNameOrphanAutoDeletion,
		SettingNameStorageNetwork,
		SettingNameFailedBackupTTL,
		SettingNameRecurringSuccessfulJobsHistoryLimit,
		SettingNameRecurringFailedJobsHistoryLimit,
		SettingNameRecurringJobMaxRetention,
		SettingNameSupportBundleFailedHistoryLimit,
		SettingNameSupportBundleNodeCollectionTimeout,
		SettingNameDeletingConfirmationFlag,
		SettingNameEngineReplicaTimeout,
		SettingNameSnapshotDataIntegrity,
		SettingNameSnapshotDataIntegrityCronJob,
		SettingNameSnapshotDataIntegrityImmediateCheckAfterSnapshotCreation,
		SettingNameSnapshotMaxCount,
		SettingNameRestoreVolumeRecurringJobs,
		SettingNameRemoveSnapshotsDuringFilesystemTrim,
		SettingNameFastReplicaRebuildEnabled,
		SettingNameReplicaFileSyncHTTPClientTimeout,
		SettingNameBackupCompressionMethod,
		SettingNameBackupConcurrentLimit,
		SettingNameRestoreConcurrentLimit,
		SettingNameLogLevel,
		SettingNameV1DataEngine,
		SettingNameV2DataEngine,
		SettingNameV2DataEngineHugepageLimit,
		SettingNameV2DataEngineGuaranteedInstanceManagerCPU,
		SettingNameOfflineReplicaRebuilding,
		SettingNameReplicaDiskSoftAntiAffinity,
		SettingNameAllowEmptyNodeSelectorVolume,
		SettingNameAllowEmptyDiskSelectorVolume,
		SettingNameDisableSnapshotPurge,
	}
)

SettingsRelatedToVolume should match the items in datastore.GetLabelsForVolumesFollowsGlobalSettings

TODO: May need to add the data locality check

Functions

func AddGoCoverDirToDaemonSet added in v1.6.0

func AddGoCoverDirToDaemonSet(daemonset *appsv1.DaemonSet)

AddGoCoverDirToDaemonSet adds GOCOVERDIR env and host path volume to a daemonset. It's used to collect coverage data from a daemonset.

func AddGoCoverDirToPod added in v1.6.0

func AddGoCoverDirToPod(pod *corev1.Pod)

AddGoCoverDirToPod adds GOCOVERDIR env and host path volume to a pod. It's used to collect coverage data from a pod.

func BackupStoreRequireCredential added in v1.5.0

func BackupStoreRequireCredential(backupType string) bool

func ConsolidateInstanceManagers added in v1.5.0

func ConsolidateInstanceManagers(instanceManagerMaps ...map[string]*longhorn.InstanceManager) map[string]*longhorn.InstanceManager

func ConsolidateInstances added in v1.5.0

func ConsolidateInstances(instancesMaps ...map[string]longhorn.InstanceProcess) map[string]longhorn.InstanceProcess

func CreateCniAnnotationFromSetting added in v1.3.0

func CreateCniAnnotationFromSetting(storageNetwork *longhorn.Setting) string

func CreateDefaultDisk added in v0.8.1

func CreateDefaultDisk(dataPath string, storageReservedPercentage int64) (map[string]longhorn.DiskSpec, error)

func CreateDisksFromAnnotation added in v0.8.1

func CreateDisksFromAnnotation(annotation string) (map[string]longhorn.DiskSpec, error)

func EngineBinaryExistOnHostForImage

func EngineBinaryExistOnHostForImage(image string) bool

func ErrorAlreadyExists added in v0.6.0

func ErrorAlreadyExists(err error) bool

func ErrorIsInvalidState added in v1.4.4

func ErrorIsInvalidState(err error) bool

func ErrorIsNotFound added in v0.6.0

func ErrorIsNotFound(err error) bool

func ErrorIsNotSupport added in v1.4.0

func ErrorIsNotSupport(err error) bool

func ErrorIsStopped added in v1.5.0

func ErrorIsStopped(err error) bool

func GenerateEngineNameForVolume

func GenerateEngineNameForVolume(vName, currentEngineName string) string

func GenerateReplicaNameForVolume

func GenerateReplicaNameForVolume(vName string) string

func GetAPIServerAddressFromIP

func GetAPIServerAddressFromIP(ip string) string

func GetBackingImageDataSourceLabels added in v1.2.0

func GetBackingImageDataSourceLabels(name, nodeID, diskUUID string) map[string]string

func GetBackingImageDataSourcePodName added in v1.2.0

func GetBackingImageDataSourcePodName(bidsName string) string

func GetBackingImageDirectoryName added in v1.1.1

func GetBackingImageDirectoryName(backingImageName, backingImageUUID string) string

func GetBackingImageDirectoryOnHost added in v1.1.1

func GetBackingImageDirectoryOnHost(diskPath, backingImageName, backingImageUUID string) string

func GetBackingImageLabels added in v1.1.1

func GetBackingImageLabels() map[string]string

func GetBackingImageManagerDirectoryOnHost added in v1.1.1

func GetBackingImageManagerDirectoryOnHost(diskPath string) string

func GetBackingImageManagerLabels added in v1.1.1

func GetBackingImageManagerLabels(nodeID, diskUUID string) map[string]string

func GetBackingImageManagerName added in v1.1.1

func GetBackingImageManagerName(image, diskUUID string) string

func GetBackingImagePathForReplicaManagerContainer added in v1.1.1

func GetBackingImagePathForReplicaManagerContainer(diskPath, backingImageName, backingImageUUID string) string

func GetBackupTargetSchemeFromURL added in v1.5.0

func GetBackupTargetSchemeFromURL(backupTargetURL string) string

func GetBackupVolumeLabels added in v1.2.0

func GetBackupVolumeLabels(volumeName string) map[string]string

func GetBaseLabelsForSystemManagedComponent added in v1.1.1

func GetBaseLabelsForSystemManagedComponent() map[string]string

func GetBlockDeviceType added in v1.6.0

func GetBlockDeviceType(devicePath string) (string, error)

func GetCondition added in v0.8.1

func GetCondition(conditions []longhorn.Condition, conditionType string) longhorn.Condition

GetCondition returns a copy of conditions[conditionType], and automatically fill the unknown condition

func GetConfigMapNameFromHostname added in v1.4.0

func GetConfigMapNameFromHostname(hostname string) string

func GetConfigMapNameFromShareManagerName added in v1.4.0

func GetConfigMapNameFromShareManagerName(smName string) string

func GetCronJobLabels added in v1.1.2

func GetCronJobLabels(job *longhorn.RecurringJobSpec) map[string]string

func GetCronJobNameForRecurringJob added in v1.2.0

func GetCronJobNameForRecurringJob(name string) string

func GetCronJobNameForVolumeAndJob

func GetCronJobNameForVolumeAndJob(vName, job string) string

func GetCustomizedDefaultSettings added in v0.6.0

func GetCustomizedDefaultSettings(defaultSettingCM *corev1.ConfigMap) (defaultSettings map[string]string, err error)

func GetDaemonSetNameFromEngineImageName added in v0.6.0

func GetDaemonSetNameFromEngineImageName(engineImageName string) string

func GetDangerZoneSettings added in v1.6.0

func GetDangerZoneSettings() sets.Set[SettingName]

func GetDefaultManagerURL added in v1.0.1

func GetDefaultManagerURL() string

func GetDeviceTypeOf added in v1.5.0

func GetDeviceTypeOf(mountPath string) (string, error)

func GetEIDaemonSetLabelSelector added in v1.1.1

func GetEIDaemonSetLabelSelector(engineImageName string) map[string]string

GetEIDaemonSetLabelSelector returns labels for engine image daemonset's Spec.Selector.MatchLabels

func GetEngineBinaryDirectoryForEngineManagerContainer added in v0.8.0

func GetEngineBinaryDirectoryForEngineManagerContainer(image string) string

func GetEngineBinaryDirectoryForReplicaManagerContainer added in v0.8.0

func GetEngineBinaryDirectoryForReplicaManagerContainer(image string) string

func GetEngineBinaryDirectoryOnHostForImage

func GetEngineBinaryDirectoryOnHostForImage(image string) string

func GetEngineImageChecksumName

func GetEngineImageChecksumName(image string) string

func GetEngineImageLabels added in v0.6.0

func GetEngineImageLabels(engineImageName string) map[string]string

func GetEngineImageNameFromDaemonSetName added in v0.6.0

func GetEngineImageNameFromDaemonSetName(dsName string) string

func GetIMNameFromPDBName added in v1.5.4

func GetIMNameFromPDBName(pdbName string) string

func GetImageCanonicalName

func GetImageCanonicalName(image string) string

func GetInstanceManagerComponentLabel added in v0.6.0

func GetInstanceManagerComponentLabel() map[string]string

func GetInstanceManagerImageChecksumName added in v1.0.1

func GetInstanceManagerImageChecksumName(image string) string

func GetInstanceManagerLabels added in v0.6.0

func GetInstanceManagerLabels(node, imImage string, imType longhorn.InstanceManagerType, dataEngine longhorn.DataEngineType) map[string]string

func GetInstanceManagerName added in v0.8.0

func GetInstanceManagerName(imType longhorn.InstanceManagerType, nodeName, image, dataEngine string) (string, error)

func GetInstanceManagerPrefix added in v1.1.0

func GetInstanceManagerPrefix(imType longhorn.InstanceManagerType) string

func GetKubernetesProviderNameFromURL added in v1.5.0

func GetKubernetesProviderNameFromURL(providerURL string) string

func GetLHVolumeAttachmentNameFromVolumeName added in v1.5.0

func GetLHVolumeAttachmentNameFromVolumeName(volName string) string

func GetLastSkippedSystemRestoreAtLabelKey added in v1.4.0

func GetLastSkippedSystemRestoreAtLabelKey() string

func GetLastSkippedSystemRestoreLabelKey added in v1.4.0

func GetLastSkippedSystemRestoreLabelKey() string

func GetLastSystemRestoreAtLabelKey added in v1.4.0

func GetLastSystemRestoreAtLabelKey() string

func GetLastSystemRestoreBackupLabelKey added in v1.4.0

func GetLastSystemRestoreBackupLabelKey() string

func GetLastSystemRestoreLabelKey added in v1.4.0

func GetLastSystemRestoreLabelKey() string

func GetLonghornLabelCRDAPIVersionKey added in v1.3.0

func GetLonghornLabelCRDAPIVersionKey() string

func GetLonghornLabelComponentKey added in v0.6.0

func GetLonghornLabelComponentKey() string

func GetLonghornLabelKey added in v0.6.0

func GetLonghornLabelKey(name string) string

func GetManagerLabels added in v1.4.4

func GetManagerLabels() map[string]string

func GetNodeTagsFromAnnotation added in v0.8.1

func GetNodeTagsFromAnnotation(annotation string) ([]string, error)

func GetOrphanChecksumNameForOrphanedDirectory added in v1.3.0

func GetOrphanChecksumNameForOrphanedDirectory(nodeID, diskName, diskPath, diskUUID, dirName string) string

func GetOrphanLabelsForOrphanedDirectory added in v1.3.0

func GetOrphanLabelsForOrphanedDirectory(nodeID, diskUUID string) map[string]string

func GetPDBName added in v1.5.4

func GetPDBName(im *longhorn.InstanceManager) string

func GetPDBNameFromIMName added in v1.5.4

func GetPDBNameFromIMName(imName string) string

func GetRecoveryBackendConfigMapLabels added in v1.4.0

func GetRecoveryBackendConfigMapLabels() map[string]string

func GetRecurringJobLabelKey added in v1.2.0

func GetRecurringJobLabelKey(labelType, recurringJobName string) string

func GetRecurringJobLabelKeyByType added in v1.5.0

func GetRecurringJobLabelKeyByType(name string, isGroup bool) string

func GetRecurringJobLabelValueMap added in v1.2.0

func GetRecurringJobLabelValueMap(labelType, recurringJobName string) map[string]string

func GetRecurringJobSourceLabelKey added in v1.5.0

func GetRecurringJobSourceLabelKey() string

GetRecurringJobSourceLabelKey returns "recurring-job.longhorn.io/source"

func GetRegionAndZone added in v0.8.0

func GetRegionAndZone(labels map[string]string) (string, string)

func GetReplicaDataPath added in v1.1.0

func GetReplicaDataPath(diskPath, dataDirectoryName string) string

func GetReplicaMountedDataPath added in v0.6.0

func GetReplicaMountedDataPath(dataPath string) string

func GetShareManagerComponentLabel added in v1.1.0

func GetShareManagerComponentLabel() map[string]string

func GetShareManagerConfigMapLabels added in v1.4.0

func GetShareManagerConfigMapLabels(name string) map[string]string

func GetShareManagerImageChecksumName added in v1.1.0

func GetShareManagerImageChecksumName(image string) string

func GetShareManagerInstanceLabel added in v1.1.0

func GetShareManagerInstanceLabel(name string) map[string]string

func GetShareManagerLabels added in v1.1.0

func GetShareManagerLabels(name, image string) map[string]string

func GetShareManagerNameFromShareManagerPodName added in v1.1.1

func GetShareManagerNameFromShareManagerPodName(podName string) string

func GetShareManagerPodNameFromShareManagerName added in v1.1.1

func GetShareManagerPodNameFromShareManagerName(smName string) string

func GetSnapshotName added in v1.2.3

func GetSnapshotName(vds longhorn.VolumeDataSource) string

func GetSystemRestoreInProgressLabel added in v1.4.0

func GetSystemRestoreInProgressLabel() map[string]string

func GetSystemRestoreLabelKey added in v1.4.0

func GetSystemRestoreLabelKey() string

func GetVersionLabelKey added in v1.4.0

func GetVersionLabelKey() string

func GetVolumeLabels added in v0.7.0

func GetVolumeLabels(volumeName string) map[string]string

func GetVolumeName added in v1.2.3

func GetVolumeName(vds longhorn.VolumeDataSource) string

func GetVolumeSettingLabelKey added in v1.4.0

func GetVolumeSettingLabelKey(settingName string) string

func IsDataFromVolume added in v1.2.3

func IsDataFromVolume(vds longhorn.VolumeDataSource) bool

func IsPotentialBlockDisk added in v1.6.3

func IsPotentialBlockDisk(path string) bool

func IsRecurringJobLabel added in v1.5.0

func IsRecurringJobLabel(key string) bool

IsRecurringJobLabel checks if the given key is a recurring job label.

func IsRecurringJobSourceLabel added in v1.5.0

func IsRecurringJobSourceLabel(key string) bool

IsRecurringJobSourceLabel checks if the given key is the recurring job source label.

func IsSelectorsInTags added in v1.4.3

func IsSelectorsInTags(tags, selectors []string, allowEmptySelector bool) bool

IsSelectorsInTags checks if all the selectors are present in the tags slice. It returns true if all selectors are found, false otherwise.

func IsSupportBundleControllerDeleting added in v1.4.3

func IsSupportBundleControllerDeleting(supportBundle *longhorn.SupportBundle) bool

func IsValidVolumeDataSource added in v1.2.0

func IsValidVolumeDataSource(vds longhorn.VolumeDataSource) bool

func LabelsToString added in v0.7.0

func LabelsToString(labels map[string]string) string

func NewVolumeDataSource added in v1.2.0

func NewVolumeDataSource(volumeDataSourceType longhorn.VolumeDataSourceType, parameters map[string]string) (dataSource longhorn.VolumeDataSource, err error)

func NewVolumeDataSourceTypeSnapshot added in v1.2.0

func NewVolumeDataSourceTypeSnapshot(volumeName, snapshotName string) longhorn.VolumeDataSource

func NewVolumeDataSourceTypeVolume added in v1.2.0

func NewVolumeDataSourceTypeVolume(volumeName string) longhorn.VolumeDataSource

func SetCondition added in v0.8.1

func SetCondition(originConditions []longhorn.Condition, conditionType string, conditionValue longhorn.ConditionStatus, reason, message string) []longhorn.Condition

func SetConditionAndRecord added in v0.8.1

func SetConditionAndRecord(conditions []longhorn.Condition, conditionType string, conditionValue longhorn.ConditionStatus,
	reason, message string, eventRecorder record.EventRecorder, obj runtime.Object, eventtype string) []longhorn.Condition

func SetConditionWithoutTimestamp added in v1.3.0

func SetConditionWithoutTimestamp(originConditions []longhorn.Condition, conditionType string, conditionValue longhorn.ConditionStatus, reason, message string) []longhorn.Condition

func SetSettingDefinition added in v1.2.5

func SetSettingDefinition(name SettingName, definition SettingDefinition)

SetSettingDefinition sets the setting definition in `settingDefinitions` by the parameter `name` and `definition`

func UnmarshalNodeSelector added in v1.1.1

func UnmarshalNodeSelector(nodeSelectorSetting string) (map[string]string, error)

func UnmarshalToNodeTags added in v0.8.1

func UnmarshalToNodeTags(s string) ([]string, error)

UnmarshalToNodeTags input format should be: `["worker1","enabled"]`

func UnmarshalTolerations added in v0.6.0

func UnmarshalTolerations(tolerationSetting string) ([]corev1.Toleration, error)

func ValidateAccessMode added in v1.1.0

func ValidateAccessMode(mode longhorn.AccessMode) error

func ValidateBackupCompressionMethod added in v1.5.0

func ValidateBackupCompressionMethod(method string) error

func ValidateCPUReservationValues added in v1.1.1

func ValidateCPUReservationValues(settingName SettingName, instanceManagerCPUStr string) error

func ValidateDataLocality added in v1.1.0

func ValidateDataLocality(mode longhorn.DataLocality) error

func ValidateDataLocalityAndReplicaCount added in v1.4.0

func ValidateDataLocalityAndReplicaCount(mode longhorn.DataLocality, count int) error

func ValidateEngineImageChecksumName added in v0.8.0

func ValidateEngineImageChecksumName(name string) bool

func ValidateLogLevel added in v1.5.0

func ValidateLogLevel(level string) error

func ValidateOfflineReplicaRebuilding added in v1.5.0

func ValidateOfflineReplicaRebuilding(mode string) error

func ValidateReplicaAutoBalance added in v1.2.0

func ValidateReplicaAutoBalance(option longhorn.ReplicaAutoBalance) error

func ValidateReplicaCount added in v0.6.0

func ValidateReplicaCount(count int) error

func ValidateReplicaDiskSoftAntiAffinity added in v1.6.0

func ValidateReplicaDiskSoftAntiAffinity(value longhorn.ReplicaDiskSoftAntiAffinity) error

func ValidateReplicaSoftAntiAffinity added in v1.5.0

func ValidateReplicaSoftAntiAffinity(value longhorn.ReplicaSoftAntiAffinity) error

func ValidateReplicaZoneSoftAntiAffinity added in v1.5.0

func ValidateReplicaZoneSoftAntiAffinity(value longhorn.ReplicaZoneSoftAntiAffinity) error

func ValidateSetting added in v1.3.0

func ValidateSetting(name, value string) (err error)

func ValidateSnapshotDataIntegrity added in v1.4.0

func ValidateSnapshotDataIntegrity(mode string) error

func ValidateStorageNetwork added in v1.3.0

func ValidateStorageNetwork(value string) (err error)

func ValidateUnmapMarkSnapChainRemoved added in v1.4.0

func ValidateUnmapMarkSnapChainRemoved(unmapValue longhorn.UnmapMarkSnapChainRemoved) error

Types

type CNIAnnotation added in v1.3.0

type CNIAnnotation string

type CniNetwork added in v1.3.0

type CniNetwork struct {
	Name string   `json:"name"`
	IPs  []string `json:"ips,omitempty"`
}

type DiskSpecWithName added in v0.8.1

type DiskSpecWithName struct {
	longhorn.DiskSpec
	Name string `json:"name"`
}

func UnmarshalToDisks added in v0.8.1

func UnmarshalToDisks(s string) (ret []DiskSpecWithName, err error)

UnmarshalToDisks input format should be: `[{"path":"/mnt/disk1","allowScheduling":false},

{"path":"/mnt/disk2","allowScheduling":false,"storageReserved":1024,"tags":["ssd","fast"]}]`

type ErrorInvalidState added in v1.4.4

type ErrorInvalidState struct {
	Reason string
}

func (*ErrorInvalidState) Error added in v1.4.4

func (e *ErrorInvalidState) Error() string

type NodeDownPodDeletionPolicy added in v1.1.0

type NodeDownPodDeletionPolicy string

type NodeDrainPolicy added in v1.5.4

type NodeDrainPolicy string

type NotFoundError

type NotFoundError struct {
	Name string
}

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

type SettingCategory

type SettingCategory string

type SettingDefinition

type SettingDefinition struct {
	DisplayName string          `json:"displayName"`
	Description string          `json:"description"`
	Category    SettingCategory `json:"category"`
	Type        SettingType     `json:"type"`
	Required    bool            `json:"required"`
	ReadOnly    bool            `json:"readOnly"`
	Default     string          `json:"default"`
	Choices     []string        `json:"options,omitempty"` // +optional
}

func GetSettingDefinition added in v1.2.5

func GetSettingDefinition(name SettingName) (SettingDefinition, bool)

GetSettingDefinition gets the setting definition in `settingDefinitions` by the parameter `name`

type SettingName

type SettingName string

type SettingType

type SettingType string

type SystemManagedPodsImagePullPolicy added in v1.1.0

type SystemManagedPodsImagePullPolicy string

Jump to

Keyboard shortcuts

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