test

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2022 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const DiscoveryLabel = v1alpha5.TestingGroup + "/test-id"

Variables

This section is empty.

Functions

func DaemonSet

func DaemonSet(overrides ...DaemonSetOptions) *appsv1.DaemonSet

DaemonSet creates a test pod with defaults that can be overridden by DaemonSetOptions. Overrides are applied in order, with a last write wins semantic.

func Deployment

func Deployment(overrides ...DeploymentOptions) *appsv1.Deployment

func MustMerge

func MustMerge[T interface{}](dest T, srcs ...T) T

func Namespace

func Namespace(overrides ...NamespaceOptions) *corev1.Namespace

Namespace creates a Namespace.

func NamespacedObjectMeta

func NamespacedObjectMeta(overrides ...metav1.ObjectMeta) metav1.ObjectMeta

func Node

func Node(overrides ...NodeOptions) *v1.Node

func ObjectMeta

func ObjectMeta(overrides ...metav1.ObjectMeta) metav1.ObjectMeta

func PersistentVolume

func PersistentVolume(overrides ...PersistentVolumeOptions) *v1.PersistentVolume

func PersistentVolumeClaim

func PersistentVolumeClaim(overrides ...PersistentVolumeClaimOptions) *v1.PersistentVolumeClaim

func Pod

func Pod(overrides ...PodOptions) *v1.Pod

Pod creates a test pod with defaults that can be overridden by PodOptions. Overrides are applied in order, with a last write wins semantic.

func PodDisruptionBudget

func PodDisruptionBudget(overrides ...PDBOptions) *policyv1.PodDisruptionBudget

PodDisruptionBudget creates a PodDisruptionBudget. To function properly, it should have its status applied

func Pods

func Pods(total int, options ...PodOptions) []*v1.Pod

Pods creates homogeneous groups of pods based on the passed in options, evenly divided by the total pods requested

func Provisioner

func Provisioner(overrides ...ProvisionerOptions) *v1alpha5.Provisioner

Provisioner creates a test provisioner with defaults that can be overridden by ProvisionerOptions. Overrides are applied in order, with a last write wins semantic.

func RandomName

func RandomName() string

func ReplicaSet

func ReplicaSet(overrides ...ReplicaSetOptions) *appsv1.ReplicaSet

ReplicaSet creates a test ReplicaSet with defaults that can be overridden by ReplicaSetOptions. Overrides are applied in order, with a last write wins semantic.

func Settings

func Settings(overrides ...SettingsOptions) settings.Settings

func StorageClass

func StorageClass(overrides ...StorageClassOptions) *storagev1.StorageClass

func UnschedulablePod

func UnschedulablePod(options ...PodOptions) *v1.Pod

UnschedulablePod creates a test pod with a pending scheduling status condition

Types

type Binding

type Binding struct {
	Pod  *v1.Pod
	Node *v1.Node
}

Binding is a potential binding that was reported through event recording.

type DaemonSetOptions

type DaemonSetOptions struct {
	metav1.ObjectMeta
	Selector   map[string]string
	PodOptions PodOptions
}

DaemonSetOptions customizes a DaemonSet.

type DeploymentOptions

type DeploymentOptions struct {
	metav1.ObjectMeta
	Labels     map[string]string
	Replicas   int32
	PodOptions PodOptions
}

type Environment

type Environment struct {
	envtest.Environment
	Client              client.Client
	KubernetesInterface kubernetes.Interface
	Version             *version.Version
	Done                chan struct{}
}

func NewEnvironment

func NewEnvironment(scheme *runtime.Scheme, crds ...*v1.CustomResourceDefinition) *Environment

func (*Environment) Stop

func (e *Environment) Stop() error

type EventRecorder

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

EventRecorder is a mock event recorder that is used to facilitate testing.

func NewEventRecorder

func NewEventRecorder() *EventRecorder

func (*EventRecorder) Calls

func (e *EventRecorder) Calls(reason string) int

func (*EventRecorder) ForEachBinding

func (e *EventRecorder) ForEachBinding(f func(pod *v1.Pod, node *v1.Node))

func (*EventRecorder) ForEachEvent

func (e *EventRecorder) ForEachEvent(f func(evt events.Event))

func (*EventRecorder) Publish

func (e *EventRecorder) Publish(evt events.Event)

func (*EventRecorder) Reset

func (e *EventRecorder) Reset()

func (*EventRecorder) ResetBindings

func (e *EventRecorder) ResetBindings()

type InternalRecorder

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

func NewInternalRecorder

func NewInternalRecorder() *InternalRecorder

func (*InternalRecorder) AnnotatedEventf

func (i *InternalRecorder) AnnotatedEventf(object runtime.Object, _ map[string]string, eventtype, reason, messageFmt string, _ ...interface{})

func (*InternalRecorder) Calls

func (i *InternalRecorder) Calls(reason string) int

func (*InternalRecorder) Event

func (i *InternalRecorder) Event(_ runtime.Object, _, reason, _ string)

func (*InternalRecorder) Eventf

func (i *InternalRecorder) Eventf(object runtime.Object, eventtype, reason, messageFmt string, _ ...interface{})

type NamespaceOptions

type NamespaceOptions struct {
	metav1.ObjectMeta
}

PodOptions customizes a Pod.

type NodeOptions

type NodeOptions struct {
	metav1.ObjectMeta
	ReadyStatus   v1.ConditionStatus
	ReadyReason   string
	Conditions    []v1.NodeCondition
	Unschedulable bool
	ProviderID    string
	Taints        []v1.Taint
	Allocatable   v1.ResourceList
	Capacity      v1.ResourceList
}

type PDBOptions

type PDBOptions struct {
	metav1.ObjectMeta
	Labels         map[string]string
	MinAvailable   *intstr.IntOrString
	MaxUnavailable *intstr.IntOrString
	Status         *policyv1.PodDisruptionBudgetStatus
}

type PersistentVolumeClaimOptions

type PersistentVolumeClaimOptions struct {
	metav1.ObjectMeta
	StorageClassName *string
	VolumeName       string
	Resources        v1.ResourceRequirements
}

type PersistentVolumeOptions

type PersistentVolumeOptions struct {
	metav1.ObjectMeta
	Zones            []string
	StorageClassName string
	Driver           string
}

type PodOptions

type PodOptions struct {
	metav1.ObjectMeta
	Image                         string
	InitImage                     string
	NodeName                      string
	PriorityClassName             string
	InitResourceRequirements      v1.ResourceRequirements
	ResourceRequirements          v1.ResourceRequirements
	NodeSelector                  map[string]string
	NodeRequirements              []v1.NodeSelectorRequirement
	NodePreferences               []v1.NodeSelectorRequirement
	PodRequirements               []v1.PodAffinityTerm
	PodPreferences                []v1.WeightedPodAffinityTerm
	PodAntiRequirements           []v1.PodAffinityTerm
	PodAntiPreferences            []v1.WeightedPodAffinityTerm
	TopologySpreadConstraints     []v1.TopologySpreadConstraint
	Tolerations                   []v1.Toleration
	PersistentVolumeClaims        []string
	Conditions                    []v1.PodCondition
	Phase                         v1.PodPhase
	RestartPolicy                 v1.RestartPolicy
	TerminationGracePeriodSeconds *int64
}

PodOptions customizes a Pod.

func UnscheduleablePodOptions

func UnscheduleablePodOptions(overrides ...PodOptions) PodOptions

type ProvisionerOptions

type ProvisionerOptions struct {
	metav1.ObjectMeta
	Limits                 v1.ResourceList
	Provider               interface{}
	ProviderRef            *v1alpha5.ProviderRef
	Kubelet                *v1alpha5.KubeletConfiguration
	Annotations            map[string]string
	Labels                 map[string]string
	Taints                 []v1.Taint
	StartupTaints          []v1.Taint
	Requirements           []v1.NodeSelectorRequirement
	Status                 v1alpha5.ProvisionerStatus
	TTLSecondsUntilExpired *int64
	Weight                 *int32
	TTLSecondsAfterEmpty   *int64
	Consolidation          *v1alpha5.Consolidation
}

ProvisionerOptions customizes a Provisioner.

type ReplicaSetOptions

type ReplicaSetOptions struct {
	metav1.ObjectMeta
	Selector   map[string]string
	PodOptions PodOptions
}

ReplicaSetOptions customizes a ReplicaSet.

type SettingsOptions

type SettingsOptions struct {
	DriftEnabled bool
}

type SettingsStore

type SettingsStore map[interface{}]interface{}

SettingsStore is a map from ContextKey to settings/config data

func (SettingsStore) InjectSettings

func (ss SettingsStore) InjectSettings(ctx context.Context) context.Context

type StorageClassOptions

type StorageClassOptions struct {
	metav1.ObjectMeta
	Zones             []string
	Provisioner       *string
	VolumeBindingMode *storagev1.VolumeBindingMode
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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