Skip to content

refactor service caching#855

Merged
sknat merged 1 commit intomasterfrom
refactor-service-caching
Jan 14, 2026
Merged

refactor service caching#855
sknat merged 1 commit intomasterfrom
refactor-service-caching

Conversation

@hedibouattour
Copy link
Copy Markdown
Collaborator

Previously, entries were cached by entry key only. This caused issues when multiple services referenced the same entry.

This update changes the caching logic to:

  • Cache each entry by service ID while allowing multiple services to target the same entry.

  • When multiple services reference the same entry, override the previous value and keep the latest.

  • On service entry deletion, check whether other services still reference the same entry; if so, recreate the entry.

This ensures consistent behavior when entries are shared across services.

@hedibouattour hedibouattour marked this pull request as draft December 9, 2025 16:58
@hedibouattour hedibouattour force-pushed the refactor-service-caching branch from 33935b7 to f8d2794 Compare December 9, 2025 17:10
@hedibouattour hedibouattour self-assigned this Dec 9, 2025
@hedibouattour hedibouattour force-pushed the refactor-service-caching branch from f8d2794 to ea85208 Compare December 10, 2025 16:54
@hedibouattour hedibouattour marked this pull request as ready for review December 10, 2025 16:55
@hedibouattour hedibouattour requested a review from sknat December 10, 2025 17:22
@hedibouattour hedibouattour force-pushed the refactor-service-caching branch from ea85208 to 35634e5 Compare December 15, 2025 15:20
Copy link
Copy Markdown
Collaborator

@sknat sknat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many thanks for taking a stab at this. This looks good, but I think we might still be vulnerable to overrides in VPP that will cause double free. Details inline

Comment thread calico-vpp-agent/services/service_handler.go Outdated
Comment thread calico-vpp-agent/services/service_handler.go Outdated
Comment thread calico-vpp-agent/services/service_server.go Outdated
@hedibouattour hedibouattour force-pushed the refactor-service-caching branch 2 times, most recently from e9a660c to e9c1969 Compare January 12, 2026 13:31
Copy link
Copy Markdown
Collaborator

@sknat sknat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many thanks for the udpate! A few more comments inline, tell me if you want to discuss

Comment thread calico-vpp-agent/services/service_handler.go Outdated
Comment thread calico-vpp-agent/services/service_handler.go Outdated
Comment thread calico-vpp-agent/services/service_handler.go
Comment thread calico-vpp-agent/services/service_handler.go Outdated
Comment thread calico-vpp-agent/services/service_handler.go Outdated
Comment thread calico-vpp-agent/services/service_handler.go Outdated
Comment thread calico-vpp-agent/services/service_handler.go Outdated
Comment thread calico-vpp-agent/services/service_server.go Outdated
Comment thread calico-vpp-agent/services/service_server.go Outdated
Comment thread calico-vpp-agent/services/service_handler.go Outdated
Previously, entries were cached by entry key only. This caused issues when multiple services referenced the same entry.

This update changes the caching logic to:

* Cache each entry by service ID while allowing multiple services to target the same entry.

* When multiple services reference the same entry, override the previous value and keep the latest.

* On service entry deletion, check whether other services still reference the same entry; if so, recreate the entry.

This ensures consistent behavior when entries are shared across services.
@hedibouattour hedibouattour force-pushed the refactor-service-caching branch from e9c1969 to db5466d Compare January 13, 2026 15:37
Copy link
Copy Markdown
Collaborator

@sknat sknat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, thanks for the changes

@sknat sknat merged commit 8ad7c16 into master Jan 14, 2026
5 checks passed
@sknat sknat deleted the refactor-service-caching branch January 14, 2026 16:41
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.

2 participants