Skip to content

Restore SubnetPort with unchanged VIF#1385

Open
yanjunz97 wants to merge 1 commit intovmware-tanzu:mainfrom
yanjunz97:restore-subnetport-vif
Open

Restore SubnetPort with unchanged VIF#1385
yanjunz97 wants to merge 1 commit intovmware-tanzu:mainfrom
yanjunz97:restore-subnetport-vif

Conversation

@yanjunz97
Copy link
Contributor

@yanjunz97 yanjunz97 commented Mar 5, 2026

This PR

  • Adds annotation nsx.vmware.com/attachment with attachment id to Pod
  • For NSX 9.2, when restoring SubnetPort, use the original vif id and not update Pod/VM/SubnetPort status/annotation

As NSX implementation is not done yet, always set RestoreVIF feature support to false.

Testing done:

After deployed this operator code, observe pod annotation being updated with annotation

      nsx.vmware.com/attachment: 33653262-3361-4230-ad32-3566392d3432
      nsx.vmware.com/mac: 04:50:56:00:70:00

Mocked NSXCheckVersion be true for nsx.RestoreVIF. Created SubnetPort and Pod, shut down ncp and deleted the NSX SubnetPort. Forced restore, observed the NSX SubnetPort is restored with vif id unchanged.

Regression test with nsx 9.1 also passed: Create Subnetport/Pod, shut down ncp and deleted the NSX SubnetPort. Forced restore, observed the vif id changes and Pod/VM network restored.

@yanjunz97 yanjunz97 force-pushed the restore-subnetport-vif branch from c9338a5 to c0846ae Compare March 6, 2026 02:21
@codecov-commenter
Copy link

codecov-commenter commented Mar 6, 2026

Codecov Report

❌ Patch coverage is 71.87500% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.75%. Comparing base (c3a71ec) to head (edc4f9c).

Files with missing lines Patch % Lines
pkg/controllers/pod/pod_controller.go 76.47% 2 Missing and 2 partials ⚠️
pkg/nsx/cluster.go 0.00% 3 Missing ⚠️
pkg/nsx/client.go 0.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1385      +/-   ##
==========================================
- Coverage   76.75%   76.75%   -0.01%     
==========================================
  Files         151      151              
  Lines       21308    21328      +20     
==========================================
+ Hits        16356    16371      +15     
- Misses       3783     3785       +2     
- Partials     1169     1172       +3     
Flag Coverage Δ
unit-tests 76.75% <71.87%> (-0.01%) ⬇️
Files with missing lines Coverage Δ
...kg/controllers/subnetport/subnetport_controller.go 68.76% <100.00%> (ø)
pkg/nsx/services/common/types.go 100.00% <ø> (ø)
pkg/nsx/services/subnetport/subnetport.go 86.76% <100.00%> (+1.41%) ⬆️
pkg/nsx/client.go 94.03% <0.00%> (-0.88%) ⬇️
pkg/nsx/cluster.go 59.02% <0.00%> (-0.52%) ⬇️
pkg/controllers/pod/pod_controller.go 65.59% <76.47%> (+0.27%) ⬆️

... 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.

@yanjunz97 yanjunz97 requested review from dantingl and heypnus March 10, 2026 08:21
Copy link
Contributor

@heypnus heypnus left a comment

Choose a reason for hiding this comment

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

looks good, just one minior comment

@yanjunz97 yanjunz97 force-pushed the restore-subnetport-vif branch from c0846ae to 6f5b6b8 Compare March 11, 2026 06:37
Signed-off-by: Yanjun Zhou <yanjun.zhou@broadcom.com>
@yanjunz97 yanjunz97 force-pushed the restore-subnetport-vif branch from 6f5b6b8 to edc4f9c Compare March 17, 2026 06:10
@yanjunz97 yanjunz97 requested a review from heypnus March 17, 2026 07:40
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