• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

qiniu / kube-ovn / 26678429311

30 May 2026 07:40AM UTC coverage: 25.647% (+0.9%) from 24.77%
26678429311

push

github

web-flow
fix(controller): skip in-pod cleanup when VPC NAT gateway CRD is deleted (#6784)

* fix(controller): skip EIP pod cleanup when VPC NAT gateway CRD is gone

When deleting an IptablesEIP, the controller calls deleteEipInPod and
delEipQoSInPod to clean up iptables/tc rules in the NAT gateway pod.
Previously, both functions checked only whether the pod existed: if the
pod was missing for any reason the call returned an error and the
reconciler retried indefinitely, causing the EIP to get stuck.

The correct sentinel is the VpcNatGateway CRD, not its pod:
- If the CRD is gone the gateway (and its pod) have been deleted; there
  is nothing to clean up, so return nil and let the EIP deletion proceed.
- If the CRD still exists but the pod is temporarily absent (e.g. being
  recreated), return the error so the reconciler retries until the pod
  is ready.

Signed-off-by: jimyag <git@jimyag.com>

* fix(controller): apply CRD-based sentinel to FIP/DNAT/SNAT pod cleanup

deleteFipInPod, deleteDnatInPod and deleteSnatInPod had the same pattern
inconsistency as the recently fixed EIP functions: they checked the pod
directly as the termination sentinel rather than the VpcNatGateway CRD.

Old behaviour: pod not found (regardless of CRD state) → return nil
               (skip cleanup silently even if gateway is being recreated)
New behaviour: CRD not found → return nil (gateway truly gone, nothing
               to clean up); CRD exists + pod not found → return error
               so the reconciler retries until the pod is ready.

This uses the natGwDeleted helper introduced for the EIP fix and applies
the same lower-verbosity klog.V(4) for transient pod-not-found events to
avoid noisy logs during rolling updates.

Signed-off-by: jimyag <git@jimyag.com>

* test(controller): add unit tests for natGwDeleted sentinel logic

Add unit tests covering the new CRD-first sentinel pattern introduced in
deleteEipInPod, delEipQoSInPod, deleteFipInPod, deleteDnatInPod, and
delete... (continued)

63 of 82 new or added lines in 2 files covered. (76.83%)

2935 existing lines in 34 files now uncovered.

14772 of 57597 relevant lines covered (25.65%)

0.3 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

1.12
/pkg/controller/controller.go


Source Not Available

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc