util

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2019 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyDir added in v1.10.0

func CopyDir(source string, dest string) (err error)

CopyDir copies a dir from one location to another.

func CopyFile added in v1.7.0

func CopyFile(src, dst string) error

CopyFile copies a file from one location to another.

func GetAvailableSpace added in v1.4.0

func GetAvailableSpace(path string) int64

GetAvailableSpace gets the amount of available space at the path specified.

func GetAvailableSpaceBlock added in v1.8.0

func GetAvailableSpaceBlock(deviceName string) int64

GetAvailableSpaceBlock gets the amount of available space at the block device path specified.

func GetAvailableSpaceByVolumeMode added in v1.8.0

func GetAvailableSpaceByVolumeMode(volumeMode v1.PersistentVolumeMode) int64

GetAvailableSpaceByVolumeMode calls another method based on the volumeMode parameter to get the amount of available space at the path specified.

func GetNamespace

func GetNamespace() string

GetNamespace returns the namespace the pod is executing in

func MinQuantity added in v1.4.0

func MinQuantity(availableSpace, imageSize *resource.Quantity) resource.Quantity

MinQuantity calculates the minimum of two quantities.

func ParseEnvVar added in v1.4.0

func ParseEnvVar(envVarName string, decode bool) (string, error)

ParseEnvVar provides a wrapper to attempt to fetch the specified env var

func RandAlphaNum

func RandAlphaNum(n int) string

RandAlphaNum provides an implementation to generate a random alpha numeric string of the specified length

func RetryBackoffSize added in v1.10.9

func RetryBackoffSize(dest string, size resource.Quantity, sizeFunc func(string, resource.Quantity) error) error

RetryBackoffSize Calls the passed in function to size/resize and if it fails lowers the size and tries again up to 10 times.

func StreamDataToFile added in v1.9.0

func StreamDataToFile(r io.Reader, fileName string) error

StreamDataToFile provides a function to stream the specified io.Reader to the specified local file

func UnArchiveLocalTar added in v1.5.0

func UnArchiveLocalTar(filePath, destDir string, arg ...string) error

UnArchiveLocalTar unarchives a local tar file to the specified destination.

func UnArchiveTar added in v1.5.0

func UnArchiveTar(reader io.Reader, destDir string, arg ...string) error

UnArchiveTar unarchives a tar file and streams its files using the specified io.Reader to the specified destination.

func WriteTerminationMessage added in v1.10.0

func WriteTerminationMessage(message string) error

WriteTerminationMessage writes the passed in message to the default termination message file

func WriteTerminationMessageToFile added in v1.10.0

func WriteTerminationMessageToFile(file, message string) error

WriteTerminationMessageToFile writes the passed in message to the passed in message file

Types

type CountingReader added in v1.4.0

type CountingReader struct {
	Reader  io.ReadCloser
	Current uint64
	Done    bool
}

CountingReader is a reader that keeps track of how much has been read

func (*CountingReader) Close added in v1.4.0

func (r *CountingReader) Close() error

Close closes the stream

func (*CountingReader) Read added in v1.4.0

func (r *CountingReader) Read(p []byte) (n int, err error)

Read reads bytes from the stream and updates the prometheus clone_progress metric according to the progress.

Directories

Path Synopsis
cert
triple
Package triple generates key-certificate pairs for the triple (CA, Server, Client).
Package triple generates key-certificate pairs for the triple (CA, Server, Client).

Jump to

Keyboard shortcuts

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