vmware-tanzu / nsx-operator

Kubernetes Operator for managing NSX network resources
Other
13 stars 20 forks source link

[cherry-pick]Use read lock on subnet for subnetport/pod creation (#923) #925

Closed yanjunz97 closed 1 week ago

yanjunz97 commented 1 week ago

Previously we add lock on subnet to prevent the race between SubnetPort/Pod controller and SubnetSet GC. In this PR we replace the mutex lock by read-write lock to improve the parallelism of the SubnetPort creation.

Testing done: Created 32 SubnetPort at a time, each SubnetPort reconcile finished in 2-3 seconds

codecov-commenter commented 1 week ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 73.83%. Comparing base (a9ba9f8) to head (f932340).

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/vmware-tanzu/nsx-operator/pull/925/graphs/tree.svg?width=650&height=150&src=pr&token=R0Q6IGC2PC&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=vmware-tanzu)](https://app.codecov.io/gh/vmware-tanzu/nsx-operator/pull/925?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=vmware-tanzu) ```diff @@ Coverage Diff @@ ## v4.2.0 #925 +/- ## ========================================== + Coverage 73.80% 73.83% +0.03% ========================================== Files 109 109 Lines 15234 15252 +18 ========================================== + Hits 11244 11262 +18 Misses 3240 3240 Partials 750 750 ``` | [Flag](https://app.codecov.io/gh/vmware-tanzu/nsx-operator/pull/925/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=vmware-tanzu) | Coverage Δ | | |---|---|---| | [unit-tests](https://app.codecov.io/gh/vmware-tanzu/nsx-operator/pull/925/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=vmware-tanzu) | `73.83% <100.00%> (+0.03%)` | :arrow_up: | | [Files with missing lines](https://app.codecov.io/gh/vmware-tanzu/nsx-operator/pull/925?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=vmware-tanzu) | Coverage Δ | | |---|---|---| | [pkg/controllers/pod/pod\_controller.go](https://app.codecov.io/gh/vmware-tanzu/nsx-operator/pull/925?src=pr&el=tree&filepath=pkg%2Fcontrollers%2Fpod%2Fpod_controller.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=vmware-tanzu#diff-cGtnL2NvbnRyb2xsZXJzL3BvZC9wb2RfY29udHJvbGxlci5nbw==) | `61.97% <100.00%> (ø)` | | | [...kg/controllers/subnetport/subnetport\_controller.go](https://app.codecov.io/gh/vmware-tanzu/nsx-operator/pull/925?src=pr&el=tree&filepath=pkg%2Fcontrollers%2Fsubnetport%2Fsubnetport_controller.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=vmware-tanzu#diff-cGtnL2NvbnRyb2xsZXJzL3N1Ym5ldHBvcnQvc3VibmV0cG9ydF9jb250cm9sbGVyLmdv) | `75.89% <100.00%> (ø)` | | | [pkg/nsx/services/subnet/store.go](https://app.codecov.io/gh/vmware-tanzu/nsx-operator/pull/925?src=pr&el=tree&filepath=pkg%2Fnsx%2Fservices%2Fsubnet%2Fstore.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=vmware-tanzu#diff-cGtnL25zeC9zZXJ2aWNlcy9zdWJuZXQvc3RvcmUuZ28=) | `77.00% <100.00%> (+2.00%)` | :arrow_up: | | [pkg/nsx/services/subnet/subnet.go](https://app.codecov.io/gh/vmware-tanzu/nsx-operator/pull/925?src=pr&el=tree&filepath=pkg%2Fnsx%2Fservices%2Fsubnet%2Fsubnet.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=vmware-tanzu#diff-cGtnL25zeC9zZXJ2aWNlcy9zdWJuZXQvc3VibmV0Lmdv) | `66.57% <100.00%> (+0.91%)` | :arrow_up: |

🚨 Try these New Features: