Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid deleting all endpoints when a watch fails #6979

Merged
merged 1 commit into from
Jan 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -101,20 +101,19 @@ def _post_snapshot_hook(self, old_endpoints_by_host):
# Look for previous endpoints that are no longer present...
for hostname, ep_ids in old_endpoints_by_host.items():
LOG.info("host: %s", hostname)
# Avoid self._endpoints_by_host[hostname] since that would
# auto-create the entry in the new dict, which would cause a
# leak.
new_ep_ids = self._endpoints_by_host.get(hostname, set())
# Check for particular endpoints that have disappeared, and
# signal those.
for ep_id in ep_ids:
# Avoid self._endpoints_by_host[hostname] since that would
# auto-create the entry in the new dict, which would cause a
# leak.
new_ep_ids = self._endpoints_by_host.get(hostname, set())
if ep_ids not in new_ep_ids:
LOG.info("signal None for %s", ep_id.endpoint)
self.calico_driver.on_port_status_changed(
hostname,
ep_id.endpoint,
None,
priority="low")
for ep_id in ep_ids.difference(new_ep_ids):
LOG.info("signal None for %s", ep_id.endpoint)
self.calico_driver.on_port_status_changed(
hostname,
ep_id.endpoint,
None,
priority="low")
self.processing_snapshot = False

def _on_status_set(self, response, hostname):
Expand Down