cosmonic-labs / netreap

A Cilium controller implementation for Nomad
https://netreap.io
Apache License 2.0
130 stars 8 forks source link

Reduce load on Cilium API by filtering more events #29

Closed deverton-godaddy closed 1 year ago

deverton-godaddy commented 1 year ago

This feature reduces the API call rate to Cilium and tries to ensure netreap only makes calls when needed. This helps in high density scenarios to reduce the CIlium agent API overhead. This feature consists of three main changes:

  1. The allocation events from Nomad include the NodeID where the allocation is assigned. We can use that to drop events early in processing by comparing the event NodeID with the local agent NodeID. This reduces the load on Cilium agents in the cluster as they are no longer queried about allocations that don't exist on the node.
  2. netreap only needs to watch the Allocation event stream and can ignore events for terminal allocations. Nomad will handle cleaning up the endpoint in that case.
  3. Only call the Cilium endpoint patch API if the labels to apply to the endpoint have actually changed. Cilium will do a full endpoint regeneration even if the labels are the same so only doing that on label change this greatly cuts down on load.
netlify[bot] commented 1 year ago

Deploy Preview for netreap canceled.

Name Link
Latest commit 1a194ee32c66b26ddc6a61eaa4f7e0ae83ed82a2
Latest deploy log https://app.netlify.com/sites/netreap/deploys/64e3d9aa24b1fe000839f259