k8s_device_plugins

package
v0.0.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// LabelRole contains the key for the role label
	LabelRole = "node-role.kubernetes.io"
)

Variables

View Source
var (
	// Client defines the API client to run CRUD operations, that will be used for testing
	Client client.Client
	// K8sClient defines k8s client to run subresource operations, for example you should use it to get pod logs
	K8sClient *kubernetes.Clientset
	// TestingNamespace is the namespace the tests will use for running test pods
	TestingNamespace *corev1.Namespace = &corev1.Namespace{
		ObjectMeta: metav1.ObjectMeta{
			GenerateName: "k8s-device-plugins-test-",
		},
	}
)

Functions

func ExecAndLogCommand

func ExecAndLogCommand(name string, arg ...string) ([]byte, error)

func ExecCommandOnPod

func ExecCommandOnPod(pod *corev1.Pod, command []string) ([]byte, error)

ExecCommandOnPod returns the output of the command execution on the pod

func GetByLabels

func GetByLabels(nodeLabels map[string]string) ([]corev1.Node, error)

GetByLabels returns all nodes with the specified labels

func GetByRole

func GetByRole(role string) ([]corev1.Node, error)

GetByRole returns all nodes with the specified role

func GetBySelector

func GetBySelector(selector labels.Selector) ([]corev1.Node, error)

GetBySelector returns all nodes with the specified selector

func GetPodLogs

func GetPodLogs(c *kubernetes.Clientset, pod *corev1.Pod) (string, error)

GetPodLogs returns logs of the specified pod

func GetTestPod

func GetTestPod() *corev1.Pod

GetTestPod returns pod with the busybox image

func GetWithRetry

func GetWithRetry(ctx context.Context, key client.ObjectKey, obj runtime.Object) error

func New

func New() (client.Client, error)

New returns a controller-runtime client.

func NewK8s

func NewK8s() (*kubernetes.Clientset, error)

NewK8s returns a kubernetes clientset

func Setup

func Setup() error

func Teardown

func Teardown() error

func WaitForNamespaceDeletion

func WaitForNamespaceDeletion(name string, timeout time.Duration) error

WaitForNamespaceDeletion waits until the namespace will be removed from the cluster

func WaitForPodCondition

func WaitForPodCondition(pod *corev1.Pod, conditionType corev1.PodConditionType, conditionStatus corev1.ConditionStatus, timeout time.Duration) error

WaitForPodCondition waits until the pod will have specified condition type with the expected status

func WaitForPodDeletion

func WaitForPodDeletion(pod *corev1.Pod, timeout time.Duration) error

WaitForPodDeletion waits until the pod will be removed from the cluster

func WaitForPodPhase

func WaitForPodPhase(pod *corev1.Pod, phase corev1.PodPhase, timeout time.Duration) error

WaitForPodPhase waits until the pod will have specified phase

Types

This section is empty.

Jump to

Keyboard shortcuts

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