Skip to content

✨ Dual-stack networking: NetOP IPv6 assignment modes, VirtualMachineService changes#1552

Open
hpannem wants to merge 7 commits intovmware-tanzu:mainfrom
hpannem:topic/hpannem/dualstack-final
Open

✨ Dual-stack networking: NetOP IPv6 assignment modes, VirtualMachineService changes#1552
hpannem wants to merge 7 commits intovmware-tanzu:mainfrom
hpannem:topic/hpannem/dualstack-final

Conversation

@hpannem
Copy link
Copy Markdown
Contributor

@hpannem hpannem commented Apr 8, 2026

What does this PR do, and why is it needed?

  • NetOP: Bumps net-operator-api and derives IPv4 vs IPv6 assignment from status.ipAssignmentMode and status.ipv6AssignmentMode (unset IPv6 mode treated as none). Static IPConfigs are emitted only for families in static-pool mode. Updates tests and the bundled NetOP CRD reference as needed.
  • VirtualMachineService (v1alpha6): Dual-stack Service fields (ipFamilies, ipFamilyPolicy) and controller behavior for endpoints; extends unit/integration coverage.
  • Older API versions: VirtualMachineService uses conversion annotations so hub-only dual-stack fields round-trip. VirtualMachine restores spec.network.interfaces[].ipFamilyPolicy on spoke→hub (by interface name) together with existing VLAN/bootstrap/etc. restores.
  • conversion-gen: Regenerated zz_generated.conversion.go so VirtualMachineNetworkSpec.Interfaces converts via per-element Convert_* (no unsafe slice reinterpretation for that slice).

Which issue(s) is/are addressed by this PR? (optional)

Fixes #

Are there any special notes for your reviewer?

  • IPFamilyPolicy exists only on the v1alpha6 interface type; spokes do not have the field—values are preserved via annotation + restore on VirtualMachine.ConvertTo, not via typed spoke fields.
  • Explicit regression: api/test/v1alpha5/virtualmachine_conversion_test.go includes spec.network.interfaces.ipFamilyPolicy hub↔spoke↔hub; fuzz conversion tests still run per spoke.

Please add a release note if necessary:

VirtualMachineService supports dual-stack Service fields. NetOP network results honor per-family assignment modes including `ipv6AssignmentMode`. Older API versions preserve hub dual-stack and per-interface IP family policy through conversion annotations.

@hpannem hpannem requested review from akutz and bryanv April 8, 2026 23:32
@hpannem hpannem self-assigned this Apr 8, 2026
@hpannem hpannem requested a review from aruneshpa as a code owner April 8, 2026 23:32
@github-actions github-actions Bot added the size/XXL Denotes a PR that changes 1000+ lines. label Apr 8, 2026
Comment thread api/v1alpha6/virtualmachine_network_types.go
@hpannem hpannem force-pushed the topic/hpannem/dualstack-final branch from e7e75c6 to b381130 Compare April 9, 2026 16:25
@akutz
Copy link
Copy Markdown
Collaborator

akutz commented Apr 9, 2026

I would like this to also handle changes to the ports. We can discuss offline, and I'll update here after we do.

Comment thread controllers/virtualmachineservice/virtualmachineservice_controller.go Outdated
@hpannem hpannem force-pushed the topic/hpannem/dualstack-final branch from b381130 to 6f00f42 Compare April 13, 2026 20:21
@hpannem hpannem requested review from a team and faisalabujabal as code owners April 13, 2026 20:21
@hpannem
Copy link
Copy Markdown
Contributor Author

hpannem commented Apr 15, 2026

I would like this to also handle changes to the ports. We can discuss offline, and I'll update here after we do.

Got your point. I will track this as separate ticket.

@hpannem hpannem requested a review from bryanv April 15, 2026 19:30
silvery1622 added a commit to silvery1622/cluster-api-provider-vsphere that referenced this pull request Apr 20, 2026
Pin github.com/vmware-tanzu/vm-operator/api and external/ncp to
v0.0.0-20260415041850-86db0a258f37 in both go.mod and test/go.mod.
This corresponds to the tip of hpannem's topic/hpannem/dualstack-final
branch (vmware-tanzu/vm-operator PR kubernetes-sigs#1552).

The PR adds:
- VirtualMachineService dual-stack Service fields (ipFamilies,
  ipFamilyPolicy) and endpoint controller behavior.
- NetOP IPv6 assignment mode derivation from status.ipv6AssignmentMode.
- Conversion annotations so hub-only dual-stack fields round-trip in
  older API versions.

replace directives are added to redirect the vmware-tanzu sub-modules to
hpannem's fork until the PR is merged and released upstream.

TODO: remove the replace directives once PR kubernetes-sigs#1552 merges.

Ref: vmware-tanzu/vm-operator#1552
Comment thread pkg/providers/vsphere/vmlifecycle/update_status.go Outdated
Comment thread api/v1alpha6/virtualmachineservice_types.go Outdated
Comment thread controllers/virtualmachineservice/virtualmachineservice_controller_intg_test.go Outdated
Comment thread controllers/virtualmachineservice/virtualmachineservice_controller_intg_test.go Outdated
}

// For SingleStack policy without explicit IPFamilies, use ClusterIP family as primary
if service.Spec.IPFamilyPolicy != nil && *service.Spec.IPFamilyPolicy == corev1.IPFamilyPolicySingleStack {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't the Service Spec.IPFamilies written back to as to what was selected?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. I introduced this as a fallback in case if service.IPfamilies are not filled for some reason in the Service. We could default it to spec.Service.IPFamilies always. what do you suggest? Except legacy clusters, I believe the field would be filled by K8s.

Comment thread controllers/virtualmachineservice/virtualmachineservice_controller.go Outdated
Comment thread controllers/virtualmachineservice/virtualmachineservice_controller.go Outdated
Comment thread controllers/virtualmachineservice/virtualmachineservice_controller_intg_test.go Outdated
@github-actions
Copy link
Copy Markdown

Code Coverage

Package Line Rate Health
github.com/vmware-tanzu/vm-operator/controllers/contentlibrary/clustercontentlibraryitem 67%
github.com/vmware-tanzu/vm-operator/controllers/contentlibrary/contentlibraryitem 67%
github.com/vmware-tanzu/vm-operator/controllers/contentlibrary/utils 85%
github.com/vmware-tanzu/vm-operator/controllers/infra/capability/configmap 92%
github.com/vmware-tanzu/vm-operator/controllers/infra/capability/crd 100%
github.com/vmware-tanzu/vm-operator/controllers/infra/configmap 75%
github.com/vmware-tanzu/vm-operator/controllers/infra/node 77%
github.com/vmware-tanzu/vm-operator/controllers/infra/secret 76%
github.com/vmware-tanzu/vm-operator/controllers/infra/validatingwebhookconfiguration 87%
github.com/vmware-tanzu/vm-operator/controllers/infra/zone 73%
github.com/vmware-tanzu/vm-operator/controllers/storage/storageclass 93%
github.com/vmware-tanzu/vm-operator/controllers/storage/storagepolicy 96%
github.com/vmware-tanzu/vm-operator/controllers/storage/storagepolicyquota 91%
github.com/vmware-tanzu/vm-operator/controllers/storage/volumeattributesclass 93%
github.com/vmware-tanzu/vm-operator/controllers/util/encoding 73%
github.com/vmware-tanzu/vm-operator/controllers/virtualmachine/storagepolicyusage 96%
github.com/vmware-tanzu/vm-operator/controllers/virtualmachine/virtualmachine 66%
github.com/vmware-tanzu/vm-operator/controllers/virtualmachine/volume 85%
github.com/vmware-tanzu/vm-operator/controllers/virtualmachine/volumebatch 89%
github.com/vmware-tanzu/vm-operator/controllers/virtualmachineclass 73%
github.com/vmware-tanzu/vm-operator/controllers/virtualmachinegroup 89%
github.com/vmware-tanzu/vm-operator/controllers/virtualmachinegrouppublishrequest 88%
github.com/vmware-tanzu/vm-operator/controllers/virtualmachineimagecache 89%
github.com/vmware-tanzu/vm-operator/controllers/virtualmachinepublishrequest 84%
github.com/vmware-tanzu/vm-operator/controllers/virtualmachinereplicaset 67%
github.com/vmware-tanzu/vm-operator/controllers/virtualmachineservice 86%
github.com/vmware-tanzu/vm-operator/controllers/virtualmachineservice/providers 92%
github.com/vmware-tanzu/vm-operator/controllers/virtualmachinesetresourcepolicy 81%
github.com/vmware-tanzu/vm-operator/controllers/virtualmachinesnapshot 92%
github.com/vmware-tanzu/vm-operator/controllers/virtualmachinewebconsolerequest 72%
github.com/vmware-tanzu/vm-operator/controllers/virtualmachinewebconsolerequest/v1alpha1 72%
github.com/vmware-tanzu/vm-operator/controllers/virtualmachinewebconsolerequest/v1alpha1/conditions 88%
github.com/vmware-tanzu/vm-operator/controllers/virtualmachinewebconsolerequest/v1alpha1/patch 78%
github.com/vmware-tanzu/vm-operator/controllers/vspherepolicy/policyevaluation 85%
github.com/vmware-tanzu/vm-operator/pkg/bitmask 100%
github.com/vmware-tanzu/vm-operator/pkg/builder 89%
github.com/vmware-tanzu/vm-operator/pkg/conditions 90%
github.com/vmware-tanzu/vm-operator/pkg/config 100%
github.com/vmware-tanzu/vm-operator/pkg/config/capabilities 97%
github.com/vmware-tanzu/vm-operator/pkg/config/env 100%
github.com/vmware-tanzu/vm-operator/pkg/context 37%
github.com/vmware-tanzu/vm-operator/pkg/context/generic 100%
github.com/vmware-tanzu/vm-operator/pkg/context/operation 100%
github.com/vmware-tanzu/vm-operator/pkg/crd 76%
github.com/vmware-tanzu/vm-operator/pkg/errors 76%
github.com/vmware-tanzu/vm-operator/pkg/exit 100%
github.com/vmware-tanzu/vm-operator/pkg/log 100%
github.com/vmware-tanzu/vm-operator/pkg/mem 100%
github.com/vmware-tanzu/vm-operator/pkg/patch 78%
github.com/vmware-tanzu/vm-operator/pkg/prober 89%
github.com/vmware-tanzu/vm-operator/pkg/prober/probe 90%
github.com/vmware-tanzu/vm-operator/pkg/prober/worker 77%
github.com/vmware-tanzu/vm-operator/pkg/providers/vsphere 75%
github.com/vmware-tanzu/vm-operator/pkg/providers/vsphere/clustermodules 73%
github.com/vmware-tanzu/vm-operator/pkg/providers/vsphere/config 88%
github.com/vmware-tanzu/vm-operator/pkg/providers/vsphere/contentlibrary 75%
github.com/vmware-tanzu/vm-operator/pkg/providers/vsphere/credentials 100%
github.com/vmware-tanzu/vm-operator/pkg/providers/vsphere/network 82%
github.com/vmware-tanzu/vm-operator/pkg/providers/vsphere/placement 70%
github.com/vmware-tanzu/vm-operator/pkg/providers/vsphere/session 52%
github.com/vmware-tanzu/vm-operator/pkg/providers/vsphere/storage 44%
github.com/vmware-tanzu/vm-operator/pkg/providers/vsphere/upgrade/virtualmachine 95%
github.com/vmware-tanzu/vm-operator/pkg/providers/vsphere/vcenter 85%
github.com/vmware-tanzu/vm-operator/pkg/providers/vsphere/virtualmachine 85%
github.com/vmware-tanzu/vm-operator/pkg/providers/vsphere/vmlifecycle 74%
github.com/vmware-tanzu/vm-operator/pkg/record 87%
github.com/vmware-tanzu/vm-operator/pkg/topology 91%
github.com/vmware-tanzu/vm-operator/pkg/util 78%
github.com/vmware-tanzu/vm-operator/pkg/util/cloudinit 89%
github.com/vmware-tanzu/vm-operator/pkg/util/cloudinit/validate 91%
github.com/vmware-tanzu/vm-operator/pkg/util/image 100%
github.com/vmware-tanzu/vm-operator/pkg/util/kube 92%
github.com/vmware-tanzu/vm-operator/pkg/util/kube/cource 100%
github.com/vmware-tanzu/vm-operator/pkg/util/kube/internal 100%
github.com/vmware-tanzu/vm-operator/pkg/util/kube/proxyaddr 73%
github.com/vmware-tanzu/vm-operator/pkg/util/kube/spq 99%
github.com/vmware-tanzu/vm-operator/pkg/util/linuxprep 97%
github.com/vmware-tanzu/vm-operator/pkg/util/netplan 100%
github.com/vmware-tanzu/vm-operator/pkg/util/nil 100%
github.com/vmware-tanzu/vm-operator/pkg/util/ovfcache 75%
github.com/vmware-tanzu/vm-operator/pkg/util/ovfcache/internal 100%
github.com/vmware-tanzu/vm-operator/pkg/util/paused 100%
github.com/vmware-tanzu/vm-operator/pkg/util/ptr 100%
github.com/vmware-tanzu/vm-operator/pkg/util/resize 98%
github.com/vmware-tanzu/vm-operator/pkg/util/sysprep 98%
github.com/vmware-tanzu/vm-operator/pkg/util/vmopv1 90%
github.com/vmware-tanzu/vm-operator/pkg/util/volumes 100%
github.com/vmware-tanzu/vm-operator/pkg/util/vsphere/client 66%
github.com/vmware-tanzu/vm-operator/pkg/util/vsphere/datastore 100%
github.com/vmware-tanzu/vm-operator/pkg/util/vsphere/fault 100%
github.com/vmware-tanzu/vm-operator/pkg/util/vsphere/library 95%
github.com/vmware-tanzu/vm-operator/pkg/util/vsphere/storage 82%
github.com/vmware-tanzu/vm-operator/pkg/util/vsphere/task 100%
github.com/vmware-tanzu/vm-operator/pkg/util/vsphere/vm 78%
github.com/vmware-tanzu/vm-operator/pkg/util/vsphere/watcher 85%
github.com/vmware-tanzu/vm-operator/pkg/vmconfig 95%
github.com/vmware-tanzu/vm-operator/pkg/vmconfig/anno2extraconfig 100%
github.com/vmware-tanzu/vm-operator/pkg/vmconfig/bootoptions 88%
github.com/vmware-tanzu/vm-operator/pkg/vmconfig/cdrom 88%
github.com/vmware-tanzu/vm-operator/pkg/vmconfig/crypto 92%
github.com/vmware-tanzu/vm-operator/pkg/vmconfig/diskpromo 100%
github.com/vmware-tanzu/vm-operator/pkg/vmconfig/policy 97%
github.com/vmware-tanzu/vm-operator/pkg/vmconfig/virtualcontroller 93%
github.com/vmware-tanzu/vm-operator/pkg/vmconfig/volumes/unmanaged/backfill 98%
github.com/vmware-tanzu/vm-operator/pkg/vmconfig/volumes/unmanaged/register 95%
github.com/vmware-tanzu/vm-operator/pkg/webconsolevalidation 100%
github.com/vmware-tanzu/vm-operator/services/vm-watcher 85%
github.com/vmware-tanzu/vm-operator/webhooks/common 98%
github.com/vmware-tanzu/vm-operator/webhooks/persistentvolumeclaim/validation 95%
github.com/vmware-tanzu/vm-operator/webhooks/unifiedstoragequota/validation 89%
github.com/vmware-tanzu/vm-operator/webhooks/virtualmachine/mutation 86%
github.com/vmware-tanzu/vm-operator/webhooks/virtualmachine/validation 95%
github.com/vmware-tanzu/vm-operator/webhooks/virtualmachineclass/mutation 62%
github.com/vmware-tanzu/vm-operator/webhooks/virtualmachineclass/validation 89%
github.com/vmware-tanzu/vm-operator/webhooks/virtualmachinegroup/mutation 87%
github.com/vmware-tanzu/vm-operator/webhooks/virtualmachinegroup/validation 92%
github.com/vmware-tanzu/vm-operator/webhooks/virtualmachinegrouppublishrequest/mutation 86%
github.com/vmware-tanzu/vm-operator/webhooks/virtualmachinegrouppublishrequest/validation 88%
github.com/vmware-tanzu/vm-operator/webhooks/virtualmachinepublishrequest/validation 90%
github.com/vmware-tanzu/vm-operator/webhooks/virtualmachinereplicaset/validation 90%
github.com/vmware-tanzu/vm-operator/webhooks/virtualmachineservice/mutation 67%
github.com/vmware-tanzu/vm-operator/webhooks/virtualmachineservice/validation 92%
github.com/vmware-tanzu/vm-operator/webhooks/virtualmachinesetresourcepolicy/validation 89%
github.com/vmware-tanzu/vm-operator/webhooks/virtualmachinesnapshot/mutation 83%
github.com/vmware-tanzu/vm-operator/webhooks/virtualmachinesnapshot/validation 91%
github.com/vmware-tanzu/vm-operator/webhooks/virtualmachinewebconsolerequest/v1alpha1/validation 92%
github.com/vmware-tanzu/vm-operator/webhooks/virtualmachinewebconsolerequest/validation 92%
Summary 84% (19071 / 22795)

Minimum allowed line rate is 79%

@hpannem hpannem requested a review from bryanv April 21, 2026 20:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/XXL Denotes a PR that changes 1000+ lines.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants