Skip to content

Conversation

yanjunz97
Copy link
Contributor

@yanjunz97 yanjunz97 commented Oct 13, 2025

When NSX Operator restarts after vpc is created and before vpc realization check,
the NSX vpc will be loaded to cache during NSX Operator initialization even if the
realization fails.

Thus we need to check the realized state again if we detect the Namespace
CR does not have a NamespaceNetworkReady condition even if the existing vpc
in store is not changed.

This issue also exists for Subnet and StaticRoute, updated to check CR condition when
the corresponding nsx resource is not changed in createOrUpdate function.

Testing done:

  • Update Namespace status from True to False, observe the vpc realized state API is called in log
  • Update Subnet status from True to False, observe the Subnet realized state API is called in log
  • Update StaticRoute status from True to False, observe the StaticRoute realized state API is called in log

Bug: 3593653

@yanjunz97 yanjunz97 force-pushed the realization-check-for-restart branch from dd8c5c8 to ea25838 Compare October 13, 2025 07:05
@codecov-commenter
Copy link

codecov-commenter commented Oct 13, 2025

Codecov Report

❌ Patch coverage is 69.13580% with 25 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.51%. Comparing base (e359cee) to head (1fdece1).

Files with missing lines Patch % Lines
pkg/nsx/services/subnet/subnet.go 56.66% 10 Missing and 3 partials ⚠️
pkg/nsx/services/vpc/vpc.go 64.00% 6 Missing and 3 partials ⚠️
pkg/nsx/services/staticroute/staticroute.go 88.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1262      +/-   ##
==========================================
+ Coverage   74.50%   74.51%   +0.01%     
==========================================
  Files         147      147              
  Lines       23546    23602      +56     
==========================================
+ Hits        17543    17588      +45     
- Misses       4917     4924       +7     
- Partials     1086     1090       +4     
Flag Coverage Δ
unit-tests 74.51% <69.13%> (+0.01%) ⬆️
Files with missing lines Coverage Δ
pkg/nsx/services/vpc/builder.go 89.13% <100.00%> (ø)
pkg/nsx/services/staticroute/staticroute.go 86.61% <88.00%> (-0.59%) ⬇️
pkg/nsx/services/vpc/vpc.go 67.46% <64.00%> (-0.29%) ⬇️
pkg/nsx/services/subnet/subnet.go 74.83% <56.66%> (+0.44%) ⬆️

... 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 TaoZou1 and heypnus October 13, 2025 07:30
@yanjunz97 yanjunz97 force-pushed the realization-check-for-restart branch from ea25838 to 53cd602 Compare October 13, 2025 12:17
@yanjunz97 yanjunz97 force-pushed the realization-check-for-restart branch from 53cd602 to 1fdece1 Compare October 14, 2025 06:32
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.

LGTM

@yanjunz97 yanjunz97 merged commit 816fd31 into vmware-tanzu:main Oct 15, 2025
2 checks passed
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.

4 participants