k8sutil

package
v0.2.9 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TaskIDLabel label for the task-id
	TaskIDLabel = "ancientt/task-id"
)

Variables

This section is empty.

Functions

func GetLabels

func GetLabels() map[string]string

GetLabels return a default set of labels for "any" object ancientt is going to create.

func GetPodLabels

func GetPodLabels(podName string, taskName string) map[string]string

GetPodLabels default labels combined with additional labels for Pods.

func NewClient

func NewClient(inClusterConfig bool, kubeconfig string) (kubernetes.Interface, error)

NewClient create a new Kubernetes clientset

func NodeIsTolerable

func NodeIsTolerable(node corev1.Node, tolerations []corev1.Toleration) bool

NodeIsTolerable returns true if the node's taints are all tolerated by the given tolerations. There is the option to ignore well known taints defined in WellKnownTaints. See WellKnownTaints for more information.

func PodDelete

func PodDelete(k8sclient kubernetes.Interface, pod *corev1.Pod, timeout int) error

PodDelete delete Pod if it exists, wait for it till it has been for custom amount deleted

func PodDeleteByLabels

func PodDeleteByLabels(k8sclient kubernetes.Interface, namespace string, selectorLabels map[string]string) error

PodDeleteByLabels delete Pods by labels

func PodDeleteByName

func PodDeleteByName(k8sclient kubernetes.Interface, namespace string, podName string, timeout int) error

PodDeleteByName delete Pod by namespace and name if it exists

func PodRecreate

func PodRecreate(k8sclient kubernetes.Interface, pod *corev1.Pod, delTimeout int) error

PodRecreate delete Pod if it exists and create it again. If the Pod does not exist, create it.

func PortsListToPorts

func PortsListToPorts(list testers.Ports) []corev1.ContainerPort

PortsListToPorts PortList testers.Port to Kubernetes []corev1.ContainerPort conversion (for TCP and UDP)

func WaitForPodToRun

func WaitForPodToRun(k8sclient kubernetes.Interface, namespace string, podName string, timeout int) (bool, error)

WaitForPodToRun wait for a Pod to be in phase Running. In case of phase Running, return true and no error

func WaitForPodToRunOrSucceed

func WaitForPodToRunOrSucceed(k8sclient kubernetes.Interface, namespace string, podName string, timeout int) (bool, error)

WaitForPodToRunOrSucceed wait for a Pod to be in phase Running or Succeeded. In case of one of the phases, return true and no error

func WaitForPodToSucceed

func WaitForPodToSucceed(k8sclient kubernetes.Interface, namespace string, podName string, timeout int) (bool, error)

WaitForPodToSucceed wait for a Pod to be in phase Succeeded. In case of phase Succeeded, return true and no error

Types

This section is empty.

Jump to

Keyboard shortcuts

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