types

package
v0.3.2-rc1 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2018 License: Apache-2.0 Imports: 6 Imported by: 13

Documentation

Index

Constants

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"
	NodeConditionReasonKubernetesNodeDown        = "KubernetesNodeDown"
	NodeConditionReasonKubernetesNodeNotReady    = "KubernetesNodeNotReady"
	NodeConditionReasonKubernetesNodePressure    = "KubernetesNodePressure"
	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")
)
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"

	DefaultNumberOfReplicas    = "3"
	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,
	}

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

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

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

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

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

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

	Conditions map[VolumeConditionType]Condition `json:"conditions"`
}

func (*VolumeStatus) DeepCopyInto

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

Jump to

Keyboard shortcuts

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