sample_device_plugin

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2023 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultDevicePath = "/dev/null"
)

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: "sample-device-plugin-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 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 client.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