utils

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2023 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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 NewStorageClass added in v0.0.6

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

NewStorageClass constructs a new StorageClass

func PVCDecorator added in v0.0.6

func PVCDecorator(config *discoblocksondatiov1.DiskConfig, prefix string, driver *drivers.Driver, pvc *corev1.PersistentVolumeClaim)

PVCDecorator decorates new PVC instance

func ParseCapacity

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

func ReadFileOrDie added in v0.0.7

func ReadFileOrDie(path string) []byte

ReadFileOrDie reads the file or die

func RenderFinalizer

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

RenderFinalizer calculates finalizer name

func RenderMetricsProxySidecar added in v0.0.7

func RenderMetricsProxySidecar(name, namespace string) (*corev1.Container, error)

RenderMetricsProxySidecar returns the metrics sidecar

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(podName, 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(podName, 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 WaitForSemaphore added in v0.0.2

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

WaitForSemaphore waits until context cancel

Types

type EventService added in v0.0.6

type EventService interface {
	SendWarning(string, string, string, string, string, client.Object, client.Object) error
	SendNormal(string, string, string, string, string, client.Object, client.Object) error
}

EventService main interface of event service

func NewEventService added in v0.0.6

func NewEventService(controllerID string, k8sClient client.Client) EventService

NewEventService creates a new event service

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