Documentation
¶
Index ¶
- Constants
- func DaemonSet(overrides ...DaemonSetOptions) *appsv1.DaemonSet
- func Deployment(overrides ...DeploymentOptions) *appsv1.Deployment
- func Machine(overrides ...v1alpha5.Machine) *v1alpha5.Machine
- func MachineAndNode(overrides ...v1alpha5.Machine) (*v1alpha5.Machine, *v1.Node)
- func MachineFieldIndexer(ctx context.Context) func(cache.Cache) error
- func MachineLinkedNode(machine *v1alpha5.Machine) *v1.Node
- func MachinesAndNodes(total int, options ...v1alpha5.Machine) ([]*v1alpha5.Machine, []*v1.Node)
- func MustMerge[T interface{}](dest T, srcs ...T) T
- func Namespace(overrides ...NamespaceOptions) *corev1.Namespace
- func NamespacedObjectMeta(overrides ...metav1.ObjectMeta) metav1.ObjectMeta
- func Node(overrides ...NodeOptions) *v1.Node
- func NodeClaim(overrides ...v1beta1.NodeClaim) *v1beta1.NodeClaim
- func NodeClaimAndNode(overrides ...v1beta1.NodeClaim) (*v1beta1.NodeClaim, *v1.Node)
- func NodeClaimFieldIndexer(ctx context.Context) func(cache.Cache) error
- func NodeClaimLinkedNode(nodeClaim *v1beta1.NodeClaim) *v1.Node
- func NodeClaimsAndNodes(total int, options ...v1beta1.NodeClaim) ([]*v1beta1.NodeClaim, []*v1.Node)
- func NodePool(overrides ...v1beta1.NodePool) *v1beta1.NodePool
- func ObjectMeta(overrides ...metav1.ObjectMeta) metav1.ObjectMeta
- func Options(overrides ...OptionsFields) *options.Options
- func PersistentVolume(overrides ...PersistentVolumeOptions) *v1.PersistentVolume
- func PersistentVolumeClaim(overrides ...PersistentVolumeClaimOptions) *v1.PersistentVolumeClaim
- func Pod(overrides ...PodOptions) *v1.Pod
- func PodDisruptionBudget(overrides ...PDBOptions) *policyv1.PodDisruptionBudget
- func Pods(total int, options ...PodOptions) []*v1.Pod
- func ProviderID(base string) string
- func Provisioner(overrides ...ProvisionerOptions) *v1alpha5.Provisioner
- func RandomName() string
- func RandomProviderID() string
- func ReplaceRequirements(nodePool *v1beta1.NodePool, reqs ...v1.NodeSelectorRequirement) *v1beta1.NodePool
- func ReplicaSet(overrides ...ReplicaSetOptions) *appsv1.ReplicaSet
- func Settings(overrides ...settings.Settings) *settings.Settings
- func StorageClass(overrides ...StorageClassOptions) *storagev1.StorageClass
- func TemplateObjectMeta(overrides ...v1beta1.ObjectMeta) v1beta1.ObjectMeta
- func UnschedulablePod(options ...PodOptions) *v1.Pod
- func UnschedulablePods(options PodOptions, num int) []*v1.Pod
- func WithCRDs(crds ...*v1.CustomResourceDefinition) functional.Option[EnvironmentOptions]
- func WithFieldIndexers(fieldIndexers ...func(cache.Cache) error) functional.Option[EnvironmentOptions]
- type CacheSyncingClient
- func (c *CacheSyncingClient) Create(ctx context.Context, obj client.Object, opts ...client.CreateOption) error
- func (c *CacheSyncingClient) Delete(ctx context.Context, obj client.Object, opts ...client.DeleteOption) error
- func (c *CacheSyncingClient) DeleteAllOf(ctx context.Context, obj client.Object, opts ...client.DeleteAllOfOption) error
- func (c *CacheSyncingClient) Patch(ctx context.Context, obj client.Object, patch client.Patch, ...) error
- func (c *CacheSyncingClient) Status() client.StatusWriter
- func (c *CacheSyncingClient) Update(ctx context.Context, obj client.Object, opts ...client.UpdateOption) error
- type DaemonSetOptions
- type DeploymentOptions
- type Environment
- type EnvironmentOptions
- type EphemeralVolumeTemplateOptions
- type EventRecorder
- func (e *EventRecorder) Calls(reason string) int
- func (e *EventRecorder) DetectedEvent(msg string) bool
- func (e *EventRecorder) Events() (res []events.Event)
- func (e *EventRecorder) ForEachEvent(f func(evt events.Event))
- func (e *EventRecorder) Publish(evts ...events.Event)
- func (e *EventRecorder) Reset()
- type FeatureGates
- type NamespaceOptions
- type NodeOptions
- type OptionsFields
- type PDBOptions
- type PersistentVolumeClaimOptions
- type PersistentVolumeOptions
- type PodOptions
- type ProvisionerOptions
- type ReplicaSetOptions
- type StorageClassOptions
Constants ¶
const DiscoveryLabel = "testing/cluster"
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 Machine ¶ added in v0.22.0
Machine creates a test machine with defaults that can be overridden by MachineOptions. Overrides are applied in order, with a last write wins semantic.
func MachineAndNode ¶ added in v0.27.1
func MachineFieldIndexer ¶ added in v0.31.0
func MachineLinkedNode ¶ added in v0.27.1
func MachinesAndNodes ¶ added in v0.28.0
MachinesAndNodes creates homogeneous groups of machines and nodes based on the passed in options, evenly divided by the total machines requested
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 NodeClaim ¶ added in v0.30.0
NodeClaim creates a test NodeClaim with defaults that can be overridden by overrides. Overrides are applied in order, with a last write wins semantic.
func NodeClaimAndNode ¶ added in v0.30.0
func NodeClaimFieldIndexer ¶ added in v0.31.0
func NodeClaimLinkedNode ¶ added in v0.30.0
func NodeClaimsAndNodes ¶ added in v0.31.0
NodeClaimsAndNodes creates homogeneous groups of NodeClaims and Nodes based on the passed in options, evenly divided by the total machines requested
func NodePool ¶ added in v0.30.0
NodePool creates a test NodePool with defaults that can be overridden by overrides. Overrides are applied in order, with a last write wins semantic.
func ObjectMeta ¶
func ObjectMeta(overrides ...metav1.ObjectMeta) metav1.ObjectMeta
func Options ¶ added in v0.32.0
func Options(overrides ...OptionsFields) *options.Options
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 ProviderID ¶ added in v0.24.0
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 RandomProviderID ¶ added in v0.24.0
func RandomProviderID() string
func ReplaceRequirements ¶ added in v0.32.0
func ReplaceRequirements(nodePool *v1beta1.NodePool, reqs ...v1.NodeSelectorRequirement) *v1beta1.NodePool
ReplaceRequirements any current requirements on the passed through NodePool with the passed in requirements If any of the keys match between the existing requirements and the new requirements, the new requirement with the same key will replace the old requirement with that key
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 StorageClass ¶
func StorageClass(overrides ...StorageClassOptions) *storagev1.StorageClass
func TemplateObjectMeta ¶ added in v0.32.0
func TemplateObjectMeta(overrides ...v1beta1.ObjectMeta) v1beta1.ObjectMeta
func UnschedulablePod ¶
func UnschedulablePod(options ...PodOptions) *v1.Pod
UnschedulablePod creates a test pod with a pending scheduling status condition
func UnschedulablePods ¶ added in v0.28.0
func UnschedulablePods(options PodOptions, num int) []*v1.Pod
UnschedulablePods returns slice of configurable length of identical test pods with a pending scheduling status condition
func WithCRDs ¶ added in v0.22.0
func WithCRDs(crds ...*v1.CustomResourceDefinition) functional.Option[EnvironmentOptions]
WithCRDs registers the specified CRDs to the apiserver for use in testing
func WithFieldIndexers ¶ added in v0.22.0
func WithFieldIndexers(fieldIndexers ...func(cache.Cache) error) functional.Option[EnvironmentOptions]
WithFieldIndexers expects a function that indexes fields against the cache such as cache.IndexField(...)
Types ¶
type CacheSyncingClient ¶ added in v0.22.0
CacheSyncingClient exists for tests that need to use custom fieldSelectors (thus, they need a client cache) and also need consistency in their testing by waiting for caches to sync after performing WRITE operations NOTE: This cache sync doesn't sync with third-party operations on the api-server
func (*CacheSyncingClient) Create ¶ added in v0.22.0
func (c *CacheSyncingClient) Create(ctx context.Context, obj client.Object, opts ...client.CreateOption) error
func (*CacheSyncingClient) Delete ¶ added in v0.22.0
func (c *CacheSyncingClient) Delete(ctx context.Context, obj client.Object, opts ...client.DeleteOption) error
func (*CacheSyncingClient) DeleteAllOf ¶ added in v0.22.0
func (c *CacheSyncingClient) DeleteAllOf(ctx context.Context, obj client.Object, opts ...client.DeleteAllOfOption) error
func (*CacheSyncingClient) Patch ¶ added in v0.22.0
func (c *CacheSyncingClient) Patch(ctx context.Context, obj client.Object, patch client.Patch, opts ...client.PatchOption) error
func (*CacheSyncingClient) Status ¶ added in v0.22.0
func (c *CacheSyncingClient) Status() client.StatusWriter
func (*CacheSyncingClient) Update ¶ added in v0.22.0
func (c *CacheSyncingClient) Update(ctx context.Context, obj client.Object, opts ...client.UpdateOption) error
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{} Cancel context.CancelFunc }
func NewEnvironment ¶
func NewEnvironment(scheme *runtime.Scheme, options ...functional.Option[EnvironmentOptions]) *Environment
func (*Environment) Stop ¶
func (e *Environment) Stop() error
type EnvironmentOptions ¶ added in v0.22.0
type EnvironmentOptions struct {
// contains filtered or unexported fields
}
type EphemeralVolumeTemplateOptions ¶ added in v0.30.0
type EphemeralVolumeTemplateOptions struct {
StorageClassName *string
}
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) DetectedEvent ¶ added in v0.27.1
func (e *EventRecorder) DetectedEvent(msg string) bool
func (*EventRecorder) Events ¶ added in v0.28.0
func (e *EventRecorder) Events() (res []events.Event)
func (*EventRecorder) ForEachEvent ¶
func (e *EventRecorder) ForEachEvent(f func(evt events.Event))
func (*EventRecorder) Publish ¶
func (e *EventRecorder) Publish(evts ...events.Event)
func (*EventRecorder) Reset ¶
func (e *EventRecorder) Reset()
type FeatureGates ¶ added in v0.32.0
type FeatureGates struct {
Drift *bool
}
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 OptionsFields ¶ added in v0.32.0
type OptionsFields struct { // Vendor Neutral ServiceName *string DisableWebhook *bool WebhookPort *int MetricsPort *int WebhookMetricsPort *int HealthProbePort *int KubeClientQPS *int KubeClientBurst *int EnableProfiling *bool EnableLeaderElection *bool MemoryLimit *int64 LogLevel *string BatchMaxDuration *time.Duration BatchIdleDuration *time.Duration FeatureGates FeatureGates }
type PDBOptions ¶
type PDBOptions struct { metav1.ObjectMeta Labels map[string]string MinAvailable *intstr.IntOrString Status *policyv1.PodDisruptionBudgetStatus }
type PersistentVolumeClaimOptions ¶
type PersistentVolumeClaimOptions struct { metav1.ObjectMeta StorageClassName *string VolumeName string Resources v1.ResourceRequirements }
type PersistentVolumeOptions ¶
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 EphemeralVolumeTemplates []EphemeralVolumeTemplateOptions HostPorts []int32 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.MachineTemplateRef 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 StorageClassOptions ¶
type StorageClassOptions struct { metav1.ObjectMeta Zones []string Provisioner *string VolumeBindingMode *storagev1.VolumeBindingMode }