Skip to content

WIP:🌱 Add VLAN interface configuration support#1424

Open
shutingm-kubernetes wants to merge 1 commit intovmware-tanzu:mainfrom
shutingm-kubernetes:shutingm/supports-vlans-in-cloudinit
Open

WIP:🌱 Add VLAN interface configuration support#1424
shutingm-kubernetes wants to merge 1 commit intovmware-tanzu:mainfrom
shutingm-kubernetes:shutingm/supports-vlans-in-cloudinit

Conversation

@shutingm-kubernetes
Copy link

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:

Please add a release note if necessary:


Add VLANs field to VirtualMachineNetworkSpec allowing users to
configure 802.1Q VLAN interfaces on top of physical network
interfaces. Supported with CloudInit bootstrap provider.
@github-actions github-actions bot added the size/XL Denotes a PR that changes 500-999 lines. label Jan 21, 2026
@shutingm-kubernetes
Copy link
Author

Tests and Results

VirtualMachine CR:

apiVersion: vmoperator.vmware.com/v1alpha5
kind: VirtualMachine
metadata:
  name: photon-vlans
spec:
  bootstrap:
    cloudInit:
      rawCloudConfig:
        key: user-data
        name: test-cluster-worker-x8hvf-z5652-8q2tg
  className: best-effort-small
  image:
    kind: ClusterVirtualMachineImage
    name: vmi-da41afc59a010c431
  network:
    vlans:
      vl100:
        id: 100
        link: eth1
      vl200:
        id: 200
        link: eth1
      vl300:
        id: 300
        link: eth2
      vl400:
        id: 400
        link: eth2
    interfaces:
      - name: eth0
        network:
          apiVersion: crd.nsx.vmware.com/v1alpha1
          kind: SubnetSet
          name: test-cluster-ptktx
      - name: eth1
        network:
          apiVersion: netoperator.vmware.com/v1alpha1
          kind: Subnet
          name: vlan-ext
      - name: eth2
        network:
          apiVersion: netoperator.vmware.com/v1alpha1
          kind: Subnet
          name: vlan-ext

After vm created, login and check:

root@photon-vm [ ~ ]# /usr/bin/vmware-rpctool 'info-get guestinfo.metadata' | base64 -d | gunzip
hostname: photon-vm
instance-id: 8660a0c5-b5bb-4a77-89b8-400d72270ed2
local-hostname: photon-vm
network:
  ethernets:
    eth0:
      accept-ra: false
      addresses:
      - 192.168.128.44/16
      dhcp4: false
      dhcp6: false
      gateway4: 192.168.1.1
      match:
        macaddress: 00:50:56:b7:42:0f
      nameservers:
        addresses:
        - 192.19.189.10
        - 192.19.189.20
      set-name: eth0
    eth1:
      accept-ra: false
      addresses:
      - 172.16.0.3/16
      dhcp4: false
      dhcp6: false
      match:
        macaddress: 00:50:56:b7:d3:78
      nameservers:
        addresses:
        - 192.19.189.10
        - 192.19.189.20
      set-name: eth1
  version: 2
  vlans:
    vl100:
      id: 100
      link: eth1
root@photon-vm [ ~ ]# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.128.44  netmask 255.255.0.0  broadcast 192.168.255.255
        inet6 fe80::250:56ff:feb7:420f  prefixlen 64  scopeid 0x20<link>
        ether 00:50:56:b7:42:0f  txqueuelen 1000  (Ethernet)
        RX packets 193834  bytes 137541319 (131.1 MiB)
        RX errors 3  dropped 751  overruns 0  frame 0
        TX packets 10553  bytes 1048527 (1023.9 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.16.0.3  netmask 255.255.0.0  broadcast 172.16.255.255
        inet6 fe80::250:56ff:feb7:d378  prefixlen 64  scopeid 0x20<link>
        ether 00:50:56:b7:d3:78  txqueuelen 1000  (Ethernet)
        RX packets 106839  bytes 7988690 (7.6 MiB)
        RX errors 0  dropped 617  overruns 0  frame 0
        TX packets 3918  bytes 560096 (546.9 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 1268  bytes 168268 (164.3 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1268  bytes 168268 (164.3 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

vl100: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fe80::250:56ff:feb7:d378  prefixlen 64  scopeid 0x20<link>
        ether 00:50:56:b7:d3:78  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 80  bytes 5800 (5.6 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
root@photon-vm [ ~ ]# ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc prio state UP mode DEFAULT group default qlen 1000
    link/ether 00:50:56:b7:42:0f brd ff:ff:ff:ff:ff:ff
    altname eno1
    altname enp11s0
    altname ens192
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc prio state UP mode DEFAULT group default qlen 1000
    link/ether 00:50:56:b7:d3:78 brd ff:ff:ff:ff:ff:ff
    altname eno2
    altname enp19s0
    altname ens224
4: vl100@eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
    link/ether 00:50:56:b7:d3:78 brd ff:ff:ff:ff:ff:ff
5: gre0@NONE: <NOARP> mtu 1476 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/gre 0.0.0.0 brd 0.0.0.0
6: gretap0@NONE: <BROADCAST,MULTICAST> mtu 1462 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff
7: erspan0@NONE: <BROADCAST,MULTICAST> mtu 1450 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/XL Denotes a PR that changes 500-999 lines.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant