types

package
v0.5.0-rc1 Latest Latest
Warning

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

Go to latest
Published: May 14, 2019 License: Apache-2.0 Imports: 6 Imported by: 25

Documentation

Index

Constants

View Source
const (
	LonghornManagerDaemonSetName = "longhorn-manager"

	DriverDeployerName = "longhorn-driver-deployer"
	CSIAttacherName    = "csi-attacher"
	CSIProvisionerName = "csi-provisioner"
	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")
)
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")
)
View Source
const (
	EngineImageStateDeploying    = "deploying"
	EngineImageStateReady        = "ready"
	EngineImageStateIncompatible = "incompatible"
	EngineImageStateError        = "error"
)
View Source
const (
	NodeConditionTypeReady            = "Ready"
	NodeConditionTypeMountPropagation = "MountPropagation"
)
View Source
const (
	NodeConditionReasonManagerPodDown            = "ManagerPodDown"
	NodeConditionReasonManagerPodMissing         = "ManagerPodMissing"
	NodeConditionReasonKubernetesNodeGone        = "KubernetesNodeGone"
	NodeConditionReasonKubernetesNodeNotReady    = "KubernetesNodeNotReady"
	NodeConditionReasonKubernetesNodePressure    = "KubernetesNodePressure"
	NodeConditionReasonUnknownNodeConditionTrue  = "UnknownNodeConditionTrue"
	NodeConditionReasonNoMountPropagationSupport = "NoMountPropagationSupport"
)
View Source
const (
	DiskConditionTypeSchedulable = "Schedulable"
	DiskConditionTypeReady       = "Ready"
)
View Source
const (
	DiskConditionReasonDiskPressure          = "DiskPressure"
	DiskConditionReasonDiskFilesystemChanged = "DiskFilesystemChanged"
	DiskConditionReasonNoDiskInfo            = "NoDiskInfo"
)
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")
	SettingNameDefaultEngineImage                = SettingName("default-engine-image")
	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")
)
View Source
const (
	SettingCategoryGeneral    = SettingCategory("general")
	SettingCategoryBackup     = SettingCategory("backup")
	SettingCategoryScheduling = SettingCategory("scheduling")
)
View Source
const (
	DefaultAPIPort = 9500

	DefaultEngineBinaryPath          = "/usr/local/bin/longhorn"
	EngineBinaryDirectoryInContainer = "/engine-binaries/"
	EngineBinaryDirectoryOnHost      = "/var/lib/rancher/longhorn/engine-binaries/"

	// DefaultLonghornDirectory is the directory going to be bind mounted on the
	// host to provide storage space to replica data by default
	DefaultLonghornDirectory = "/var/lib/rancher/longhorn/"

	LonghornNodeKey = "longhornnode"

	BaseImageLabel = "ranchervm-base-image"
)
View Source
const (
	CSIMinVersion                  = "v1.10.0"
	KubeletPluginWatcherMinVersion = "v1.12.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"

	OptionFromBackup          = "fromBackup"
	OptionNumberOfReplicas    = "numberOfReplicas"
	OptionStaleReplicaTimeout = "staleReplicaTimeout"
	OptionBaseImage           = "baseImage"
	OptionFrontend            = "frontend"

	DefaultStaleReplicaTimeout = "30"

	EngineImageChecksumNameLength = 8
)
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
)
View Source
const (
	VolumeConditionReasonReplicaSchedulingFailure = "ReplicaSchedulingFailure"
)
View Source
const (
	VolumeConditionTypeScheduled = "scheduled"
)

Variables

View Source
var (
	SettingDefinitions = map[SettingName]SettingDefinition{
		SettingNameBackupTarget:                      SettingDefinitionBackupTarget,
		SettingNameBackupTargetCredentialSecret:      SettingDefinitionBackupTargetCredentialSecret,
		SettingNameDefaultEngineImage:                SettingDefinitionDefaultEngineImage,
		SettingNameStorageOverProvisioningPercentage: SettingDefinitionStorageOverProvisioningPercentage,
		SettingNameStorageMinimalAvailablePercentage: SettingDefinitionStorageMinimalAvailablePercentage,
		SettingNameUpgradeChecker:                    SettingDefinitionUpgradeChecker,
		SettingNameLatestLonghornVersion:             SettingDefinitionLatestLonghornVersion,
		SettingNameDefaultReplicaCount:               SettingDefinitionDefaultReplicaCount,
		SettingNameGuaranteedEngineCPU:               SettingDefinitionGuaranteedEngineCPU,
		SettingNameDefaultLonghornStaticStorageClass: SettingDefinitionDefaultLonghornStaticStorageClass,
		SettingNameBackupstorePollInterval:           SettingDefinitionBackupstorePollInterval,
	}

	SettingDefinitionBackupTarget = SettingDefinition{
		DisplayName: "Backup Target",
		Description: "The target used for backup. Support NFS or S3.",
		Category:    SettingCategoryBackup,
		Type:        SettingTypeString,
		Required:    false,
		ReadOnly:    false,
	}

	SettingDefinitionBackupTargetCredentialSecret = SettingDefinition{
		DisplayName: "Backup Target Credential Secret",
		Description: "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 interval to poll the backup store for updating volumes' Last Backup field.",
		Category:    SettingCategoryBackup,
		Type:        SettingTypeInt,
		Required:    true,
		ReadOnly:    false,
		Default:     "300",
	}

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

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

	SettingDefinitionStorageMinimalAvailablePercentage = SettingDefinition{
		DisplayName: "Storage Minimal Available Percentage",
		Description: "If one disk's available capacity to it's maximum capacity in % is less than the minimal available percentage, the disk would become unschedulable until more space freed up.",
		Category:    SettingCategoryScheduling,
		Type:        SettingTypeInt,
		Required:    true,
		ReadOnly:    false,
		Default:     "10",
	}

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

	SettingDefinitionLatestLonghornVersion = SettingDefinition{
		DisplayName: "Latest Longhorn Version",
		Description: "The latest version of Longhorn available. Update 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 creating the volume from Longhorn UI. For Kubernetes, update the `numberOfReplicas` in the StorageClass",
		Category:    SettingCategoryGeneral,
		Type:        SettingTypeInt,
		Required:    true,
		ReadOnly:    false,
		Default:     "3",
	}

	SettingDefinitionGuaranteedEngineCPU = SettingDefinition{
		DisplayName: "Guaranteed Engine CPU",
		Description: "(EXPERIMENTAL FEATURE) Allow Longhorn Engine to have guaranteed CPU allocation. The value is how many CPUs should be reserved for one Longhorn engine or replica. For example, 0.1 means one-tenth of a CPU. This will help the engine stability during the high node workload. It only applies to the volumes attached after the setting took effect. WARNING: Attaching of the volume may fail or stuck while using this feature due to the resource constraint. Disabled (\"0\") by default.",
		Category:    SettingCategoryGeneral,
		Type:        SettingTypeInt,
		Required:    true,
		ReadOnly:    false,
		Default:     "0",
	}

	SettingDefinitionDefaultLonghornStaticStorageClass = SettingDefinition{
		DisplayName: "Default Longhorn Static StorageClass Name",
		Description: "The 'storageClassName' is for PV/PVC when creating PV/PVC for an existing Longhorn volume. Notice that it's unnecessary for users create the related StorageClass object in Kubernetes since the StorageClass would only be used as matching labels for PVC bounding purpose. By default 'longhorn-static'.",
		Category:    SettingCategoryGeneral,
		Type:        SettingTypeString,
		Required:    false,
		ReadOnly:    false,
		Default:     "longhorn-static",
	}
)
View Source
var (
	LonghornSystemKey              = "longhorn"
	LonghornSystemValueManager     = "manager"
	LonghornSystemValueEngineImage = "engine-image"
)

Functions

func EngineBinaryExistOnHostForImage

func EngineBinaryExistOnHostForImage(image string) 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 GetEngineBinaryDirectoryInContainerForImage

func GetEngineBinaryDirectoryInContainerForImage(image string) string

func GetEngineBinaryDirectoryOnHostForImage

func GetEngineBinaryDirectoryOnHostForImage(image string) string

func GetEngineImageChecksumName

func GetEngineImageChecksumName(image string) string

func GetEngineImageLabel

func GetEngineImageLabel() map[string]string

func GetImageCanonicalName

func GetImageCanonicalName(image string) string

Types

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 GetDiskConditionFromStatus

func GetDiskConditionFromStatus(status DiskStatus, conditionType DiskConditionType) Condition

func GetNodeConditionFromStatus

func GetNodeConditionFromStatus(status NodeStatus, conditionType NodeConditionType) Condition

func GetVolumeConditionFromStatus

func GetVolumeConditionFromStatus(status VolumeStatus, conditionType VolumeConditionType) Condition

GetVolumeConditionFromStatus returns a copy of v.Status.Condition[conditionType]

type ConditionStatus

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

type DiskConditionType

type DiskConditionType string

type DiskSpec

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

type DiskStatus

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

func (*DiskStatus) DeepCopyInto

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

type EngineImageSpec

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

type EngineImageState

type EngineImageState string

type EngineImageStatus

type EngineImageStatus struct {
	State      EngineImageState `json:"state"`
	RefCount   int              `json:"refCount"`
	NoRefSince string           `json:"noRefSince"`

	EngineVersionDetails
}

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

func (*EngineSpec) DeepCopyInto

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

type EngineStatus

type EngineStatus struct {
	InstanceStatus
	ReplicaModeMap     map[string]ReplicaMode `json:"replicaModeMap"`
	Endpoint           string                 `json:"endpoint"`
	LastRestoredBackup string                 `json:"lastRestoredBackup"`
}

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 InstanceSpec

type InstanceSpec struct {
	OwnerID      string        `json:"ownerID"`
	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 {
	CurrentState InstanceState `json:"currentState"`
	CurrentImage string        `json:"currentImage"`
	IP           string        `json:"ip"`
	Started      bool          `json:"started"`
	NodeBootID   string        `json:"nodeBootID"`
}

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 NodeConditionType

type NodeConditionType string

type NodeSpec

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

func (*NodeSpec) DeepCopyInto

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

type NodeStatus

type NodeStatus struct {
	Conditions map[NodeConditionType]Condition `json:"conditions"`
	DiskStatus map[string]DiskStatus           `json:"diskStatus"`
}

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 RecurringJob

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

type RecurringJobType

type RecurringJobType string

type ReplicaMode

type ReplicaMode string

type ReplicaSpec

type ReplicaSpec struct {
	InstanceSpec
	EngineName  string `json:"engineName"`
	RestoreFrom string `json:"restoreFrom"`
	RestoreName string `json:"restoreName"`
	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 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"`
}

type SettingName

type SettingName string

type SettingType

type SettingType string

type VolumeConditionType

type VolumeConditionType string

type VolumeFrontend

type VolumeFrontend string

type VolumeRobustness

type VolumeRobustness string

type VolumeSpec

type VolumeSpec struct {
	OwnerID             string         `json:"ownerID"`
	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"`
	MigrationNodeID     string         `json:"migrationNodeID"`
	PendingNodeID       string         `json:"pendingNodeID"`
	EngineImage         string         `json:"engineImage"`
	RecurringJobs       []RecurringJob `json:"recurringJobs"`
	BaseImage           string         `json:"baseImage"`
	Standby             bool           `json:"Standby"`
}

func (*VolumeSpec) DeepCopyInto

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

type VolumeState

type VolumeState string

type VolumeStatus

type VolumeStatus struct {
	State            VolumeState                       `json:"state"`
	Robustness       VolumeRobustness                  `json:"robustness"`
	CurrentImage     string                            `json:"currentImage"`
	KubernetesStatus KubernetesStatus                  `json:"kubernetesStatus"`
	Conditions       map[VolumeConditionType]Condition `json:"conditions"`
	LastBackup       string                            `json:"lastBackup"`
	LastBackupAt     string                            `json:"lastBackupAt"`
}

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