Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Remove the v1a2 Network top-level interface-related fields #259

Merged
merged 1 commit into from
Nov 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion api/v1alpha1/virtualmachine_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,6 @@ func Convert_v1alpha1_VirtualMachineSpec_To_v1alpha2_VirtualMachineSpec(
networkInterfaceSpec := convert_v1alpha1_NetworkInterface_To_v1alpha2_NetworkInterfaceSpec(i, networkInterface)
out.Network.Interfaces = append(out.Network.Interfaces, networkInterfaceSpec)
}
// TODO: out.Network.Network = ???

out.ReadinessProbe = convert_v1alpha1_Probe_To_v1alpha2_ReadinessProbeSpec(in.ReadinessProbe)
out.Advanced = convert_v1alpha1_VirtualMachineAdvancedOptions_To_v1alpha2_VirtualMachineAdvancedSpec(in.AdvancedOptions)
Expand Down
175 changes: 7 additions & 168 deletions api/v1alpha2/virtualmachine_network_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,18 +160,14 @@ type VirtualMachineNetworkInterfaceSpec struct {

// VirtualMachineNetworkSpec defines a VM's desired network configuration.
type VirtualMachineNetworkSpec struct {
// Network is the optional name of the network resource to which this
// VM is connected.
//
// Please note if the Interfaces field is non-empty then this field is
// ignored.
// HostName is the value the guest uses as its host name.
// If omitted then the name of the VM will be used.
//
// If networking is not disabled, no interfaces are defined, and this value
// is omitted, then the VM will be provided a single virtual network
// interface and connected to the Namespace's default network.
// Please note this feature is available only with the following bootstrap
// providers: CloudInit, LinuxPrep, and Sysprep (except for RawSysprep).
//
// +optional
Network *common.PartialObjectRef `json:"network,omitempty"`
HostName string `json:"hostName,omitempty"`

// Disabled is a flag that indicates whether or not to disable networking
// for this VM.
Expand All @@ -182,172 +178,15 @@ type VirtualMachineNetworkSpec struct {
// +optional
Disabled bool `json:"disabled,omitempty"`

// HostName is the value the guest uses as its host name.
// If omitted then the name of the VM will be used.
//
// Please note this feature is available only with the following bootstrap
// providers: CloudInit, LinuxPrep, and Sysprep (except for RawSysprep).
//
// +optional
HostName string `json:"hostName,omitempty"`

// Interfaces is the list of network interfaces used by this VM.
//
// Please note this field is mutually exclusive with the following fields:
// DeviceName, Network, Addresses, DHCP4, DHCP6, Gateway4,
// Gateway6, MTU, Nameservers, Routes, and SearchDomains.
// If the Interfaces field is empty and the Disabled field is false, then
// a default interface with the name eth0 will be created.
//
// +optional
// +listType=map
// +listMapKey=name
Interfaces []VirtualMachineNetworkInterfaceSpec `json:"interfaces,omitempty"`

// DeviceName describes the unique name of this network interface, used to
// distinguish it from other network interfaces attached to this VM.
//
// This value is also used to rename the device inside the guest when the
// bootstrap provider is CloudInit. Please note it is up to the user to
// ensure the provided device name does not conflict with any other devices
// inside the guest, ex. dvd, cdrom, sda, etc.
//
// Please note if the Interfaces field is non-empty then this field is
// ignored and should be specified on the elements in the Interfaces list.
//
// If the Interfaces field is empty and this field is not specified, then
// the default interface's name will be eth0.
//
// +optional
// +kubebuilder:validation:Pattern=^\w\w+$
DeviceName string `json:"deviceName,omitempty"`

// Addresses is an optional list of IP4 or IP6 addresses to assign to the
// VM.
//
// Please note this field is only supported if the connected network
// supports manual IP allocation.
//
// Please note IP4 and IP6 addresses must include the network prefix length,
// ex. 192.168.0.10/24 or 2001:db8:101::a/64.
//
// Please note this field may not contain IP4 addresses if DHCP4 is set
// to true or IP6 addresses if DHCP6 is set to true.
//
// Please note if the Interfaces field is non-empty then this field is
// ignored and should be specified on the elements in the Interfaces list.
//
// +optional
Addresses []string `json:"addresses,omitempty"`

// DHCP4 indicates whether or not to use DHCP for IP4 networking.
//
// Please note this field is only supported if the network connection
// supports DHCP.
//
// Please note this field is mutually exclusive with IP4 addresses in the
// Addresses field and the Gateway4 field.
//
// Please note if the Interfaces field is non-empty then this field is
// ignored and should be specified on the elements in the Interfaces list.
//
// +optional
DHCP4 bool `json:"dhcp4,omitempty"`

// DHCP6 indicates whether or not to use DHCP for IP6 networking.
//
// Please note this field is only supported if the network connection
// supports DHCP.
//
// Please note this field is mutually exclusive with IP6 addresses in the
// Addresses field and the Gateway6 field.
//
// Please note if the Interfaces field is non-empty then this field is
// ignored and should be specified on the elements in the Interfaces list.
//
// +optional
DHCP6 bool `json:"dhcp6,omitempty"`

// Gateway4 is the default, IP4 gateway for this VM.
//
// Please note this field is only supported if the network connection
// supports manual IP allocation.
//
// If the network connection supports manual IP allocation and the
// Addresses field includes at least one IP4 address, then this field
// is required.
//
// Please note this field is mutually exclusive with DHCP4.
//
// Please note if the Interfaces field is non-empty then this field is
// ignored and should be specified on the elements in the Interfaces list.
//
// +optional
Gateway4 string `json:"gateway4,omitempty"`

// Gateway6 is the primary IP6 gateway for this VM.
//
// Please note this field is only supported if the network connection
// supports manual IP allocation.
//
// If the network connection supports manual IP allocation and the
// Addresses field includes at least one IP6 address, then this field
// is required.
//
// Please note this field is mutually exclusive with DHCP6.
//
// Please note if the Interfaces field is non-empty then this field is
// ignored and should be specified on the elements in the Interfaces list.
//
// +optional
Gateway6 string `json:"gateway6,omitempty"`

// MTU is the Maximum Transmission Unit size in bytes.
//
// Please note this feature is available only with the following bootstrap
// providers: CloudInit.
//
// Please note if the Interfaces field is non-empty then this field is
// ignored and should be specified on the elements in the Interfaces list.
//
// +optional
MTU *int64 `json:"mtu,omitempty"`

// Nameservers is a list of IP4 and/or IP6 addresses used as DNS
// nameservers.
//
// Please note this feature is available only with the following bootstrap
// providers: CloudInit, LinuxPrep, and Sysprep (except for RawSysprep).
//
// Please note that Linux allows only three nameservers
// (https://linux.die.net/man/5/resolv.conf).
//
// Please note if the Interfaces field is non-empty then this field is
// ignored and should be specified on the elements in the Interfaces list.
//
// +optional
Nameservers []string `json:"nameservers,omitempty"`

// Routes is a list of optional, static routes.
//
// Please note this feature is available only with the following bootstrap
// providers: CloudInit.
//
// Please note if the Interfaces field is non-empty then this field is
// ignored and should be specified on the elements in the Interfaces list.
//
// +optional
Routes []VirtualMachineNetworkRouteSpec `json:"routes,omitempty"`

// SearchDomains is a list of search domains used when resolving IP
// addresses with DNS.
//
// Please note this feature is available only with the following bootstrap
// providers: CloudInit, LinuxPrep, and Sysprep (except for RawSysprep).
//
// Please note if the Interfaces field is non-empty then this field is
// ignored and should be specified on the elements in the Interfaces list.
//
// +optional
SearchDomains []string `json:"searchDomains,omitempty"`
}

// VirtualMachineNetworkDNSStatus describes the observed state of the guest's
Expand Down
30 changes: 0 additions & 30 deletions api/v1alpha2/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading