utils

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: May 16, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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 ParseCapacity

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

func ParsePrometheusMetric added in v0.0.2

func ParsePrometheusMetric(metric string) (map[string]*dto.MetricFamily, error)

ParsePrometheusMetric parses Prometheus metrisc details

func ParsePrometheusMetricValue added in v0.0.2

func ParsePrometheusMetricValue(metric string) (float64, error)

ParsePrometheusMetricValue parses Prometheus metrisc value

func RenderFinalizer

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

RenderFinalizer calculates finalizer name

func RenderManagerSidecar added in v0.0.2

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

RenderManagerSidecar returns the manager sidecar

func RenderMetricsService added in v0.0.2

func RenderMetricsService(name, namespace string) (*corev1.Service, error)

RenderMetricsService returns the metrics service

func RenderMetricsSidecar added in v0.0.2

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

RenderMetricsSidecar returns the metrics sidecar

func RenderMountPoint

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

RenderMountPoint calculates mount point

func RenderPVCName

func RenderPVCName(elems ...string) (string, error)

RenderPVCName calculates PVC name

func WaitForSemaphore added in v0.0.2

func WaitForSemaphore(ctx context.Context, sem Semaphore, errChan chan<- error) (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