Documentation ¶
Index ¶
- Constants
- Variables
- func AddFinalizer(name string, obj runtime.Object) error
- func AutoCorrectName(name string, maxLength int) string
- func Backoff(maxDuration time.Duration, timeoutMessage string, f func() (bool, error)) error
- func CapitalizeFirstLetter(input string) string
- func CheckBackupType(backupTarget string) (string, error)
- func CmdOutLines(cmd *exec.Cmd, cancel <-chan interface{}) (<-chan string, <-chan error)
- func Contains(list []string, item string) bool
- func ConvertFirstCharToLower(input string) string
- func ConvertSize(size interface{}) (int64, error)
- func ConvertToCamel(input, separator string) string
- func CopyReq(req *http.Request) *http.Request
- func CreateDiskPathReplicaSubdirectory(path string) error
- func DeleteDiskPathReplicaSubdirectoryAndDiskCfgFile(nsExec *iscsiutil.NamespaceExecutor, path string) error
- func DeleteReplicaDirectory(diskPath, replicaDirectoryName string) (err error)
- func DeterministicUUID(data string) string
- func EncodeToYAMLFile(obj interface{}, path string) (err error)
- func ExecuteWithTimeout(timeout time.Duration, envs []string, binary string, args ...string) (string, error)
- func ExecuteWithoutTimeout(envs []string, binary string, args ...string) (string, error)
- func FilteredLoggingHandler(filteredPaths map[string]struct{}, writer io.Writer, router http.Handler) http.Handler
- func FinalizerExists(name string, obj runtime.Object) bool
- func FormatLocalTime(t time.Time, loc *time.Location) string
- func FormatTimeZ(t time.Time) string
- func FromMillis(t int64) time.Time
- func GetAnnotation(obj runtime.Object, annotationKey string) (string, error)
- func GetBackupID(backupURL string) (string, error)
- func GetChecksumSHA256(data []byte) string
- func GetChecksumSHA512(data []byte) string
- func GetDistinctTolerations(tolerationList []corev1.Toleration) []corev1.Toleration
- func GetHostKernelRelease() (string, error)
- func GetHostOSDistro() (string, error)
- func GetLocalIPs() ([]string, error)
- func GetNamespace(key string) string
- func GetNodeSelectorTermMatchExpressionNodeName(nodeName string) corev1.NodeSelectorTerm
- func GetPodIP(pod *corev1.Pod) (string, error)
- func GetPossibleReplicaDirectoryNames(diskPath string) (replicaDirectoryNames map[string]string, err error)
- func GetRequiredEnv(key string) (string, error)
- func GetSchemeFromURL(url string) string
- func GetSortedKeysFromMap(maps interface{}) []string
- func GetStringChecksum(data string) string
- func GetStringChecksumSHA256(data string) string
- func GetStringHash(data string) string
- func GetTolerationChecksum(t corev1.Toleration) string
- func HasLocalStorageInDeployment(deployment *appsv1.Deployment) bool
- func IsKubernetesDefaultToleration(toleration corev1.Toleration) bool
- func IsKubernetesVersionAtLeast(kubeClient clientset.Interface, vers string) (bool, error)
- func LimitToPeriod(p, t [2]time.Time) [2]time.Time
- func MinInt(a, b int) int
- func Now() string
- func ParseLabels(labels []string) (map[string]string, error)
- func ParseLocalTime(ts string, loc *time.Location) (time.Time, error)
- func ParsePeriod(s string, loc *time.Location) ([2]time.Time, error)
- func ParseTime(t string) (time.Time, error)
- func ParseTimeZ(s string) (time.Time, error)
- func RandomID() string
- func RegisterShutdownChannel(done chan struct{})
- func RemoveFinalizer(name string, obj runtime.Object) error
- func RemoveHostDirectoryContent(directory string) (err error)
- func RemoveNewlines(input string) string
- func RetryOnConflictCause(fn func() (interface{}, error)) (interface{}, error)
- func RetryOnErrorCondition(fn func() (interface{}, error), predicate func(error) bool) (interface{}, error)
- func RetryOnNotFoundCause(fn func() (interface{}, error)) (interface{}, error)
- func RoundUpSize(size int64) int64
- func RunAsync(wg *sync.WaitGroup, f func())
- func SetAnnotation(obj runtime.Object, annotationKey, annotationValue string) error
- func SortKeys(mapObj interface{}) ([]string, error)
- func SplitStringToMap(str, separator string) map[string]struct{}
- func TimestampAfterTimeout(ts string, timeout time.Duration) bool
- func TimestampWithinLimit(latest time.Time, ts string, limit time.Duration) bool
- func TolerationListToMap(tolerationList []corev1.Toleration) map[string]corev1.Toleration
- func TrimFilesystem(volumeName string, encryptedDevice bool) error
- func UUID() string
- func ValidateChecksumSHA512(checksum string) bool
- func ValidateName(name string) bool
- func ValidateRandomID(id string) bool
- func ValidateSnapshotLabels(labels map[string]string) (map[string]string, error)
- func ValidateTags(inputTags []string) ([]string, error)
- func VerifySnapshotLabels(labels map[string]string) error
- func WaitForAPI(url string, timeout int) error
- func WaitForDevice(dev string, timeout int) error
- func WaitForResourceDeletion(kubeClient *clientset.Clientset, name, namespace, resource string, ...) error
- type AtomicCounter
- type Counter
- type DiskConfig
- type DiskStat
- type ExecuteFunc
- type FsStat
- type InformerFactories
- type MetadataConfig
- type MultiError
- type ResourceGetFunc
- type StructField
- type StructFields
- type StructName
- type VolumeMeta
Constants ¶
const ( VolumeStackPrefix = "volume-" ControllerServiceName = "controller" ReplicaServiceName = "replica" HostProcPath = "/host/proc" ReplicaDirectory = "/replicas/" RegularDeviceDirectory = "/dev/longhorn/" EncryptedDeviceDirectory = "/dev/mapper/" TemporaryMountPointDirectory = "/tmp/mnt/" DefaultKubernetesTolerationKey = "kubernetes.io" DiskConfigFile = "longhorn-disk.cfg" SizeAlignment = 2 * 1024 * 1024 MinimalVolumeSize = 10 * 1024 * 1024 RandomIDLenth = 8 DeterministicUUIDNamespace = "08958d54-65cd-4d87-8627-9831a1eab170" // Arbitrarily generated. )
const (
OsReleasePath = "/etc/os-release"
)
Variables ¶
var ( APIRetryInterval = 500 * time.Millisecond APIRetryJitterInterval = 50 * time.Millisecond APIRetryCounts = 10 )
Functions ¶
func AutoCorrectName ¶ added in v1.1.1
AutoCorrectName converts name to lowercase, and correct overlength name by replaces the name suffix with 8 char from its checksum to ensure uniquenedoss.
func CapitalizeFirstLetter ¶ added in v1.4.0
func CheckBackupType ¶
func CmdOutLines ¶
func ConvertFirstCharToLower ¶ added in v1.5.0
func ConvertSize ¶
func ConvertToCamel ¶ added in v1.5.0
func CreateDiskPathReplicaSubdirectory ¶ added in v0.8.1
func DeleteDiskPathReplicaSubdirectoryAndDiskCfgFile ¶ added in v1.0.0
func DeleteDiskPathReplicaSubdirectoryAndDiskCfgFile( nsExec *iscsiutil.NamespaceExecutor, path string) error
func DeleteReplicaDirectory ¶ added in v1.5.0
func DeterministicUUID ¶ added in v1.4.3
DeterministicUUID returns a string representation of a version 5 UUID based on the provided string. The output is always the same for a given input. For example, the volume controller calls this function with the concatenated UIDs of two Longhorn volumes: DeterministicUUID("5d8209ef-87ee-422e-9fd7-5b400f985f315d8209ef-87ee-422e-9fd7-5b400f985f31") -> "25bc2af7-30ea-50cf-afc7-900275ba5866"
func EncodeToYAMLFile ¶ added in v1.4.0
func ExecuteWithTimeout ¶
func ExecuteWithoutTimeout ¶ added in v0.6.0
func FilteredLoggingHandler ¶ added in v0.4.1
func FormatTimeZ ¶
func FromMillis ¶
func GetAnnotation ¶ added in v1.1.0
func GetBackupID ¶
func GetChecksumSHA256 ¶ added in v1.3.0
func GetChecksumSHA512 ¶
func GetDistinctTolerations ¶ added in v1.1.0
func GetDistinctTolerations(tolerationList []corev1.Toleration) []corev1.Toleration
func GetHostKernelRelease ¶ added in v1.5.0
GetHostKernelRelease retrieves the kernel release version of the host.
func GetHostOSDistro ¶ added in v1.5.0
GetHostOSDistro retrieves the operating system distribution of the host.
func GetLocalIPs ¶
func GetNamespace ¶ added in v1.5.0
func GetNodeSelectorTermMatchExpressionNodeName ¶ added in v1.4.3
func GetNodeSelectorTermMatchExpressionNodeName(nodeName string) corev1.NodeSelectorTerm
func GetPossibleReplicaDirectoryNames ¶ added in v1.3.0
func GetRequiredEnv ¶
func GetSchemeFromURL ¶ added in v1.5.0
func GetSortedKeysFromMap ¶ added in v1.1.2
func GetSortedKeysFromMap(maps interface{}) []string
func GetStringChecksum ¶
func GetStringChecksumSHA256 ¶ added in v1.3.0
func GetStringHash ¶ added in v1.2.0
func GetTolerationChecksum ¶ added in v1.1.0
func GetTolerationChecksum(t corev1.Toleration) string
func HasLocalStorageInDeployment ¶ added in v1.3.0
func HasLocalStorageInDeployment(deployment *appsv1.Deployment) bool
HasLocalStorageInDeployment returns true if deployment has any local storage.
func IsKubernetesDefaultToleration ¶ added in v0.6.0
func IsKubernetesDefaultToleration(toleration corev1.Toleration) bool
func IsKubernetesVersionAtLeast ¶ added in v0.8.0
func ParseLabels ¶
ParseLabels parses the provided Labels based on longhorn-engine's implementation: https://github.com/longhorn/longhorn-engine/blob/master/util/util.go
func RegisterShutdownChannel ¶
func RegisterShutdownChannel(done chan struct{})
func RemoveHostDirectoryContent ¶ added in v0.3.3
func RemoveNewlines ¶ added in v1.5.0
func RetryOnConflictCause ¶
func RetryOnErrorCondition ¶ added in v1.2.0
func RetryOnNotFoundCause ¶ added in v1.2.0
func RoundUpSize ¶
func SetAnnotation ¶ added in v1.1.0
func SortKeys ¶ added in v1.4.0
SortKeys accepts a map with string keys and returns a sorted slice of keys
func SplitStringToMap ¶
func TimestampWithinLimit ¶ added in v0.8.0
func TolerationListToMap ¶ added in v0.6.0
func TolerationListToMap(tolerationList []corev1.Toleration) map[string]corev1.Toleration
func TrimFilesystem ¶ added in v1.4.0
func ValidateChecksumSHA512 ¶ added in v1.2.3
func ValidateName ¶
func ValidateRandomID ¶ added in v1.3.0
func ValidateSnapshotLabels ¶ added in v0.6.0
func ValidateTags ¶ added in v0.6.0
func VerifySnapshotLabels ¶ added in v1.5.0
func WaitForDevice ¶
WaitForDevice timeout in second
func WaitForResourceDeletion ¶ added in v1.5.1
Types ¶
type AtomicCounter ¶ added in v1.3.0
type AtomicCounter struct {
// contains filtered or unexported fields
}
func (*AtomicCounter) DecreaseCount ¶ added in v1.3.0
func (ac *AtomicCounter) DecreaseCount()
func (*AtomicCounter) GetCount ¶ added in v1.3.0
func (ac *AtomicCounter) GetCount() int32
func (*AtomicCounter) IncreaseCount ¶ added in v1.3.0
func (ac *AtomicCounter) IncreaseCount()
func (*AtomicCounter) ResetCount ¶ added in v1.3.0
func (ac *AtomicCounter) ResetCount()
type Counter ¶ added in v1.3.0
type Counter interface { GetCount() int32 IncreaseCount() DecreaseCount() ResetCount() }
func NewAtomicCounter ¶ added in v1.3.0
func NewAtomicCounter() Counter
type DiskConfig ¶ added in v0.8.1
type DiskConfig struct {
DiskUUID string `json:"diskUUID"`
}
type DiskStat ¶ added in v1.3.0
type DiskStat struct { DiskID string Path string Type string FreeBlocks int64 TotalBlocks int64 BlockSize int64 StorageMaximum int64 StorageAvailable int64 }
func GetDiskStat ¶ added in v1.3.0
type ExecuteFunc ¶ added in v1.5.0
var Execute ExecuteFunc = execute
Execute is a variable holding the function responsible for executing commands. By using a variable for the execution function, it allows for easier unit testing by substituting a mock implementation.
type InformerFactories ¶ added in v1.5.2
type InformerFactories struct { KubeInformerFactory informers.SharedInformerFactory KubeNamespaceFilteredInformerFactory informers.SharedInformerFactory LhInformerFactory lhinformers.SharedInformerFactory }
func NewInformerFactories ¶ added in v1.5.2
func (*InformerFactories) Start ¶ added in v1.5.2
func (f *InformerFactories) Start(stopCh <-chan struct{})
type MetadataConfig ¶
type MultiError ¶ added in v1.2.5
type MultiError map[string]struct{}
func NewMultiError ¶ added in v1.2.5
func NewMultiError(errs ...string) MultiError
func (MultiError) Append ¶ added in v1.2.5
func (me MultiError) Append(errs MultiError)
func (MultiError) Join ¶ added in v1.2.5
func (me MultiError) Join() string
func (MultiError) Reset ¶ added in v1.4.0
func (me MultiError) Reset()
type ResourceGetFunc ¶ added in v1.5.1
type StructField ¶ added in v1.5.0
StructField contains information about a single field in a struct.
type StructFields ¶ added in v1.5.0
type StructFields []StructField
func (*StructFields) Append ¶ added in v1.5.0
func (sf *StructFields) Append(name StructName, value interface{})
func (*StructFields) AppendCounted ¶ added in v1.5.0
func (sf *StructFields) AppendCounted(structMap map[StructName]int)
func (*StructFields) ConvertTag ¶ added in v1.5.0
func (sf *StructFields) ConvertTag(name StructName) string
func (*StructFields) NewStruct ¶ added in v1.5.0
func (sf *StructFields) NewStruct() interface{}
NewStruct creates a new struct based on the StructFields slice. Returns the new struct as an interface{}.
type StructName ¶ added in v1.5.0
type StructName string
type VolumeMeta ¶ added in v1.3.0
type VolumeMeta struct { Size int64 Head string Dirty bool Rebuilding bool Error string Parent string SectorSize int64 BackingFilePath string BackingFile interface{} }
func GetVolumeMeta ¶ added in v1.3.0
func GetVolumeMeta(path string) (*VolumeMeta, error)