Documentation
¶
Index ¶
- Constants
- Variables
- func NormalizeNetplanMac(mac string) string
- func ToCidrNotation(ip string, mask string) string
- type IPConfig
- type IPFamily
- type InterfaceInfo
- type InterfaceInfoList
- func (l InterfaceInfoList) GetIPConfigs() []IPConfig
- func (l InterfaceInfoList) GetInterfaceCustomizations() []vimtypes.CustomizationAdapterMapping
- func (l InterfaceInfoList) GetNetplan(currentEthCards object.VirtualDeviceList, dnsServers, searchSuffixes []string) Netplan
- func (l InterfaceInfoList) GetVirtualDeviceList() object.VirtualDeviceList
- type Netplan
- type NetplanEthernet
- type NetplanEthernetMatch
- type NetplanEthernetNameserver
- type Provider
Constants ¶
const ( NsxtNetworkType = "nsx-t" VdsNetworkType = "vsphere-distributed" )
Variables ¶
var ErrNamedNetworkProviderNotSupported = fmt.Errorf("named network provider is not supported in production")
ErrNamedNetworkProviderNotSupported is returned if the named network provider is used in production deployments of VM Operator.
Functions ¶
func NormalizeNetplanMac ¶
NormalizeNetplanMac normalizes the mac address format to one compatible with netplan.
func ToCidrNotation ¶
ToCidrNotation takes ip and mask as ip addresses and returns a cidr notation. It Assumes ipv4.
Types ¶
type IPConfig ¶
type IPConfig struct { // IP setting. IP string // IPFamily specifies the IP family (IPv4 vs IPv6) the IP belongs to. IPFamily IPFamily // Gateway setting. Gateway string // SubnetMask setting. SubnetMask string }
IPConfig represents an IP configuration.
type IPFamily ¶
type IPFamily string
IPFamily represents the IP Family (IPv4 or IPv6). This type is used to express the family of an IP expressed by a type (i.e. service.Spec.IPFamily) NOTE: Copied from k8s.io/api/core/v1" because VM Operator is using old version.
type InterfaceInfo ¶
type InterfaceInfo struct { Device vimtypes.BaseVirtualDevice Customization *vimtypes.CustomizationAdapterMapping IPConfiguration IPConfig NetplanEthernet NetplanEthernet }
type InterfaceInfoList ¶
type InterfaceInfoList []InterfaceInfo
func (InterfaceInfoList) GetIPConfigs ¶
func (l InterfaceInfoList) GetIPConfigs() []IPConfig
func (InterfaceInfoList) GetInterfaceCustomizations ¶
func (l InterfaceInfoList) GetInterfaceCustomizations() []vimtypes.CustomizationAdapterMapping
func (InterfaceInfoList) GetNetplan ¶
func (l InterfaceInfoList) GetNetplan( currentEthCards object.VirtualDeviceList, dnsServers, searchSuffixes []string) Netplan
func (InterfaceInfoList) GetVirtualDeviceList ¶
func (l InterfaceInfoList) GetVirtualDeviceList() object.VirtualDeviceList
type Netplan ¶
type Netplan struct { Version int `yaml:"version,omitempty"` Ethernets map[string]NetplanEthernet `yaml:"ethernets,omitempty"` }
Netplan representation described in https://via.vmw.com/cloud-init-netplan
type NetplanEthernet ¶
type NetplanEthernet struct { Match NetplanEthernetMatch `yaml:"match,omitempty"` SetName string `yaml:"set-name,omitempty"` Dhcp4 bool `yaml:"dhcp4,omitempty"` Addresses []string `yaml:"addresses,omitempty"` Gateway4 string `yaml:"gateway4,omitempty"` Nameservers NetplanEthernetNameserver `yaml:"nameservers,omitempty"` }
type NetplanEthernetMatch ¶
type NetplanEthernetMatch struct {
MacAddress string `yaml:"macaddress,omitempty"`
}
type Provider ¶
type Provider interface { // EnsureNetworkInterface returns the NetworkInterfaceInfo for the vif. EnsureNetworkInterface(vmCtx context.VirtualMachineContext, vif *v1alpha1.VirtualMachineNetworkInterface) (*InterfaceInfo, error) }
Provider sets up network for different type of network.
func NewProvider ¶
func NewProvider( k8sClient ctrlruntime.Client, vimClient *vim25.Client, finder *find.Finder, cluster *object.ClusterComputeResource) Provider