util

package
v4.1.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KiB int64 = 1024
	MiB int64 = 1024 * KiB
	GiB int64 = 1024 * MiB
	TiB int64 = 1024 * GiB
)

Common allocation units

Variables

This section is empty.

Functions

func AccessModesContainedInAll

func AccessModesContainedInAll(indexedModes []v1.PersistentVolumeAccessMode, requestedModes []v1.PersistentVolumeAccessMode) bool

AccessModesContainedInAll returns whether all of the requested modes are contained by modes

func AccessModesContains

func AccessModesContains(modes []v1.PersistentVolumeAccessMode, mode v1.PersistentVolumeAccessMode) bool

AccessModesContains returns whether the requested mode is contained by modes

func CheckPersistentVolumeClaimModeBlock

func CheckPersistentVolumeClaimModeBlock(pvc *v1.PersistentVolumeClaim) bool

CheckPersistentVolumeClaimModeBlock checks VolumeMode. If the mode is Block, return true otherwise return false.

func FindDNSIP

func FindDNSIP(client kubernetes.Interface) (dnsip string)

FindDNSIP looks up the cluster DNS service by label "coredns", falling back to "kube-dns" if not found

func GetPersistentVolumeClaimClass

func GetPersistentVolumeClaimClass(claim *v1.PersistentVolumeClaim) string

GetPersistentVolumeClaimClass returns StorageClassName. If no storage class was requested, it returns "".

func GetPersistentVolumeClass

func GetPersistentVolumeClass(volume *v1.PersistentVolume) string

GetPersistentVolumeClass returns StorageClassName.

func JoinHostPort

func JoinHostPort(host, port string) (hostport string)

JoinHostPort joins a hostname and an optional port

func LookupHost

func LookupHost(hostname string, serverip string) (iplist []string, err error)

LookupHost looks up IP addresses of hostname on specified DNS server

func RoundUpSize

func RoundUpSize(volumeSizeBytes int64, allocationUnitBytes int64) int64

RoundUpSize calculates how many allocation units are needed to accommodate a volume of given size. E.g. when user wants 1500MiB volume, while AWS EBS allocates volumes in gibibyte-sized chunks, RoundUpSize(1500 * 1024*1024, 1024*1024*1024) returns '2' (2 GiB is the smallest allocatable volume that can hold 1500MiB)

func RoundUpToGiB

func RoundUpToGiB(sizeBytes int64) int64

RoundUpToGiB rounds up given quantity upto chunks of GiB

func SplitHostPort

func SplitHostPort(hostport string) (host, port string)

SplitHostPort split a string into host and port (port is optional)

Types

This section is empty.

Jump to

Keyboard shortcuts

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