Skip to content

[ipam] Skip redundant CiliumNode status writes in refreshNode - #671

Closed
jaredledvina wants to merge 1 commit into
v1.19-ddfrom
jared.ledvina/fixup-ciliumnode-refreshnode-noop-write
Closed

[ipam] Skip redundant CiliumNode status writes in refreshNode#671
jaredledvina wants to merge 1 commit into
v1.19-ddfrom
jared.ledvina/fixup-ciliumnode-refreshnode-noop-write

Conversation

@jaredledvina

@jaredledvina jaredledvina commented Jul 18, 2026

Copy link
Copy Markdown
Member

refreshNode() in pkg/ipam/crd.go issued a full-object UpdateStatus() on the CiliumNode custom resource on every allocate/release/retry trigger, even when the node's IPAM status was unchanged. Since the agent and the operator both write the same CiliumNode object (and its spec/status share a single resourceVersion), these unconditional no-op writes add avoidable apiserver write load and resourceVersion churn, which also increases the chance of update conflicts.

This adds a no-op guard to refreshNode():

  • Skip the UpdateStatus() call when the freshly rebuilt Status.IPAM.Used map is unchanged from the last value successfully written to the apiserver. Used is compared by content, since the agent is its sole writer.
  • Track Status.IPAM.ReleaseIPs with an explicit dirty flag set by updateLocalNodeResource() rather than a content comparison. ReleaseIPs is shared with the operator (the release ACK/NACK handshake), so value-equality against the agent's own last write is not a reliable no-op signal: the operator can re-mark an IP with a value the agent previously wrote.
  • Reset the cached baseline on node deletion and on a same-name/different-UID informer relist.

The write is still performed whenever Used actually changes or a release ACK/NACK is pending, so status propagation is unaffected.

Adds unit tests in pkg/ipam/crd_test.go covering the skip/no-skip cases, the ReleaseIPs dirty-flag path, and the UID-reset edge case.

Signed-off-by: Jared Ledvina <jared.ledvina@datadoghq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant