Skip to content

Implement Mixed Mode State Detection#1396

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

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

Conversation

@heypnus
Copy link
Copy Markdown
Contributor

@heypnus heypnus commented Mar 19, 2026

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

New module: pkg/config/mixed_mode.go

  • Checks SupervisorCapabilities CRD for supports_per_namespace_network_providers
    capability.
  • If supported: scans namespace annotations nsx.vmware.com/vpc_network_config
    to derive HasVPCNamespaces and HasT1Namespaces.
  • If not supported (legacy/pre-9.2): falls back to EnableVPCNetwork
    config flag.

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.

NOTE: This patch only ensures that the existing pure T1 or pure VPC envs
preserve existing behaviours. The full functionality will be
implemented in the follow-up patches.

Testing done:

  1. T1 pipeline with ID 5695
  2. VPC pipeline with ID 17501

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Mar 19, 2026

Codecov Report

❌ Patch coverage is 88.13559% with 21 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.06%. Comparing base (6f7ddad) to head (40a6a6a).
⚠️ Report is 12 commits behind head on main.

Files with missing lines Patch % Lines
pkg/config/mixed_mode.go 91.82% 11 Missing and 2 partials ⚠️
cmd/main.go 0.00% 8 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1396      +/-   ##
==========================================
+ Coverage   76.77%   77.06%   +0.29%     
==========================================
  Files         151      155       +4     
  Lines       21315    22167     +852     
==========================================
+ Hits        16364    17084     +720     
- Misses       3782     3878      +96     
- Partials     1169     1205      +36     
Flag Coverage Δ
unit-tests 77.06% <88.13%> (+0.29%) ⬆️
Files with missing lines Coverage Δ
pkg/nsx/client.go 91.96% <ø> (-2.08%) ⬇️
pkg/nsx/services/securitypolicy/parse.go 94.11% <100.00%> (ø)
pkg/nsx/util/license.go 100.00% <100.00%> (ø)
cmd/main.go 0.00% <0.00%> (ø)
pkg/config/mixed_mode.go 91.82% <91.82%> (ø)

... and 25 files with indirect coverage changes

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

@heypnus heypnus force-pushed the m1 branch 3 times, most recently from 0fea7b3 to c0064c0 Compare March 30, 2026 17:20
Comment thread pkg/config/mixed_mode.go Outdated
Comment thread pkg/config/mixed_mode.go Outdated
Comment thread pkg/config/mixed_mode.go Outdated
Comment thread pkg/config/mixed_mode.go Outdated
Comment thread pkg/config/mixed_mode.go Outdated
Comment thread pkg/config/mixed_mode.go Outdated
Comment thread pkg/config/mixed_mode.go
Comment thread pkg/nsx/util/license.go Outdated
Comment thread pkg/nsx/util/license_test.go
Comment thread pkg/nsx/services/securitypolicy/parse.go
@heypnus heypnus force-pushed the m1 branch 2 times, most recently from 0f8b260 to 5af4a3f Compare April 13, 2026 06:22
@heypnus heypnus force-pushed the m1 branch 4 times, most recently from 6e1cc2d to c0b5bbb Compare April 14, 2026 09:00
@heypnus heypnus requested a review from yanjunz97 April 14, 2026 09:03
Comment thread pkg/config/mixed_mode.go
Comment thread pkg/config/mixed_mode.go
Replace the global boolean cf.CoeConfig.EnableVPCNetwork with
namespace-driven mixed-mode state: HasT1Namespaces and
HasVPCNamespaces.

New module: pkg/config/mixed_mode.go
- Checks SupervisorCapabilities CRD for supports_per_namespace_network_providers
  capability.
- If supported: scans namespace annotations `nsx.vmware.com/vpc_network_config`
  to derive HasVPCNamespaces and HasT1Namespaces.
- If not supported (legacy/pre-9.2): falls back to EnableVPCNetwork
  config flag.

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.

NOTE: This patch only ensures that the existing pure T1 or pure VPC envs
preserve existing behaviours. The full functionality will be
implemented in the follow-up patches.

Testing done:
1. T1 pipeline with ID 5695
2. VPC pipeline with ID 17501
@heypnus
Copy link
Copy Markdown
Contributor Author

heypnus commented May 13, 2026

/e2e

Copy link
Copy Markdown
Contributor

@yanjunz97 yanjunz97 left a comment

Choose a reason for hiding this comment

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

LGTM

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.

3 participants