utils

package
v0.0.0-...-300c491 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2022 License: Apache-2.0, BSD-2-Clause, MIT, + 1 more Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Kubernetes116 = semver.New("1.16.0")

Functions

func ContextFromStopChannel

func ContextFromStopChannel(stopCh <-chan struct{}) context.Context

ContextFromStopChannel creates a new context from a given stop channel.

func DebugExec

func DebugExec(ctx context.Context, config *rest.Config, options executor.DebugExecOptions) error

func GetPodCondition

func GetPodCondition(status *corev1.PodStatus, conditionType corev1.PodConditionType) (int, *corev1.PodCondition)

GetPodCondition extracts the provided condition from the given status and returns that. Returns nil and -1 if the condition is not present, and the index of the located condition.

func GetPodReadyCondition

func GetPodReadyCondition(status corev1.PodStatus) *corev1.PodCondition

GetPodReadyCondition extracts the pod ready condition from the given status and returns that. Returns nil if the condition is not present.

func GetPodsByLabels

func GetPodsByLabels(ctx context.Context, c client.Client, labelsMap labels.Selector, namespace string) (*corev1.PodList, error)

func IsPodReady

func IsPodReady(pod *corev1.Pod) bool

IsPodReady returns true if a pod is ready; false otherwise.

func IsPodReadyConditionTrue

func IsPodReadyConditionTrue(status corev1.PodStatus) bool

IsPodReadyConditionTrue returns true if a pod is ready; false otherwise.

func LeaderElectionNameID

func LeaderElectionNameID(name string) string

LeaderElectionNameID returns a leader election ID for the given name.

func LogErrAndExit

func LogErrAndExit(err error, msg string, keysAndValues ...interface{})

LogErrAndExit logs the given error with msg and keysAndValues and calls `os.Exit(1)`.

func ParseNetcatOutput

func ParseNetcatOutput(out string, nc *Netcat)

func ParsePingOutput

func ParsePingOutput(outs []byte, ping *Ping)

func ParseQperfOutput

func ParseQperfOutput(outs []byte, qperf *Qperf, protocol networkmachineryv1alpha1.Protocol)

func PodExec

func PodExec(ctx context.Context, config *rest.Config, options executor.PodExecOptions) error

func ReadIn

func ReadIn(reader io.Reader, p []byte) error

func SetupSignalHandlerContext

func SetupSignalHandlerContext() context.Context

SetupSignalHandlerContext sets up a context from signals.SetupSignalHandler stop channel.

func ShouldUseEphemeralContainers

func ShouldUseEphemeralContainers(config *rest.Config) (bool, error)

Types

type Netcat

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

func (*Netcat) State

func (n *Netcat) State() v1alpha1.NetcatResultState

type Ping

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

func (*Ping) Average

func (p *Ping) Average() string

func (*Ping) Max

func (p *Ping) Max() string

func (*Ping) Min

func (p *Ping) Min() string

type Qperf

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

func (*Qperf) TCPDelay

func (q *Qperf) TCPDelay() string

func (*Qperf) UDPDelay

func (q *Qperf) UDPDelay() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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