antrea-io / antrea

Kubernetes networking based on Open vSwitch
https://antrea.io
Apache License 2.0
1.67k stars 370 forks source link

Improve error handling and resource cleanup for PacketCapture #6797

Closed tnqn closed 2 weeks ago

tnqn commented 2 weeks ago

The patch fixes the following issues:

  1. The local pcap file was not closed on error. The patch ensures the file is closed regardless of success or failure.
  2. The pcap file was not updated to status.filePath and was not uploaded to file server if not all packets have been captured. The patch ensures it's updated to status and uploaded as long as any packet is captured.
  3. The Complete condition was not set correctly in one case. The patch uses two errors to track capturing error and uploading error separately.
  4. The unit tests could report false negative as they only check that unexpected conditions don't exist, while they should check expected conditions exist.
  5. Change the local pcap path's permission to 700.
  6. Avoid panic when handling delete events containing DeletedFinalStateUnknown objects.
  7. Reduce the min and max retry intervals to reduce the possibility of timeout.
  8. Make a deepcopy before updating object got from lister, otherwise data race may happen and index may be messed up.
  9. Add a readiness probe to the sftp server used in e2e test to avoid test flake.

It also makes some style improvements and simplifies a few code.

Follows up #6756

hangyan commented 2 weeks ago

LGTM

tnqn commented 2 weeks ago

/test-all

tnqn commented 2 weeks ago

/skip-all