types

package
v1.0.1-rc3 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2020 License: Apache-2.0 Imports: 16 Imported by: 23

Documentation

Index

Constants

View Source
const (
	LonghornManagerDaemonSetName = "longhorn-manager"

	DriverDeployerName = "longhorn-driver-deployer"
	CSIAttacherName    = "csi-attacher"
	CSIProvisionerName = "csi-provisioner"
	CSIResizerName     = "csi-resizer"
	CSIPluginName      = "longhorn-csi-plugin"
)
View Source
const (
	VolumeStateCreating  = VolumeState("creating")
	VolumeStateAttached  = VolumeState("attached")
	VolumeStateDetached  = VolumeState("detached")
	VolumeStateAttaching = VolumeState("attaching")
	VolumeStateDetaching = VolumeState("detaching")
	VolumeStateDeleting  = VolumeState("deleting")
)
View Source
const (
	VolumeRobustnessHealthy  = VolumeRobustness("healthy")  // during attached
	VolumeRobustnessDegraded = VolumeRobustness("degraded") // during attached
	VolumeRobustnessFaulted  = VolumeRobustness("faulted")  // during detached
	VolumeRobustnessUnknown  = VolumeRobustness("unknown")
)
View Source
const (
	VolumeFrontendBlockDev = VolumeFrontend("blockdev")
	VolumeFrontendISCSI    = VolumeFrontend("iscsi")
	VolumeFrontendEmpty    = VolumeFrontend("")
)
View Source
const (
	VolumeConditionTypeScheduled = "scheduled"
	VolumeConditionTypeRestore   = "restore"
)
View Source
const (
	VolumeConditionReasonReplicaSchedulingFailure = "ReplicaSchedulingFailure"
	VolumeConditionReasonRestoreInProgress        = "RestoreInProgress"
	VolumeConditionReasonRestoreFailure           = "RestoreFailure"
)
View Source
const (
	RecurringJobTypeSnapshot = RecurringJobType("snapshot")
	RecurringJobTypeBackup   = RecurringJobType("backup")
)
View Source
const (
	InstanceStateRunning  = InstanceState("running")
	InstanceStateStopped  = InstanceState("stopped")
	InstanceStateError    = InstanceState("error")
	InstanceStateStarting = InstanceState("starting")
	InstanceStateStopping = InstanceState("stopping")
	InstanceStateUnknown  = InstanceState("unknown")
)
View Source
const (
	EngineImageStateDeploying    = "deploying"
	EngineImageStateReady        = "ready"
	EngineImageStateIncompatible = "incompatible"
	EngineImageStateError        = "error"
)
View Source
const (
	EngineImageConditionTypeReady = "ready"

	EngineImageConditionTypeReadyReasonDaemonSet = "daemonSet"
	EngineImageConditionTypeReadyReasonBinary    = "binary"
)
View Source
const (
	NodeConditionTypeReady            = "Ready"
	NodeConditionTypeMountPropagation = "MountPropagation"
	NodeConditionTypeSchedulable      = "Schedulable"
)
View Source
const (
	NodeConditionReasonManagerPodDown            = "ManagerPodDown"
	NodeConditionReasonManagerPodMissing         = "ManagerPodMissing"
	NodeConditionReasonKubernetesNodeGone        = "KubernetesNodeGone"
	NodeConditionReasonKubernetesNodeNotReady    = "KubernetesNodeNotReady"
	NodeConditionReasonKubernetesNodePressure    = "KubernetesNodePressure"
	NodeConditionReasonUnknownNodeConditionTrue  = "UnknownNodeConditionTrue"
	NodeConditionReasonNoMountPropagationSupport = "NoMountPropagationSupport"
	NodeConditionReasonKubernetesNodeCordoned    = "KubernetesNodeCordoned"
)
View Source
const (
	DiskConditionTypeSchedulable = "Schedulable"
	DiskConditionTypeReady       = "Ready"
)
View Source
const (
	DiskConditionReasonDiskPressure          = "DiskPressure"
	DiskConditionReasonDiskFilesystemChanged = "DiskFilesystemChanged"
	DiskConditionReasonNoDiskInfo            = "NoDiskInfo"
)
View Source
const (
	InstanceTypeEngine  = InstanceType("engine")
	InstanceTypeReplica = InstanceType("replica")
)
View Source
const (
	InstanceManagerStateError    = InstanceManagerState("error")
	InstanceManagerStateRunning  = InstanceManagerState("running")
	InstanceManagerStateStopped  = InstanceManagerState("stopped")
	InstanceManagerStateStarting = InstanceManagerState("starting")
	InstanceManagerStateUnknown  = InstanceManagerState("unknown")
)
View Source
const (
	InstanceManagerTypeEngine  = InstanceManagerType("engine")
	InstanceManagerTypeReplica = InstanceManagerType("replica")
)
View Source
const (
	SettingTypeString = SettingType("string")
	SettingTypeInt    = SettingType("int")
	SettingTypeBool   = SettingType("bool")
)
View Source
const (
	SettingNameBackupTarget                      = SettingName("backup-target")
	SettingNameBackupTargetCredentialSecret      = SettingName("backup-target-credential-secret")
	SettingNameCreateDefaultDiskLabeledNodes     = SettingName("create-default-disk-labeled-nodes")
	SettingNameDefaultDataPath                   = SettingName("default-data-path")
	SettingNameDefaultEngineImage                = SettingName("default-engine-image")
	SettingNameDefaultInstanceManagerImage       = SettingName("default-instance-manager-image")
	SettingNameReplicaSoftAntiAffinity           = SettingName("replica-soft-anti-affinity")
	SettingNameStorageOverProvisioningPercentage = SettingName("storage-over-provisioning-percentage")
	SettingNameStorageMinimalAvailablePercentage = SettingName("storage-minimal-available-percentage")
	SettingNameUpgradeChecker                    = SettingName("upgrade-checker")
	SettingNameLatestLonghornVersion             = SettingName("latest-longhorn-version")
	SettingNameDefaultReplicaCount               = SettingName("default-replica-count")
	SettingNameGuaranteedEngineCPU               = SettingName("guaranteed-engine-cpu")
	SettingNameDefaultLonghornStaticStorageClass = SettingName("default-longhorn-static-storage-class")
	SettingNameBackupstorePollInterval           = SettingName("backupstore-poll-interval")
	SettingNameTaintToleration                   = SettingName("taint-toleration")
	SettingNameCRDAPIVersion                     = SettingName("crd-api-version")
	SettingNameAutoSalvage                       = SettingName("auto-salvage")
	SettingNameRegistrySecret                    = SettingName("registry-secret")
	SettingNameDisableSchedulingOnCordonedNode   = SettingName("disable-scheduling-on-cordoned-node")
	SettingNameReplicaZoneSoftAntiAffinity       = SettingName("replica-zone-soft-anti-affinity")
	SettingNameVolumeAttachmentRecoveryPolicy    = SettingName("volume-attachment-recovery-policy")
	SettingNameMkfsExt4Parameters                = SettingName("mkfs-ext4-parameters")
	SettingNamePriorityClass                     = SettingName("priority-class")
)
View Source
const (
	SettingCategoryGeneral    = SettingCategory("general")
	SettingCategoryBackup     = SettingCategory("backup")
	SettingCategoryScheduling = SettingCategory("scheduling")
	SettingCategoryDangerZone = SettingCategory("danger Zone")
)
View Source
const (
	VolumeAttachmentRecoveryPolicyNever     = VolumeAttachmentRecoveryPolicy("never") // Kubernetes default behavior
	VolumeAttachmentRecoveryPolicyWait      = VolumeAttachmentRecoveryPolicy("wait")  // Longhorn default behavior
	VolumeAttachmentRecoveryPolicyImmediate = VolumeAttachmentRecoveryPolicy("immediate")
)
View Source
const (
	LonghornKindNode            = "Node"
	LonghornKindVolume          = "Volume"
	LonghornKindEngineImage     = "EngineImage"
	LonghornKindInstanceManager = "InstanceManager"

	CRDAPIVersionV1alpha1 = "longhorn.rancher.io/v1alpha1"
	CRDAPIVersionV1beta1  = "longhorn.io/v1beta1"
	CurrentCRDAPIVersion  = CRDAPIVersionV1beta1
)
View Source
const (
	DefaultAPIPort = 9500

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

	LonghornNodeKey = "longhornnode"

	NodeCreateDefaultDiskLabelKey             = "node.longhorn.io/create-default-disk"
	NodeCreateDefaultDiskLabelValueTrue       = "true"
	NodeCreateDefaultDiskLabelValueConfig     = "config"
	KubeNodeDefaultDiskConfigAnnotationKey    = "node.longhorn.io/default-disks-config"
	KubeNodeDefaultNodeTagConfigAnnotationKey = "node.longhorn.io/default-node-tags"

	BaseImageLabel        = "ranchervm-base-image"
	KubernetesStatusLabel = "KubernetesStatus"
	KubernetesReplicaSet  = "ReplicaSet"
	RecurringJobLabel     = "RecurringJob"

	LonghornLabelKeyPrefix = "longhorn.io"

	LonghornLabelEngineImage          = "engine-image"
	LonghornLabelInstanceManager      = "instance-manager"
	LonghornLabelNode                 = "node"
	LonghornLabelInstanceManagerType  = "instance-manager-type"
	LonghornLabelInstanceManagerImage = "instance-manager-image"
	LonghornLabelVolume               = "longhornvolume"

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

	LonghornDriverName = "driver.longhorn.io"

	DefaultDiskPrefix = "default-disk-"

	DeprecatedProvisionerName = "rancher.io/longhorn"
	DepracatedDriverName      = "io.rancher.longhorn"
)
View Source
const (
	CSIMinVersion                = "v1.14.0"
	CSIVolumeExpansionMinVersion = "v1.16.0"

	KubernetesTopologyLabelsVersion = "v1.17.0"
)
View Source
const (
	ReplicaModeRW  = ReplicaMode("RW")
	ReplicaModeWO  = ReplicaMode("WO")
	ReplicaModeERR = ReplicaMode("ERR")

	EnvNodeName       = "NODE_NAME"
	EnvPodNamespace   = "POD_NAMESPACE"
	EnvPodIP          = "POD_IP"
	EnvServiceAccount = "SERVICE_ACCOUNT"

	AWSAccessKey = "AWS_ACCESS_KEY_ID"
	AWSSecretKey = "AWS_SECRET_ACCESS_KEY"
	AWSEndPoint  = "AWS_ENDPOINTS"
	AWSCert      = "AWS_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
)
View Source
const (
	EnvDefaultSettingPath = "DEFAULT_SETTING_PATH"
)
View Source
const (
	InvalidEngineVersion = -1
)
View Source
const (

	// MaximumJobNameSize is calculated using
	// 1. NameMaximumLength is 40
	// 2. Recurring suffix is 2
	// 3. Maximum kubernetes name length is 63
	// 4. cronjob pod suffix is 11
	// 5. Dash and buffer for 2
	MaximumJobNameSize = 8
)

Variables

View Source
var (
	SettingDefinitions = map[SettingName]SettingDefinition{
		SettingNameBackupTarget:                      SettingDefinitionBackupTarget,
		SettingNameBackupTargetCredentialSecret:      SettingDefinitionBackupTargetCredentialSecret,
		SettingNameCreateDefaultDiskLabeledNodes:     SettingDefinitionCreateDefaultDiskLabeledNodes,
		SettingNameDefaultDataPath:                   SettingDefinitionDefaultDataPath,
		SettingNameDefaultEngineImage:                SettingDefinitionDefaultEngineImage,
		SettingNameDefaultInstanceManagerImage:       SettingDefinitionDefaultInstanceManagerImage,
		SettingNameReplicaSoftAntiAffinity:           SettingDefinitionReplicaSoftAntiAffinity,
		SettingNameStorageOverProvisioningPercentage: SettingDefinitionStorageOverProvisioningPercentage,
		SettingNameStorageMinimalAvailablePercentage: SettingDefinitionStorageMinimalAvailablePercentage,
		SettingNameUpgradeChecker:                    SettingDefinitionUpgradeChecker,
		SettingNameLatestLonghornVersion:             SettingDefinitionLatestLonghornVersion,
		SettingNameDefaultReplicaCount:               SettingDefinitionDefaultReplicaCount,
		SettingNameGuaranteedEngineCPU:               SettingDefinitionGuaranteedEngineCPU,
		SettingNameDefaultLonghornStaticStorageClass: SettingDefinitionDefaultLonghornStaticStorageClass,
		SettingNameBackupstorePollInterval:           SettingDefinitionBackupstorePollInterval,
		SettingNameTaintToleration:                   SettingDefinitionTaintToleration,
		SettingNameCRDAPIVersion:                     SettingDefinitionCRDAPIVersion,
		SettingNameAutoSalvage:                       SettingDefinitionAutoSalvage,
		SettingNameRegistrySecret:                    SettingDefinitionRegistrySecret,
		SettingNameDisableSchedulingOnCordonedNode:   SettingDefinitionDisableSchedulingOnCordonedNode,
		SettingNameReplicaZoneSoftAntiAffinity:       SettingDefinitionReplicaZoneSoftAntiAffinity,
		SettingNameVolumeAttachmentRecoveryPolicy:    SettingDefinitionVolumeAttachmentRecoveryPolicy,
		SettingNameMkfsExt4Parameters:                SettingDefinitionMkfsExt4Parameters,
		SettingNamePriorityClass:                     SettingDefinitionPriorityClass,
	}

	SettingDefinitionBackupTarget = SettingDefinition{
		DisplayName: "Backup Target",
		Description: "The endpoint used to access the backupstore. NFS 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,
	}

	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",
	}

	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:        SettingTypeString,
		Required:    true,
		ReadOnly:    true,
	}

	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",
	}

	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:     "200",
	}

	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",
	}

	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",
	}

	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,
	}

	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",
	}

	SettingDefinitionGuaranteedEngineCPU = SettingDefinition{
		DisplayName: "Guaranteed Engine CPU",
		Description: "Allow Longhorn Instance Managers to have guaranteed CPU allocation. The value is how many CPUs should be reserved for each Engine/Replica Instance Manager Pod created by Longhorn. For example, 0.1 means one-tenth of a CPU. This will help maintain engine stability during high node workload. It only applies to the Engine/Replica Manager Pods created after the setting took effect. WARNING: After this setting is changed, all the instance managers on all the nodes will be automatically restarted. \nWARNING: DO NOT CHANGE THIS SETTING WITH ATTACHED VOLUMES.",
		Category:    SettingCategoryDangerZone,
		Type:        SettingTypeString,
		Required:    true,
		ReadOnly:    false,
		Default:     "0.25",
	}

	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: "To dedicate nodes to store Longhorn replicas and reject other general workloads, set tolerations for Longhorn and add taints for the storage nodes. 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, `key1=value1:NoSchedule; key2:NoExecute`. Because `kubernetes.io` is used as the key of all Kubernetes default tolerations, it should not be used in the toleration settings.\nWARNING: DO NOT CHANGE THIS SETTING WITH ATTACHED VOLUMES.",
		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/v1beta1. 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",
	}

	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.",
		Category:    SettingCategoryScheduling,
		Type:        SettingTypeBool,
		Required:    true,
		ReadOnly:    false,
		Default:     "true",
	}
	SettingDefinitionVolumeAttachmentRecoveryPolicy = SettingDefinition{
		DisplayName: "Volume Attachment Recovery Policy",
		Description: "Defines the Longhorn action when a Volume is stuck with a Deployment Pod on a failed node.\n" +
			"- **wait** leads to the deletion of the volume attachment as soon as the pods deletion time has passed.\n" +
			"- **never** is the default Kubernetes behavior of never deleting volume attachments on terminating pods.\n" +
			"- **immediate** leads to the deletion of the volume attachment as soon as all workload pods are pending.\n",
		Category: SettingCategoryGeneral,
		Type:     SettingTypeString,
		Required: true,
		ReadOnly: false,
		Default:  string(VolumeAttachmentRecoveryPolicyWait),
		Choices: []string{
			string(VolumeAttachmentRecoveryPolicyNever),
			string(VolumeAttachmentRecoveryPolicyWait),
			string(VolumeAttachmentRecoveryPolicyImmediate),
		},
	}
	SettingDefinitionMkfsExt4Parameters = SettingDefinition{
		DisplayName: "Custom mkfs.ext4 parameters",
		Description: "Allows setting additional filesystem creation parameters for ext4. For older host kernels it might be necessary to disable the optional ext4 metadata_csum feature by specifying `-O ^64bit,^metadata_csum`",
		Category:    SettingCategoryGeneral,
		Type:        SettingTypeString,
		Required:    false,
		ReadOnly:    false,
	}
	SettingDefinitionPriorityClass = SettingDefinition{
		DisplayName: "Priority Class",
		Description: "The name of the Priority Class to set on the Longhorn workloads. This can help prevent Longhorn workloads from being evicted under Node Pressure.\nWARNING: DO NOT CHANGE THIS SETTING WITH ATTACHED VOLUMES.",
		Category:    SettingCategoryDangerZone,
		Required:    false,
		ReadOnly:    false,
	}
)
View Source
var (
	LonghornSystemKey = "longhorn"
)

Functions

func CreateDefaultDisk added in v0.8.1

func CreateDefaultDisk(dataPath string) (map[string]DiskSpec, error)

func CreateDisksFromAnnotation added in v0.8.1

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

func EngineBinaryExistOnHostForImage

func EngineBinaryExistOnHostForImage(image string) bool

func ErrorAlreadyExists added in v0.6.0

func ErrorAlreadyExists(err error) bool

func ErrorIsNotFound added in v0.6.0

func ErrorIsNotFound(err error) bool

func GenerateEngineNameForVolume

func GenerateEngineNameForVolume(vName string) string

func GenerateReplicaNameForVolume

func GenerateReplicaNameForVolume(vName string) string

func GetAPIServerAddressFromIP

func GetAPIServerAddressFromIP(ip string) string

func GetCronJobNameForVolumeAndJob

func GetCronJobNameForVolumeAndJob(vName, job string) string

func GetCustomizedDefaultSettings added in v0.6.0

func GetCustomizedDefaultSettings() (map[string]string, error)

func GetDaemonSetNameFromEngineImageName added in v0.6.0

func GetDaemonSetNameFromEngineImageName(engineImageName string) string

func GetDefaultManagerURL added in v1.0.1

func GetDefaultManagerURL() string

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 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, instanceManagerImage string, managerType InstanceManagerType) map[string]string

func GetInstanceManagerName added in v0.8.0

func GetInstanceManagerName(imType InstanceManagerType) (string, error)

func GetLonghornLabelComponentKey added in v0.6.0

func GetLonghornLabelComponentKey() string

func GetLonghornLabelKey added in v0.6.0

func GetLonghornLabelKey(name string) string

func GetNodeTagsFromAnnotation added in v0.8.1

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

func GetRegionAndZone added in v0.8.0

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

func GetReplicaMountedDataPath added in v0.6.0

func GetReplicaMountedDataPath(dataPath string) string

func GetVolumeLabels added in v0.7.0

func GetVolumeLabels(volumeName string) map[string]string

func LabelsToString added in v0.7.0

func LabelsToString(labels map[string]string) string

func OverwriteBuiltInSettingsWithCustomizedValues added in v0.6.0

func OverwriteBuiltInSettingsWithCustomizedValues() error

func SetCondition added in v0.8.1

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

func SetConditionAndRecord added in v0.8.1

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

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) ([]v1.Toleration, error)

func ValidateAndUnmarshalToleration added in v0.6.0

func ValidateAndUnmarshalToleration(s string) (*v1.Toleration, error)

func ValidateEngineImageChecksumName added in v0.8.0

func ValidateEngineImageChecksumName(name string) bool

func ValidateInitSetting added in v0.6.0

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

func ValidateReplicaCount added in v0.6.0

func ValidateReplicaCount(count int) error

Types

type BackupStatus added in v0.6.0

type BackupStatus struct {
	Progress       int    `json:"progress"`
	BackupURL      string `json:"backupURL,omitempty"`
	Error          string `json:"error,omitempty"`
	SnapshotName   string `json:"snapshotName"`
	State          string `json:"state"`
	ReplicaAddress string `json:"replicaAddress"`
}

type Condition

type Condition struct {
	Type               string          `json:"type"`
	Status             ConditionStatus `json:"status"`
	LastProbeTime      string          `json:"lastProbeTime"`
	LastTransitionTime string          `json:"lastTransitionTime"`
	Reason             string          `json:"reason"`
	Message            string          `json:"message"`
}

func GetCondition added in v0.8.1

func GetCondition(conditions map[string]Condition, conditionType string) Condition

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

type ConditionStatus

type ConditionStatus string
const (
	ConditionStatusTrue    ConditionStatus = "True"
	ConditionStatusFalse   ConditionStatus = "False"
	ConditionStatusUnknown ConditionStatus = "Unknown"
)

type DiskSpec

type DiskSpec struct {
	Path            string   `json:"path"`
	AllowScheduling bool     `json:"allowScheduling"`
	StorageReserved int64    `json:"storageReserved"`
	Tags            []string `json:"tags"`
}

type DiskSpecWithName added in v0.8.1

type DiskSpecWithName struct {
	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 DiskStatus

type DiskStatus struct {
	Conditions       map[string]Condition `json:"conditions"`
	StorageAvailable int64                `json:"storageAvailable"`
	StorageScheduled int64                `json:"storageScheduled"`
	StorageMaximum   int64                `json:"storageMaximum"`
	ScheduledReplica map[string]int64     `json:"scheduledReplica"`
	DiskUUID         string               `json:"diskUUID"`
}

func (*DiskStatus) DeepCopyInto

func (n *DiskStatus) DeepCopyInto(to *DiskStatus)

type EngineImageSpec

type EngineImageSpec struct {
	Image string `json:"image"`
}

type EngineImageState

type EngineImageState string

type EngineImageStatus

type EngineImageStatus struct {
	OwnerID    string               `json:"ownerID"`
	State      EngineImageState     `json:"state"`
	RefCount   int                  `json:"refCount"`
	NoRefSince string               `json:"noRefSince"`
	Conditions map[string]Condition `json:"conditions"`

	EngineVersionDetails
}

func (*EngineImageStatus) DeepCopyInto added in v0.8.1

func (ei *EngineImageStatus) DeepCopyInto(to *EngineImageStatus)

type EngineSpec

type EngineSpec struct {
	InstanceSpec
	Frontend                  VolumeFrontend    `json:"frontend"`
	ReplicaAddressMap         map[string]string `json:"replicaAddressMap"`
	UpgradedReplicaAddressMap map[string]string `json:"upgradedReplicaAddressMap"`
	BackupVolume              string            `json:"backupVolume"`
	RequestedBackupRestore    string            `json:"requestedBackupRestore"`
	DisableFrontend           bool              `json:"disableFrontend"`
}

func (*EngineSpec) DeepCopyInto

func (e *EngineSpec) DeepCopyInto(to *EngineSpec)

type EngineStatus

type EngineStatus struct {
	InstanceStatus
	CurrentSize              int64                     `json:"currentSize,string"`
	CurrentReplicaAddressMap map[string]string         `json:"currentReplicaAddressMap"`
	ReplicaModeMap           map[string]ReplicaMode    `json:"replicaModeMap"`
	Endpoint                 string                    `json:"endpoint"`
	LastRestoredBackup       string                    `json:"lastRestoredBackup"`
	BackupStatus             map[string]*BackupStatus  `json:"backupStatus"`
	RestoreStatus            map[string]*RestoreStatus `json:"restoreStatus"`
	PurgeStatus              map[string]*PurgeStatus   `json:"purgeStatus"`
	RebuildStatus            map[string]*RebuildStatus `json:"rebuildStatus"`
	Snapshots                map[string]*Snapshot      `json:"snapshots"`
	SnapshotsError           string                    `json:"snapshotsError"`
	IsExpanding              bool                      `json:"isExpanding"`
	LastExpansionError       string                    `json:"lastExpansionError"`
	LastExpansionFailedAt    string                    `json:"lastExpansionFailedAt"`
}

func (*EngineStatus) DeepCopyInto

func (e *EngineStatus) DeepCopyInto(to *EngineStatus)

type EngineVersionDetails

type EngineVersionDetails struct {
	Version   string `json:"version"`
	GitCommit string `json:"gitCommit"`
	BuildDate string `json:"buildDate"`

	CLIAPIVersion           int `json:"cliAPIVersion"`
	CLIAPIMinVersion        int `json:"cliAPIMinVersion"`
	ControllerAPIVersion    int `json:"controllerAPIVersion"`
	ControllerAPIMinVersion int `json:"controllerAPIMinVersion"`
	DataFormatVersion       int `json:"dataFormatVersion"`
	DataFormatMinVersion    int `json:"dataFormatMinVersion"`
}

type InstanceManagerSpec added in v0.6.0

type InstanceManagerSpec struct {
	Image  string              `json:"image"`
	NodeID string              `json:"nodeID"`
	Type   InstanceManagerType `json:"type"`

	// TODO: deprecate this field
	EngineImage string `json:"engineImage"`
}

type InstanceManagerState added in v0.6.0

type InstanceManagerState string

type InstanceManagerStatus added in v0.6.0

type InstanceManagerStatus struct {
	OwnerID       string                     `json:"ownerID"`
	CurrentState  InstanceManagerState       `json:"currentState"`
	Instances     map[string]InstanceProcess `json:"instances"`
	IP            string                     `json:"ip"`
	APIMinVersion int                        `json:"apiMinVersion"`
	APIVersion    int                        `json:"apiVersion"`
}

func (*InstanceManagerStatus) DeepCopyInto added in v0.6.0

func (n *InstanceManagerStatus) DeepCopyInto(to *InstanceManagerStatus)

type InstanceManagerType added in v0.6.0

type InstanceManagerType string

type InstanceProcess added in v0.6.0

type InstanceProcess struct {
	Spec   InstanceProcessSpec   `json:"spec"`
	Status InstanceProcessStatus `json:"status"`
}

type InstanceProcessSpec added in v0.6.0

type InstanceProcessSpec struct {
	Name string `json:"name"`
}

type InstanceProcessStatus added in v0.6.0

type InstanceProcessStatus struct {
	Endpoint        string        `json:"endpoint"`
	ErrorMsg        string        `json:"errorMsg"`
	Listen          string        `json:"listen"`
	PortEnd         int32         `json:"portEnd"`
	PortStart       int32         `json:"portStart"`
	State           InstanceState `json:"state"`
	Type            InstanceType  `json:"type"`
	ResourceVersion int64         `json:"resourceVersion"`
}

type InstanceSpec

type InstanceSpec struct {
	VolumeName   string        `json:"volumeName"`
	VolumeSize   int64         `json:"volumeSize,string"`
	NodeID       string        `json:"nodeID"`
	EngineImage  string        `json:"engineImage"`
	DesireState  InstanceState `json:"desireState"`
	LogRequested bool          `json:"logRequested"`
}

type InstanceState

type InstanceState string

type InstanceStatus

type InstanceStatus struct {
	OwnerID             string        `json:"ownerID"`
	InstanceManagerName string        `json:"instanceManagerName"`
	CurrentState        InstanceState `json:"currentState"`
	CurrentImage        string        `json:"currentImage"`
	IP                  string        `json:"ip"`
	Port                int           `json:"port"`
	Started             bool          `json:"started"`
	LogFetched          bool          `json:"logFetched"`
}

type InstanceType added in v0.6.0

type InstanceType string

type KubernetesStatus added in v0.5.0

type KubernetesStatus struct {
	PVName   string `json:"pvName"`
	PVStatus string `json:"pvStatus"`

	// determine if PVC/Namespace is history or not
	Namespace    string `json:"namespace"`
	PVCName      string `json:"pvcName"`
	LastPVCRefAt string `json:"lastPVCRefAt"`

	// determine if Pod/Workload is history or not
	WorkloadsStatus []WorkloadStatus `json:"workloadsStatus"`
	LastPodRefAt    string           `json:"lastPodRefAt"`
}

type NodeSpec

type NodeSpec struct {
	Name            string              `json:"name"`
	Disks           map[string]DiskSpec `json:"disks"`
	AllowScheduling bool                `json:"allowScheduling"`
	Tags            []string            `json:"tags"`
}

func (*NodeSpec) DeepCopyInto

func (n *NodeSpec) DeepCopyInto(to *NodeSpec)

type NodeStatus

type NodeStatus struct {
	Conditions map[string]Condition   `json:"conditions"`
	DiskStatus map[string]*DiskStatus `json:"diskStatus"`
	Region     string                 `json:"region"`
	Zone       string                 `json:"zone"`
}

func (*NodeStatus) DeepCopyInto

func (n *NodeStatus) DeepCopyInto(to *NodeStatus)

type NotFoundError

type NotFoundError struct {
	Name string
}

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

type PurgeStatus added in v0.6.0

type PurgeStatus struct {
	Error     string `json:"error"`
	IsPurging bool   `json:"isPurging"`
	Progress  int    `json:"progress"`
	State     string `json:"state"`
}

type RebuildStatus added in v0.8.0

type RebuildStatus struct {
	Error              string `json:"error"`
	IsRebuilding       bool   `json:"isRebuilding"`
	Progress           int    `json:"progress"`
	State              string `json:"state"`
	FromReplicaAddress string `json:"fromReplicaAddress"`
}

type RecurringJob

type RecurringJob struct {
	Name   string            `json:"name"`
	Task   RecurringJobType  `json:"task"`
	Cron   string            `json:"cron"`
	Retain int               `json:"retain"`
	Labels map[string]string `json:"labels"`
}

type RecurringJobType

type RecurringJobType string

type ReplicaMode

type ReplicaMode string

type ReplicaSpec

type ReplicaSpec struct {
	InstanceSpec
	EngineName string `json:"engineName"`
	HealthyAt  string `json:"healthyAt"`
	FailedAt   string `json:"failedAt"`
	DiskID     string `json:"diskID"`
	DataPath   string `json:"dataPath"`
	BaseImage  string `json:"baseImage"`
	Active     bool   `json:"active"`
}

type ReplicaStatus

type ReplicaStatus struct {
	InstanceStatus
}

type RestoreStatus added in v0.6.0

type RestoreStatus struct {
	IsRestoring  bool   `json:"isRestoring"`
	LastRestored string `json:"lastRestored"`
	Progress     int    `json:"progress,omitempty"`
	Error        string `json:"error,omitempty"`
	Filename     string `json:"filename,omitempty"`
	State        string `json:"state"`
	BackupURL    string `json:"backupURL"`
}

type Setting

type Setting struct {
	Value string `json:"value"`
}

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
}

type SettingName

type SettingName string

type SettingType

type SettingType string

type Snapshot added in v0.8.1

type Snapshot struct {
	Name        string            `json:"name"`
	Parent      string            `json:"parent"`
	Children    map[string]bool   `json:"children"`
	Removed     bool              `json:"removed"`
	UserCreated bool              `json:"usercreated"`
	Created     string            `json:"created"`
	Size        string            `json:"size"`
	Labels      map[string]string `json:"labels"`
}

type VolumeAttachmentRecoveryPolicy added in v1.0.0

type VolumeAttachmentRecoveryPolicy string

type VolumeFrontend

type VolumeFrontend string

type VolumeRobustness

type VolumeRobustness string

type VolumeSpec

type VolumeSpec struct {
	Size                int64          `json:"size,string"`
	Frontend            VolumeFrontend `json:"frontend"`
	FromBackup          string         `json:"fromBackup"`
	NumberOfReplicas    int            `json:"numberOfReplicas"`
	StaleReplicaTimeout int            `json:"staleReplicaTimeout"`
	NodeID              string         `json:"nodeID"`
	EngineImage         string         `json:"engineImage"`
	RecurringJobs       []RecurringJob `json:"recurringJobs"`
	BaseImage           string         `json:"baseImage"`
	Standby             bool           `json:"Standby"`
	DiskSelector        []string       `json:"diskSelector"`
	NodeSelector        []string       `json:"nodeSelector"`
	DisableFrontend     bool           `json:"disableFrontend"`
}

func (*VolumeSpec) DeepCopyInto

func (v *VolumeSpec) DeepCopyInto(to *VolumeSpec)

type VolumeState

type VolumeState string

type VolumeStatus

type VolumeStatus struct {
	OwnerID                    string               `json:"ownerID"`
	State                      VolumeState          `json:"state"`
	Robustness                 VolumeRobustness     `json:"robustness"`
	CurrentNodeID              string               `json:"currentNodeID"`
	CurrentImage               string               `json:"currentImage"`
	KubernetesStatus           KubernetesStatus     `json:"kubernetesStatus"`
	Conditions                 map[string]Condition `json:"conditions"`
	LastBackup                 string               `json:"lastBackup"`
	LastBackupAt               string               `json:"lastBackupAt"`
	PendingNodeID              string               `json:"pendingNodeID"`
	FrontendDisabled           bool                 `json:"frontendDisabled"`
	InitialRestorationRequired bool                 `json:"initialRestorationRequired"`
	RestoreInitiated           bool                 `json:"restoreInitiated"`
	RemountRequired            bool                 `json:"remountRequired"`
	ExpansionRequired          bool                 `json:"expansionRequired"`
	IsStandby                  bool                 `json:"isStandby"`
	ActualSize                 int64                `json:"actualSize"`
}

func (*VolumeStatus) DeepCopyInto

func (v *VolumeStatus) DeepCopyInto(to *VolumeStatus)

type WorkloadStatus added in v0.5.0

type WorkloadStatus struct {
	PodName      string `json:"podName"`
	PodStatus    string `json:"podStatus"`
	WorkloadName string `json:"workloadName"`
	WorkloadType string `json:"workloadType"`
}

Jump to

Keyboard shortcuts

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