Skip to content

ipam: Return error from instance (re)sync instead of sentinel time.Time#45153

Open
HadrienPatte wants to merge 1 commit intomainfrom
pr/HadrienPatte/ipam-resync-return-error
Open

ipam: Return error from instance (re)sync instead of sentinel time.Time#45153
HadrienPatte wants to merge 1 commit intomainfrom
pr/HadrienPatte/ipam-resync-return-error

Conversation

@HadrienPatte
Copy link
Copy Markdown
Member

The AllocationImplementation interface used time.Time{} as a sentinel value to signal failure from Resync and InstanceSync, forcing every caller to decode the convention via .IsZero() and discarding error context at the interface boundary.

This PR changes both methods signature to return (time.Time, error), and propagate errors to callers, this avoids the previous situations where in case of sync failure, we'd get one warning log from the sync method with the actual low level error and then a fatal log from the higher level calling code but without the context of the lower error.

Now that the error is properly forwarded up the call chain, we get a single log with all the appropriate context.

See what the double logs look like currently without this patch:
image

@maintainer-s-little-helper maintainer-s-little-helper bot added the dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. label Apr 3, 2026
@HadrienPatte HadrienPatte added integration/cloud Related to integration with cloud environments such as AKS, EKS, GKE, etc. area/ipam IP address management, including cloud IPAM release-note/misc This PR makes changes that have no direct user impact. labels Apr 3, 2026
@maintainer-s-little-helper maintainer-s-little-helper bot removed the dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. label Apr 3, 2026
The `AllocationImplementation` interface used `time.Time{}` as a sentinel
value to signal failure from `Resync` and `InstanceSync`, forcing every
caller to decode the convention via `.IsZero()` and discarding error
context at the interface boundary.

This PR changes both methods signature to return `(time.Time, error)`,
and propagate errors to callers, this avoids the previous situations
where in case of sync failure, we'd get one warning log from the sync
method with the actual low level error and then a fatal log from the
higher level calling code but without the context of the lower error.

Now that the error is properly forwarded up the call chain, we get a
single log with all the appropriate context.

Signed-off-by: Hadrien Patte <hadrien.patte@datadoghq.com>
@HadrienPatte HadrienPatte force-pushed the pr/HadrienPatte/ipam-resync-return-error branch from 1743f85 to 0f35b36 Compare April 3, 2026 12:37
@HadrienPatte
Copy link
Copy Markdown
Member Author

/test

@HadrienPatte HadrienPatte marked this pull request as ready for review April 3, 2026 14:47
@HadrienPatte HadrienPatte requested review from a team as code owners April 3, 2026 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/ipam IP address management, including cloud IPAM integration/cloud Related to integration with cloud environments such as AKS, EKS, GKE, etc. release-note/misc This PR makes changes that have no direct user impact.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant