ingress icon indicating copy to clipboard operation
ingress copied to clipboard

Build upstreams from EndpointSlices

Open stephank opened this issue 7 months ago • 4 comments

An attempt at #7.

This generalizes the informer code so adding more informers doesn't involve a bunch of boilerplate. It then adds the Service and EndpointSlice informers necessary to keep the upstreams updated.

This also includes some work on secrets, to try keep them out of memory, because the informer normally builds a cache of everything. Especially without -namespace, we were just kinda keeping around every secret anywhere in the cluster in memory.

stephank avatar Apr 16 '25 13:04 stephank

After some more testing, I noticed the informer cache shifts results every now and then. I suspect periodic reconciliation. This caused the output to shift as well, and frequent reloads. I now sort the informer results before processing.

I also added a simple helper to limit logging of warning messages generated by plugins, so it is safe to log from plugins even though they run quite often.

stephank avatar Apr 25 '25 12:04 stephank

Codecov Report

Attention: Patch coverage is 26.00473% with 313 lines in your changes missing coverage. Please review.

Project coverage is 21.97%. Comparing base (7db5cd4) to head (1bd8fb3).

Files with missing lines Patch % Lines
internal/caddy/global/tls.go 22.05% 51 Missing and 2 partials :warning:
internal/controller/queued_event_handler.go 0.00% 52 Missing :warning:
pkg/store/store.go 59.78% 34 Missing and 3 partials :warning:
internal/caddy/ingress/reverseproxy.go 50.81% 24 Missing and 6 partials :warning:
internal/controller/action_configmap.go 0.00% 26 Missing :warning:
internal/controller/controller.go 0.00% 26 Missing :warning:
internal/controller/action_ingress.go 0.00% 25 Missing :warning:
internal/controller/action_endpointslice.go 0.00% 17 Missing :warning:
internal/controller/action_service.go 0.00% 17 Missing :warning:
internal/controller/diagnostics.go 0.00% 16 Missing :warning:
... and 4 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #310      +/-   ##
==========================================
+ Coverage   20.11%   21.97%   +1.85%     
==========================================
  Files          30       33       +3     
  Lines        1397     1502     +105     
==========================================
+ Hits          281      330      +49     
- Misses       1114     1159      +45     
- Partials        2       13      +11     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov[bot] avatar May 15 '25 09:05 codecov[bot]

I rebased this on main and fixed the conflicts. Did some testing and still good in my setup.

stephank avatar May 15 '25 12:05 stephank

I didn't notice the failing test, but it was simply missing permissions for watching EndpointSlices in the chart. That's fixed now.

stephank avatar Jun 04 '25 14:06 stephank