vmi

package
v0.0.0-...-9e127a4 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package vmi source: https://github.com/kubevirt/kubevirt/blob/v0.53.0/tests/libnet

Package vmi source https://github.com/kubevirt/kubevirt/tree/v0.53.0/tests/libvmi

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

func Delete(ctx context.Context, c KubevirtVmisClient, namespace, name string) error

func NewAlpine

func NewAlpine(name string, opts ...Option) *kvcorev1.VirtualMachineInstance

func NewNetworkData

func NewNetworkData(options ...networkDataOption) (string, error)

func NewNodeAffinity

func NewNodeAffinity(nodeName string) *k8scorev1.NodeAffinity

NewNodeAffinity returns new node affinity with node selector of the given node name. Adding it to a VMI will make sure it will schedule on the given node name.

func NewPodAntiAffinity

func NewPodAntiAffinity(label Label) *k8scorev1.PodAntiAffinity

NewPodAntiAffinity returns new pod anti-affinity with label selector of the given label key and value. Adding it to a VMI will make sure it won't schedule on the same node as other VMIs with the given label.

func RandomIPAddress

func RandomIPAddress() string

RandomIPAddress return random private IPv4 CIDR notation address from range 10.0.0.0/8

func RandomMACAddress

func RandomMACAddress() string

RandomMACAddress return random local unicast MAC address

func WaitForStatusIPAddress

func WaitForStatusIPAddress(ctx context.Context, c KubevirtVmisClient, namespace, name string) (*kvcorev1.VirtualMachineInstance, error)

func WaitForVmiDispose

func WaitForVmiDispose(ctx context.Context, c KubevirtVmisClient, namespace, name string) error

func WithAddresses

func WithAddresses(addresses ...string) networkDataInterfaceOption

func WithBindingFromNetAttachDef

func WithBindingFromNetAttachDef(netAttachDef *netattachdefv1.NetworkAttachmentDefinition) interfaceOption

WithBindingFromNetAttachDef realize which binding the interface should be conditioned with according to the given NetworkAttachmentDefinition network config.

func WithEthernet

func WithEthernet(name string, options ...networkDataInterfaceOption) networkDataOption

func WithMacAddress

func WithMacAddress(macAddress string) interfaceOption

WithMacAddress set the interface with custom MAC address.

func WithMatchingMAC

func WithMatchingMAC(macAddress string) networkDataInterfaceOption

Types

type KubevirtVmisClient

type KubevirtVmisClient interface {
	GetVirtualMachineInstance(ctx context.Context, namespace, name string) (*kvcorev1.VirtualMachineInstance, error)
	CreateVirtualMachineInstance(
		ctx context.Context,
		namespace string,
		vmi *kvcorev1.VirtualMachineInstance) (*kvcorev1.VirtualMachineInstance, error)
	DeleteVirtualMachineInstance(ctx context.Context, namespace, name string) error
	SerialConsole(namespace, vmiName string, timeout time.Duration) (kubecli.StreamInterface, error)
	GetNetworkAttachmentDefinition(ctx context.Context, namespace, name string) (*netattdefv1.NetworkAttachmentDefinition, error)
}

type Label

type Label struct {
	Key, Value string
}

type Option

type Option func(vmi *kvcorev1.VirtualMachineInstance)

Option represents an action that enables an option.

func WithAffinity

func WithAffinity(affinity *k8scorev1.Affinity) Option

WithAffinity adds the given affinity.

func WithCloudInitNoCloudNetworkData

func WithCloudInitNoCloudNetworkData(opts ...networkDataOption) Option

WithCloudInitNoCloudNetworkData adds cloud-init no-cloud network data with the given options.

func WithInterface

func WithInterface(name string, opts ...interfaceOption) Option

WithInterface adds new interface based on the specified With* options..

func WithLabels

func WithLabels(labels ...Label) Option

WithLabels adds the given labels.

func WithMultusNetwork

func WithMultusNetwork(networkName, netAttachDefName string) Option

WithMultusNetwork adds network with Multus network source.

func WithOwnerReference

func WithOwnerReference(ownerName, ownerUID string) Option

Jump to

Keyboard shortcuts

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