Skip to content

loadbalancer: Add file-based reflector #39117

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

Merged
merged 4 commits into from
May 12, 2025

Conversation

joamaki
Copy link
Contributor

@joamaki joamaki commented Apr 23, 2025

As the cilium-dbg service update is being removed (#39084) we need a different mechanism for serving the use-case.

This implements a file-based synchronization for the load-balancing state by using the Kubernetes Service and EndpointSlice formats, which makes for a simple implementation that is also familiar to users.

@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 23, 2025
@joamaki joamaki requested a review from oblazek April 23, 2025 15:02
@joamaki joamaki added the release-note/misc This PR makes changes that have no direct user impact. label Apr 23, 2025
@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 23, 2025
@joamaki
Copy link
Contributor Author

joamaki commented Apr 24, 2025

/test

@joamaki joamaki force-pushed the pr/joamaki/lb-file-source branch from 9cd10f9 to 2714509 Compare April 24, 2025 15:07
@joamaki joamaki marked this pull request as ready for review April 25, 2025 07:20
@joamaki joamaki requested a review from a team as a code owner April 25, 2025 07:20
@joamaki joamaki requested a review from aspsk April 25, 2025 07:20
@joamaki
Copy link
Contributor Author

joamaki commented Apr 25, 2025

/test

1 similar comment
@joamaki
Copy link
Contributor Author

joamaki commented Apr 28, 2025

/test

@joamaki joamaki force-pushed the pr/joamaki/lb-file-source branch 2 times, most recently from bb351c9 to ab7ecc1 Compare May 9, 2025 13:51
joamaki added 4 commits May 9, 2025 17:05
In preparation for adding another reflector that uses the same conversion
functions, move them to conversions.go and clean up cell.go to refer to
the K8sReflectorCell only.

Add source argument to the conversion functions.

Signed-off-by: Jussi Maki <jussi@isovalent.com>
After the code reorg the benchmarks were not updated to point to the
correct files.

Signed-off-by: Jussi Maki <jussi@isovalent.com>
Signed-off-by: Jussi Maki <jussi@isovalent.com>
When converting a k8s Service or Endpoints to the internal models
debug log when we ignore data due to configuration or failure to
parse it.

The log.With() is pretty expensive, so we use sync.OnceValue to
lazily do it. Without this we'd be 20% slower in convertService().

This does have a measurable impact on cases where we e.g. have EnableIPv6=false
and lots of services or backends have IPv6 addresses. We'd hit log.With()
and log.Debug() and likely be 20-30% slower. In practice though this wouldn't
really be measurable.

Before:
  BenchmarkConvertService-32               1326844               894.0 ns/op         1118506 services/sec
  BenchmarkConvertEndpoints-32             2550249               452.6 ns/op         2209461 endpoints/sec

After:
  BenchmarkConvertService-32               1241847               905.2 ns/op         1104687 services/sec
  BenchmarkConvertEndpoints-32             3043005               438.2 ns/op         2282010 endpoints/sec

Signed-off-by: Jussi Maki <jussi@isovalent.com>
@joamaki joamaki force-pushed the pr/joamaki/lb-file-source branch from ab7ecc1 to efc1c02 Compare May 9, 2025 15:06
Copy link
Contributor

@oblazek oblazek left a comment

Choose a reason for hiding this comment

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

LGTM!

@joamaki
Copy link
Contributor Author

joamaki commented May 12, 2025

/test

@joamaki joamaki enabled auto-merge May 12, 2025 08:20
@maintainer-s-little-helper maintainer-s-little-helper bot added the ready-to-merge This PR has passed all tests and received consensus from code owners to merge. label May 12, 2025
@joamaki joamaki added this pull request to the merge queue May 12, 2025
Merged via the queue into cilium:main with commit c2dd951 May 12, 2025
66 checks passed
@joamaki joamaki deleted the pr/joamaki/lb-file-source branch May 12, 2025 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-to-merge This PR has passed all tests and received consensus from code owners to merge. 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.

3 participants