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 ¶
- func Delete(ctx context.Context, c KubevirtVmisClient, namespace, name string) error
- func NewAlpine(name string, opts ...Option) *kvcorev1.VirtualMachineInstance
- func NewNetworkData(options ...networkDataOption) (string, error)
- func NewNodeAffinity(nodeName string) *k8scorev1.NodeAffinity
- func NewPodAntiAffinity(label Label) *k8scorev1.PodAntiAffinity
- func RandomIPAddress() string
- func RandomMACAddress() string
- func Start(ctx context.Context, c KubevirtVmisClient, namespace string, ...) error
- func WaitForStatusIPAddress(ctx context.Context, c KubevirtVmisClient, namespace, name string) (*kvcorev1.VirtualMachineInstance, error)
- func WaitForVmiDispose(ctx context.Context, c KubevirtVmisClient, namespace, name string) error
- func WithAddresses(addresses ...string) networkDataInterfaceOption
- func WithBindingFromNetAttachDef(netAttachDef *netattachdefv1.NetworkAttachmentDefinition) interfaceOption
- func WithEthernet(name string, options ...networkDataInterfaceOption) networkDataOption
- func WithMacAddress(macAddress string) interfaceOption
- func WithMatchingMAC(macAddress string) networkDataInterfaceOption
- type KubevirtVmisClient
- type Label
- type Option
- func WithAffinity(affinity *k8scorev1.Affinity) Option
- func WithCloudInitNoCloudNetworkData(opts ...networkDataOption) Option
- func WithInterface(name string, opts ...interfaceOption) Option
- func WithLabels(labels ...Label) Option
- func WithMultusNetwork(networkName, netAttachDefName string) Option
- func WithOwnerReference(ownerName, ownerUID string) Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewNetworkData ¶
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 Start ¶
func Start(ctx context.Context, c KubevirtVmisClient, namespace string, vmi *kvcorev1.VirtualMachineInstance) error
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 Option ¶
type Option func(vmi *kvcorev1.VirtualMachineInstance)
Option represents an action that enables an option.
func WithAffinity ¶
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 ¶
WithInterface adds new interface based on the specified With* options..
func WithMultusNetwork ¶
WithMultusNetwork adds network with Multus network source.