Documentation ¶
Index ¶
- Constants
- func ClusterDNSServiceIP() (string, error)
- func CreateDefaultCloudInitNetworkData() (string, error)
- func InterfaceDeviceWithBridgeBinding(name string) kvirtv1.Interface
- func InterfaceDeviceWithMasqueradeBinding(ports ...kvirtv1.Port) kvirtv1.Interface
- func InterfaceDeviceWithSRIOVBinding(name string) kvirtv1.Interface
- func InterfaceDeviceWithSlirpBinding(name string) kvirtv1.Interface
- func InterfaceWithMac(iface *kvirtv1.Interface, macAddress string) *kvirtv1.Interface
- func MultusNetwork(name, nadName string) *kvirtv1.Network
- func New(name string, opts ...Option) *kvirtv1.VirtualMachineInstance
- func NewFedora(opts ...Option) *kvirtv1.VirtualMachineInstance
- func NewNetworkData(options ...NetworkDataOption) (string, error)
- func RandName(name string) string
- func SearchDomains() []string
- type CloudInitInterface
- type CloudInitMatch
- type CloudInitNameservers
- type CloudInitNetworkData
- type CloudInitRoute
- type NetworkDataInterfaceOption
- func WithAcceptRA() NetworkDataInterfaceOption
- func WithAddresses(addresses ...string) NetworkDataInterfaceOption
- func WithDHCP4Enabled() NetworkDataInterfaceOption
- func WithDHCP6Enabled() NetworkDataInterfaceOption
- func WithGateway6(gateway6 string) NetworkDataInterfaceOption
- func WithMTU(mtuSize int) NetworkDataInterfaceOption
- func WithMatchingMAC(macAddress string) NetworkDataInterfaceOption
- func WithNameserverFromCluster() NetworkDataInterfaceOption
- type NetworkDataOption
- type Option
- func WithAnnotation(key, value string) Option
- func WithCloudInitNoCloudNetworkData(data string, b64Encoding bool) Option
- func WithCloudInitNoCloudUserData(data string, b64Encoding bool) Option
- func WithContainerImage(name string) Option
- func WithHugepages(size resource.Quantity) Option
- func WithInterface(iface kvirtv1.Interface) Option
- func WithLabel(key, value string) Option
- func WithNamespace(namespace string) Option
- func WithNetwork(network *kvirtv1.Network) Option
- func WithNodeSelector(nodeName string) Option
- func WithResourceMemory(value string) Option
- func WithRng() Option
- func WithSEV() Option
- func WithTerminationGracePeriod(seconds int64) Option
- func WithUefi(secureBoot bool) Option
Constants ¶
const ( DefaultIPv6Address = "fd10:0:2::2" DefaultIPv6CIDR = DefaultIPv6Address + "/120" DefaultIPv6Gateway = "fd10:0:2::1" )
const ( DefaultTestGracePeriod int64 = 0 DefaultVmiName = "testvmi" )
Default VMI values
const DefaultInterfaceName = "default"
Variables ¶
This section is empty.
Functions ¶
func ClusterDNSServiceIP ¶
ClusterDNSServiceIP returns the cluster IP address of the DNS service. Attempts first to detect the DNS service on a k8s cluster and if not found on an openshift cluster.
func CreateDefaultCloudInitNetworkData ¶
CreateDefaultCloudInitNetworkData generates a default configuration for the Cloud-Init Network Data, in version 2 format. The default configuration sets dynamic IPv4 (DHCP) and static IPv6 addresses, including DNS settings of the cluster nameserver IP and search domains.
func InterfaceDeviceWithBridgeBinding ¶
InterfaceDeviceWithBridgeBinding returns an Interface with bridge binding.
func InterfaceDeviceWithMasqueradeBinding ¶
InterfaceDeviceWithMasqueradeBinding returns an Interface named "default" with masquerade binding.
func InterfaceDeviceWithSRIOVBinding ¶
InterfaceDeviceWithSRIOVBinding returns an Interface with SRIOV binding.
func InterfaceDeviceWithSlirpBinding ¶
InterfaceDeviceWithSlirpBinding returns an Interface with SLIRP binding.
func InterfaceWithMac ¶
InterfaceWithMac decorates an existing Interface with a MAC address.
func MultusNetwork ¶
MultusNetwork returns a Network with the given name, associated to the given nad
func New ¶
func New(name string, opts ...Option) *kvirtv1.VirtualMachineInstance
New instantiates a new VMI configuration, building its properties based on the specified With* options.
func NewFedora ¶
func NewFedora(opts ...Option) *kvirtv1.VirtualMachineInstance
NewFedora instantiates a new Fedora based VMI configuration, building its extra properties based on the specified With* options.
func NewNetworkData ¶
func NewNetworkData(options ...NetworkDataOption) (string, error)
func RandName ¶
RandName returns a random name by concatenating the given name with a hyphen and a random string.
func SearchDomains ¶
func SearchDomains() []string
SearchDomains returns a list of default search name domains.
Types ¶
type CloudInitInterface ¶
type CloudInitInterface struct { AcceptRA *bool `json:"accept-ra,omitempty"` Addresses []string `json:"addresses,omitempty"` DHCP4 *bool `json:"dhcp4,omitempty"` DHCP6 *bool `json:"dhcp6,omitempty"` DHCPIdentifier string `json:"dhcp-identifier,omitempty"` // "duid" or "mac" Gateway4 string `json:"gateway4,omitempty"` Gateway6 string `json:"gateway6,omitempty"` Nameservers CloudInitNameservers `json:"nameservers,omitempty"` MACAddress string `json:"macaddress,omitempty"` Match CloudInitMatch `json:"match,omitempty"` MTU int `json:"mtu,omitempty"` Routes []CloudInitRoute `json:"routes,omitempty"` SetName string `json:"set-name,omitempty"` // contains filtered or unexported fields }
type CloudInitMatch ¶
type CloudInitNameservers ¶
type CloudInitNetworkData ¶
type CloudInitNetworkData struct { Version int `json:"version"` Ethernets map[string]CloudInitInterface `json:"ethernets,omitempty"` }
type CloudInitRoute ¶
type CloudInitRoute struct { From string `json:"from,omitempty"` OnLink *bool `json:"on-link,omitempty"` Scope string `json:"scope,omitempty"` Table *int `json:"table,omitempty"` To string `json:"to,omitempty"` Type string `json:"type,omitempty"` Via string `json:"via,omitempty"` Metric *int `json:"metric,omitempty"` }
type NetworkDataInterfaceOption ¶
type NetworkDataInterfaceOption func(*CloudInitInterface) error
func WithAcceptRA ¶
func WithAcceptRA() NetworkDataInterfaceOption
func WithAddresses ¶
func WithAddresses(addresses ...string) NetworkDataInterfaceOption
func WithDHCP4Enabled ¶
func WithDHCP4Enabled() NetworkDataInterfaceOption
func WithDHCP6Enabled ¶
func WithDHCP6Enabled() NetworkDataInterfaceOption
func WithGateway6 ¶
func WithGateway6(gateway6 string) NetworkDataInterfaceOption
func WithMTU ¶
func WithMTU(mtuSize int) NetworkDataInterfaceOption
func WithMatchingMAC ¶
func WithMatchingMAC(macAddress string) NetworkDataInterfaceOption
func WithNameserverFromCluster ¶
func WithNameserverFromCluster() NetworkDataInterfaceOption
type NetworkDataOption ¶
type NetworkDataOption func(*CloudInitNetworkData) error
func WithEthernet ¶
func WithEthernet(name string, options ...NetworkDataInterfaceOption) NetworkDataOption
type Option ¶
type Option func(vmi *kvirtv1.VirtualMachineInstance)
Option represents an action that enables an option.
func WithAnnotation ¶
WithAnnotation adds an annotation with specified value
func WithCloudInitNoCloudNetworkData ¶
WithCloudInitNoCloudNetworkData adds cloud-init no-cloud network data.
func WithCloudInitNoCloudUserData ¶
WithCloudInitNoCloudUserData adds cloud-init no-cloud user data.
func WithContainerImage ¶
WithContainerImage specifies the name of the container image to be used.
func WithHugepages ¶
func WithInterface ¶
WithInterface adds a Domain Device Interface.
func WithNetwork ¶
WithNetwork adds a network object.
func WithNodeSelector ¶
WithNodeSelectorFor ensures that the VMI gets scheduled on the specified node
func WithResourceMemory ¶
WithResourceMemory specifies the vmi memory resource.
func WithTerminationGracePeriod ¶
WithTerminationGracePeriod specifies the termination grace period in seconds.