Skip to content

Implement Mixed Mode State Detection#1396

Open
heypnus wants to merge 1 commit intovmware-tanzu:mainfrom
heypnus:m1
Open

Implement Mixed Mode State Detection#1396
heypnus wants to merge 1 commit intovmware-tanzu:mainfrom
heypnus:m1

Conversation

@heypnus
Copy link
Contributor

@heypnus heypnus commented Mar 19, 2026

Replace the global boolean cf.CoeConfig.EnableVPCNetwork with namespace-label-driven mixed-mode state: HasT1Namespaces and HasVPCNamespaces.

New module: pkg/config/mixed_mode.go

  • Checks SupervisorCapabilities CRD (iaas.vmware.com/v1alpha1) for supports_per_namespace_network_providers capability.
  • If supported: scans namespace labels (iaas.vmware.com/network-provider) to derive HasT1Namespaces (nsx-t1) and HasVPCNamespaces (nsx-vpc or vsphere-network).
  • If not supported (legacy/pre-9.2): falls back to EnableVPCNetwork config flag.
  • Provides InitializeMixedModeState(), RefreshMixedModeState(), HasT1Namespaces(), HasVPCNamespaces(), GetNamespaceNetworkProvider() APIs.

This enables NSX Operator to run in mixed mode where both T1 and VPC namespaces coexist, as required for VDS->VPC and T1->VPC migration.

Testing done: WIP

Replace the global boolean cf.CoeConfig.EnableVPCNetwork with
namespace-label-driven mixed-mode state: HasT1Namespaces and
HasVPCNamespaces.

New module: pkg/config/mixed_mode.go
- Checks SupervisorCapabilities CRD (iaas.vmware.com/v1alpha1) for
  supports_per_namespace_network_providers capability.
- If supported: scans namespace labels
  (iaas.vmware.com/network-provider) to derive HasT1Namespaces
  (nsx-t1) and HasVPCNamespaces (nsx-vpc or vsphere-network).
- If not supported (legacy/pre-9.2): falls back to EnableVPCNetwork
  config flag.
- Provides InitializeMixedModeState(), RefreshMixedModeState(),
  HasT1Namespaces(), HasVPCNamespaces(),
  GetNamespaceNetworkProvider() APIs.

This enables NSX Operator to run in mixed mode where both T1 and VPC
namespaces coexist, as required for VDS->VPC and T1->VPC migration.

Testing done: WIP
@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 16.91176% with 113 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.39%. Comparing base (c3a71ec) to head (f9ed8a5).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
pkg/config/mixed_mode.go 11.71% 98 Missing ⚠️
cmd/main.go 0.00% 14 Missing ⚠️
pkg/nsx/client.go 0.00% 0 Missing and 1 partial ⚠️

❌ Your patch status has failed because the patch coverage (16.91%) is below the target coverage (70.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1396      +/-   ##
==========================================
- Coverage   76.75%   76.39%   -0.37%     
==========================================
  Files         151      152       +1     
  Lines       21308    21436     +128     
==========================================
+ Hits        16356    16376      +20     
- Misses       3783     3892     +109     
+ Partials     1169     1168       -1     
Flag Coverage Δ
unit-tests 76.39% <16.91%> (-0.37%) ⬇️
Files with missing lines Coverage Δ
pkg/nsx/services/securitypolicy/parse.go 95.91% <100.00%> (ø)
pkg/nsx/util/license.go 100.00% <100.00%> (ø)
pkg/nsx/client.go 94.39% <0.00%> (-0.52%) ⬇️
cmd/main.go 0.00% <0.00%> (ø)
pkg/config/mixed_mode.go 11.71% <11.71%> (ø)

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants