k8stest

package
v0.0.0-...-c7dd6ca Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package k8stest provides example objects for testing.

Index

Constants

This section is empty.

Variables

View Source
var MatchingNodeLabels = labels.Set(map[string]string{
	"system":   "bajor",
	"quadrant": "alpha",
})

MatchingNodeLabels is a set of node labels which match the selector from MakeMatch.

View Source
var MatchingPodLabels = labels.Set(map[string]string{
	"vessel": "runabout",
	"class":  "danube",
})

MatchingPodLabels is a set of pod labels which match the selector from MakeMatch.

View Source
var NoSchedule = []corev1.Taint{
	corev1.Taint{
		Key:    "node.kubernetes.io/unschedulable",
		Effect: corev1.TaintEffectNoSchedule,
	},
}

NoSchedule is a set taints which can be applied to a node to make it unschedulable.

View Source
var PodTolerations = []corev1.Toleration{
	corev1.Toleration{
		Key:      "shields",
		Value:    "down",
		Operator: corev1.TolerationOpEqual,
		Effect:   corev1.TaintEffectNoExecute,
	},
	corev1.Toleration{
		Key:      "alert",
		Value:    "red",
		Operator: corev1.TolerationOpEqual,
		Effect:   corev1.TaintEffectNoSchedule,
	},
}

PodTolerations is an example kubernetes node Toleration.

Functions

func AsRuntimeObjects

func AsRuntimeObjects(in []metav1.Object) (out []runtime.Object)

AsRuntimeObjects returns a slice of runtime.Objects based upon a slice of metav1.Object.

func MakeDNS

func MakeDNS() flipopv1alpha1.DNSRecordSet

MakeDNS returns an example DNSRecordSet.

func MakeMatch

func MakeMatch() flipopv1alpha1.Match

MakeMatch returns flipop match object which selects the pods/nodes specified in MatchingPodLabels, and MatchingNodeLabels.

func MakeNode

func MakeNode(name, providerID string, mutators ...func(node metav1.Object) metav1.Object) *corev1.Node

MakeNode creates a node object and applies the specified mutators to customize the object.

func MakePod

func MakePod(name, nodeName string, mutators ...func(pod metav1.Object) metav1.Object) *corev1.Pod

MakePod creates a pod and optionally applies a list of mutators to customize the object.

func MarkDeleting

func MarkDeleting(o metav1.Object) metav1.Object

MarkDeleting returns a mutator which marks the object as deleting.

func MarkReady

func MarkReady(o metav1.Object) metav1.Object

MarkReady returns a mutator which marks a pod or node as ready.

func MarkRunning

func MarkRunning(o metav1.Object) metav1.Object

MarkRunning returns a mutator which marks a pod as running.

func SetLabels

func SetLabels(l labels.Set) func(metav1.Object) metav1.Object

SetLabels returns a mutator callback which adds the specified labels to an object.

func SetNamespace

func SetNamespace(ns string) func(o metav1.Object) metav1.Object

SetNamespace returns a mutator which sets the namespace of a kubernetes object.

func SetNodeAddress

func SetNodeAddress(t corev1.NodeAddressType, addr string) func(o metav1.Object) metav1.Object

SetNodeAddress returns a mutator which adds the specified address to a node.

func SetTaints

func SetTaints(t []corev1.Taint) func(metav1.Object) metav1.Object

SetTaints returns a mutator callback which adds the specified taints to a node.

Types

This section is empty.

Jump to

Keyboard shortcuts

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