utils

package
v0.0.6-beta-1 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2022 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FetchDiskInfo added in v0.0.6

func FetchDiskInfo(addr string) (map[string]float64, error)

FetchDiskInfo calls 'df' on the remote address

func GetNamePrefix added in v0.0.5

func GetNamePrefix(am discoblocksondatiov1.AvailabilityMode, configUID, nodeName string) string

GetNamePrefix returns the prefix by availability type

func GetTargetNodeByAffinity added in v0.0.6

func GetTargetNodeByAffinity(affinit *corev1.Affinity) string

GetTargetNodeByAffinity tries to find node by affinity

func Hash

func Hash(s string) (uint32, error)

Hash calculates has of the given string

func IsContainsAll

func IsContainsAll(a, b map[string]string) bool

IsContainsAll finds for a contains all b

func IsOwnedByDaemonSet added in v0.0.6

func IsOwnedByDaemonSet(pod *corev1.Pod) bool

IsOwnedByDaemonSet detects is parent DaemonSet

func NewPVC added in v0.0.5

NewPVC constructs a new PVC instance

func NewStorageClass added in v0.0.6

func NewStorageClass(sc *storagev1.StorageClass, scAllowedTopology []corev1.TopologySelectorTerm) (*storagev1.StorageClass, error)

NewStorageClass constructs a new StorageClass

func ParseCapacity

func ParseCapacity(capacity string) (uint16, string, error)

func RenderFinalizer

func RenderFinalizer(name string, extras ...string) string

RenderFinalizer calculates finalizer name

func RenderMetricsSidecar added in v0.0.2

func RenderMetricsSidecar() (*corev1.Container, error)

RenderMetricsSidecar returns the metrics sidecar

func RenderMountJob added in v0.0.6

func RenderMountJob(pvcName, pvName, namespace, nodeName, fs, mountPoint string, containerIDs []string, preMountCommand, volumeMeta string, owner metav1.OwnerReference) (*batchv1.Job, error)

RenderMountJob returns the mount job executed on host

func RenderMountPoint

func RenderMountPoint(pattern, name string, index int) string

RenderMountPoint calculates mount point

func RenderResizeJob added in v0.0.6

func RenderResizeJob(pvcName, pvName, namespace, nodeName, fs, preResizeCommand, volumeMeta string, owner metav1.OwnerReference) (*batchv1.Job, error)

RenderResizeJob returns the resize job executed on host

func RenderResourceName added in v0.0.5

func RenderResourceName(prefix bool, elems ...string) (string, error)

RenderResourceName calculates resource name

func RenderUniqueLabel added in v0.0.6

func RenderUniqueLabel(id string) string

RenderUniqueLabel renders DiskConfig label

func Telnet added in v0.0.6

func Telnet(addr string) (lines []string, err error)

Telnet calls endpoint and reads response

func WaitForSemaphore added in v0.0.2

func WaitForSemaphore(ctx context.Context, sem Semaphore) (func(), error)

WaitForSemaphore waits until context cancel

Types

type Semaphore added in v0.0.2

type Semaphore func() (bool, func())

Semaphore

func CreateSemaphore

func CreateSemaphore(concurrency int, wait time.Duration) Semaphore

CreateSemaphore creates a new semaphore to limit concurrency

Jump to

Keyboard shortcuts

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