util

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2022 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckDynamicPV added in v0.16.0

func CheckDynamicPV(name string) (bool, error)

func ConsistentRead added in v0.14.1

func ConsistentRead(filename string, attempts int) ([]byte, error)

ConsistentRead repeatedly reads a file until it gets the same content twice. This is useful when reading files in /proc that are larger than page size and kernel may modify them between individual read() syscalls.

func ContainsString added in v0.10.0

func ContainsString(slice []string, s string) bool

func DeleteResourceOfPod added in v0.10.0

func DeleteResourceOfPod(pod *corev1.Pod)

func DoWithinTime added in v0.15.0

func DoWithinTime(ctx context.Context, timeout time.Duration, cmd *exec.Cmd, f func() error) (out []byte, err error)

func GetMountDeviceRefs added in v0.13.2

func GetMountDeviceRefs(pathname string, corrupted bool) ([]string, error)

GetMountDeviceRefs Get all mountpoints whose source is the device of `pathname` mountpoint, the `pathname` will be excluded. The `pathname` must be a mountpoint, and if the `corrupted` is true, the `pathname` is a corrupted mountpoint.

func GetMountPathOfPod added in v0.10.7

func GetMountPathOfPod(pod corev1.Pod) (string, string, error)

func GetReferenceKey added in v0.10.7

func GetReferenceKey(target string) string

func GetTime added in v0.13.0

func GetTime(str string) (time.Time, error)

func GetTimeAfterDelay added in v0.13.0

func GetTimeAfterDelay(delayStr string) (string, error)

GetTimeAfterDelay get time which after delay

func IsJobCompleted added in v0.13.0

func IsJobCompleted(job *batchv1.Job) bool

func IsJobFailed added in v0.13.0

func IsJobFailed(job *batchv1.Job) bool

func IsPodError added in v0.10.0

func IsPodError(pod *corev1.Pod) bool

func IsPodHasResource added in v0.10.0

func IsPodHasResource(pod corev1.Pod) bool

func IsPodReady added in v0.10.0

func IsPodReady(pod *corev1.Pod) bool

func IsPodResourceError added in v0.10.0

func IsPodResourceError(pod *corev1.Pod) bool

func ParseEndpoint

func ParseEndpoint(endpoint string) (string, string, error)

func ParseMntPath added in v0.10.7

func ParseMntPath(cmd string) (string, string, error)

ParseMntPath return mntPath, volumeId (/jfs/volumeId, volumeId err)

func PatchPodAnnotation added in v0.13.2

func PatchPodAnnotation(client *k8s.K8sClient, pod *corev1.Pod, annotation map[string]string) error

func QuoteForShell added in v0.13.0

func QuoteForShell(cmd string) string

func RandStringRunes added in v0.14.1

func RandStringRunes(n int) string

func RemoveFinalizer added in v0.15.0

func RemoveFinalizer(client *k8sclient.K8sClient, pod *corev1.Pod, finalizer string) error

func ShouldDelay added in v0.13.0

func ShouldDelay(pod *corev1.Pod, Client *k8s.K8sClient) (shouldDelay bool, err error)

func StripPasswd added in v0.13.0

func StripPasswd(uri string) string

Types

type PVCMetadata added in v0.13.3

type PVCMetadata struct {
	// contains filtered or unexported fields
}

func NewPVCMeta added in v0.13.3

func NewPVCMeta(pvc v1.PersistentVolumeClaim) *PVCMetadata

func (*PVCMetadata) StringParser added in v0.13.3

func (meta *PVCMetadata) StringParser(str string) string

Jump to

Keyboard shortcuts

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