🌱 Add VLAN interface configuration support#1424
🌱 Add VLAN interface configuration support#1424shutingm-kubernetes wants to merge 5 commits intovmware-tanzu:mainfrom
Conversation
652b776 to
7288101
Compare
15d7f2c to
b6f4985
Compare
|
I have a basic question. Was there a design discussion (specifically for the API design)? I think you are referring to guest VLAN tagging (802.1Q) where one vNIC can be tagged with multiple VLAN IDs, but even then, I would also want to consider the following model: |
|
Hi Arunesh,
|
b6f4985 to
fc14b02
Compare
Hi Arunesh, Following up on your and Andrew's suggestions, I have updated the schema to nest the VLAN configuration directly under the interface. The updated model now looks like this: spec:
network:
interfaces:
- name: eth0
network:
apiVersion: crd.nsx.vmware.com/v1alpha1
kind: SubnetSet
name: primary
- name: eth1
network:
apiVersion: netoperator.vmware.com/v1alpha1
kind: Subnet
name: vlan-ext
vlans:
- name: vl100a
id: 100
- name: vl200a
id: 200 |
be29504 to
58e6fa6
Compare
webhooks/virtualmachine/validation/virtualmachine_validator_unit_test.go
Outdated
Show resolved
Hide resolved
58e6fa6 to
c83d919
Compare
1569eb5 to
5745983
Compare
webhooks/virtualmachine/validation/virtualmachine_validator_unit_test.go
Show resolved
Hide resolved
webhooks/virtualmachine/validation/virtualmachine_validator_unit_test.go
Outdated
Show resolved
Hide resolved
Add VLANs field to VirtualMachineNetworkSpec allowing users to configure 802.1Q VLAN interfaces on top of physical network interfaces. Supported with CloudInit bootstrap provider. # Conflicts: # api/test/v1alpha5/virtualmachine_conversion_test.go # Conflicts: # api/v1alpha2/virtualmachine_conversion.go # api/v1alpha3/virtualmachine_conversion.go # api/v1alpha4/virtualmachine_conversion.go
d7c4028 to
fcf979b
Compare
What does this PR do, and why is it needed?
Add VLANs field to VirtualMachineNetworkSpec allowing users to configure 802.1Q VLAN interfaces on top of physical network interfaces. Supported with CloudInit bootstrap provider.
Which issue(s) is/are addressed by this PR? (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)format, will close the issue(s) when PR gets merged):Fixes #
Are there any special notes for your reviewer:
Test Cases Summary
1. API Validation (WebHook)
Webhook Validation Tests
-
eth0,eth1-
eth1.vlans:v100(ID=100),v200(ID=200)-
eth0,eth1-
eth1.vlans:v100(ID=100)spec.network.vlans: Forbidden: vlans is available only with the following bootstrap providers: CloudInit-
eth0,eth1-
eth1.vlans:v100(ID=100)spec.network.vlans: Forbidden: vlans is available only with the following bootstrap providers: CloudInit-
eth0,eth1-
eth1.vlans:vl100a(ID=100),vl100b(ID=100)spec.network.vlans[1].id: Invalid value: 100: VLAN ID 100 is already used by VLAN "vl100a" on the same parent link "eth1"-
eth0,eth1,eth2-
eth1.vlans:vl100(ID=100),-
eth2.vlans:v100(ID=100)The VirtualMachine "photon-vlans" is invalid: spec.network.vlans[1]: Duplicate value: map[string]interface {}{"name":"vl100"}-
eth0,eth1-
eth1.vlans:eth1(ID=100)spec.network.vlans[0].name: Invalid value: "eth1": vlan name must not conflict with an interface name-
eth0,eth1(GuestDeviceName: ens100)-
eth1.vlans:ens100(ID=100)spec.network.vlans[0].name: Invalid value: "ens100": vlan name must not conflict with an interface guestDeviceName2. CloudInit Netplan Config Generation
Test Case 1 — Single VLAN
VM CR spec:
Expected Netplan config generated (injected via Cloud-Init):
OS result: Inside the guest,
ip linkshowseth1(physical NIC) andvlan100(802.1Q sub-interface tagged with VLAN ID 100, parenteth1).Test Case 2 — Multiple VLANs
VM CR spec:
Expected Netplan config generated:
OS result: Inside the guest,
ip linkshowseth1,eth2(physical NICs) and 4 VLAN sub-interfaces —vl100a(VLAN 100 oneth1),vl200a(VLAN 200 oneth1),vl100b(VLAN 100 oneth2),vl200b(VLAN 200 oneth2). Same VLAN ID is allowed on different parent links.Test Case 3 — No VLANs
VM CR spec:
Expected Netplan config generated:
OS result: Inside the guest, only
eth0(physical NIC) is present. No VLAN sub-interfaces are created.Please add a release note if necessary: