kubernetes-ingress-controller icon indicating copy to clipboard operation
kubernetes-ingress-controller copied to clipboard

Research integration tests makeover for Gateway Discovery testing

Open pmalek opened this issue 2 years ago • 5 comments

Problem statement

Currently we're running integration tests by running controller manager locally: https://github.com/Kong/kubernetes-ingress-controller/blob/3ce7c14afd2099e991c4dcd3370f23ef8c742a5e/internal/util/test/controller_manager.go#L32-L101

This has worked well for some time with Proxy and Admin API LoadBalancer type services exposed (which in turn can be accessed from outside the cluster).

With Gateway Discovery being introduced, which utilizes EndpointSlice lookup of cluster internal services we have no option of reusing this workflow: locally running controller manager would be able to call k8s apiserver and get Admin API Endpoints addresses but those addresses but be unreachable when KIC would try to push configuration to them.

Proposed solution

Try to use a package or a tool that will allow running process locally but reaching cluster internal addresses.

One such tool is https://github.com/metalbear-co/mirrord which allows just that.

This approach though would require us to run controller manager as a separate process (via mirrord exec ...) and would among other things: make it impossible (or very difficult) to use debuggers to debug integration tests.

Acceptance criteria

  • [ ] Integration tests run with --kong-admin-svc flag (instead of --kong-admin-url) thus using Gateway Discovery

pmalek avatar Feb 28 '23 16:02 pmalek