Refactor Gateway API reconciler#41232
Conversation
070aa3e to
f18956a
Compare
953db3a to
ea55fd1
Compare
gandro
left a comment
There was a problem hiding this comment.
I lack domain knowledge in the service mesh department, so I'll rely on those CODEOWNERs to judge if the new implementation is sound (ultimately I only got pulled in because of the logfield changes).
I did not spot anything majorly off from a rough glance. A couple of commented out pieces of code that stood out to me, but nothing blocking.
ea55fd1 to
7588899
Compare
|
/test |
mhofstetter
left a comment
There was a problem hiding this comment.
I have a question regarding reuse of a (HTTP)Route between Gateway API (Gateway) & GAMMA (K8s Service) - see my inline comment.
I think it would be good to clarify this first as this might when thinking about moving the status update into the Gateway/GAMMA reconcilers.
7588899 to
0e09191
Compare
|
/test |
74f6540 to
511cc80
Compare
There was a problem hiding this comment.
LGTM - even though it's quiet hard to properly review a PR this size that also includes formatting changes 😅 Let's put some trust into the tests (incl. upstream Conformance tests 🙏 )
The rest are mostly nits.
Approving because i will be on PTO starting tomorrow. Maybe it's worth to let @sayboras quickly glance over it as well once he's back?
Thanks for the effort you put into this! 🙇
|
@youngnick How do I go about testing / installing this? I don't see an updated image. Sorry for the ignorance. |
|
@jfmatth, you can test using the CI images, with the images and tags available at https://github.com/cilium/cilium/actions/runs/17229742144/job/48881742368?pr=41232 Then, you'll need to specify the images like this (if you're using If you're using Helm natively: I'm pretty confident this will fix that problem but if you could verify and put a response on #34982, then I'd really appreciate it! |
|
@youngnick I'm not having any luck getting the gateway to get an assigned IP once I run my I have a branch I'm trying all this in the Talos README.md you'll find everything I tried the same build w/o specifying your images and it works, i.e. gateway is 'programmed' otherwise it never finds an endpoint. Any help would be appreciated. |
|
One of the issues I fixed in this PR is that the Gateway could show as reconciled before an address was assigned - when you are seeing the working Gateway with the previous version, does it have an address correcctly assigned? It's possible you may need at least two IP addresses available, since there's a shared Cilium LB Service deployed by default as well (I think). |
|
Nick, thank you. Very interesting.
The behavior would match (mostly) that of what the Traefik GAPI does.
I thought I assigned one HTTP address, but will check again when I can.
J
…On Sun, Aug 31, 2025 at 11:22 PM Nick Young ***@***.***> wrote:
*youngnick* left a comment (cilium/cilium#41232)
<#41232 (comment)>
One of the issues I fixed in this PR is that the Gateway could show as
reconciled before an address was assigned - when you are seeing the working
Gateway with the previous version, does it have an address correcctly
assigned? It's possible you may need at least two IP addresses available,
since there's a shared Cilium LB Service deployed by default as well (I
think).
—
Reply to this email directly, view it on GitHub
<#41232 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACGTMUE4W5Z6WHZDKC3ART3QPCZNAVCNFSM6AAAAACED7CYGOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTENBQHAYTKMRRGA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
|
So doing more testing locally and I now see the LoadBalancer which I don't recall before, cool. I applied my gateway file Still no IP address, but applied an IP pool and I now see the LB has one, but the gateway is still PROGRAMMED = False I have not httproutes. |
|
I added an HTTProute but still no IP on the gateway. I suspect it's all me, but wanted to ask. here is |
|
Yes, you can see from there, the Gateway is not being processed correctly because the Cilium operator cannot create or update ("ensure") the Endpoints resources. |
|
Thanks for the quick reply @youngnick I didn't show it, but I defined 2 IP's in the pool, I could see one get assigned to the LB and I added an HTTPRoute. Still I didn't see the G/W show programmed, what am I not doing? The IPs were valid. |
|
tbh I'm not sure sorry @jfmatth. Could you open a fresh issue with this, preferably with a sysdump if you can? In the meantime, It seems weird that the operator cannot create Endpoints for the generated service, is it missing some RBAC? If you check the operattor logs for messages about that Gateway, are there any errors shown? (You should be able to grep the operator logs for the Gateway name) |
|
@youngnick I'll do more testing when i'm back in the office, on the road currently :) One question I did have is: Do the IPPool IP's need to be on the hosts? I think they do? My test rig on the road didn't have that, so that might be why it's not assigning to the GW87 |
Not to belabor this @youngnick but it does seem to be an RBAC issue. After spending hours finding the permission issue in the logs then trying to fix those ones, after about 4 clusterrole changes, I resorted to just giving cilium-operator clusteradmin and it worked! Obviously, this isn't a solution, but had to show you I haven't opened a new issue since this might be related to your update. I'm still happy to and reference everything you and I have been discussing. One last thing to mention, this is a Talos 1.10.6 cluster, in case that wasn't clear. After apply the adminrole... And now the gateway is programmed w/o any routes, but a valid gateway Here is my |
This commit adds support for using GRPCRoutes for east/west traffic routing with GAMMA. It includes a small amount of refactoring of the Gateway API reconciler as well, to enable the HTTPRoute and GRPCRoute translation logic to share code across both north/south and east/west traffic paths more easily. Unfortunately, I also needed to restructure the GAMMA tests to use the same format as the north/south Gateway API tests, which has made this a _large_ change. The main changes: * Added GRPCRoute support and small refactor to ingestion in `operator/pkg/mode/ingestion`, `gamma.go` and `gateway.go`. * GAMMA reconciler in `operator/pkg/gateway-api` migrated to use `operator/pkg/gateway-api/indexers`, added in cilium#41232. * GRPCRoute support added to `operator/pkg/gateway-api` as well. * Tests in `opreator/pkg/gateway-api/testdata/gamma` updated to use `input/` and `output/` directories, as in `operator/pkg/gateway-api/testdata/gateway-api`. Signed-off-by: Nick Young <[email protected]>
This commit adds support for using GRPCRoutes for east/west traffic routing with GAMMA. It includes a small amount of refactoring of the Gateway API reconciler as well, to enable the HTTPRoute and GRPCRoute translation logic to share code across both north/south and east/west traffic paths more easily. Unfortunately, I also needed to restructure the GAMMA tests to use the same format as the north/south Gateway API tests, which has made this a _large_ change. The main changes: * Gateway API conformance test workflow now requires `kubectl --server-side`, as the HTTPRoute CustomResourceDefinition will fail to apply without it (the `last-applied-config` annotation is too large to fit in 256kb). Updated `Makefile.kind` and `.github/workflows/conformance-gateway-api.yaml` accordingly. * Added GRPCRoute support and small refactor to ingestion in `operator/pkg/mode/ingestion`, `gamma.go` and `gateway.go`. * GAMMA reconciler in `operator/pkg/gateway-api` migrated to use `operator/pkg/gateway-api/indexers`, added in #41232. * GRPCRoute support added to `operator/pkg/gateway-api` as well. * Tests in `opreator/pkg/gateway-api/testdata/gamma` updated to use `input/` and `output/` directories, as in `operator/pkg/gateway-api/testdata/gateway-api`. Signed-off-by: Nick Young <[email protected]>
This commit adds support for using GRPCRoutes for east/west traffic routing with GAMMA. It includes a small amount of refactoring of the Gateway API reconciler as well, to enable the HTTPRoute and GRPCRoute translation logic to share code across both north/south and east/west traffic paths more easily. Unfortunately, I also needed to restructure the GAMMA tests to use the same format as the north/south Gateway API tests, which has made this a _large_ change. The main changes: * Gateway API conformance test workflow now requires `kubectl --server-side`, as the HTTPRoute CustomResourceDefinition will fail to apply without it (the `last-applied-config` annotation is too large to fit in 256kb). Updated `Makefile.kind` and `.github/workflows/conformance-gateway-api.yaml` accordingly. * Added GRPCRoute support and small refactor to ingestion in `operator/pkg/mode/ingestion`, `gamma.go` and `gateway.go`. * GAMMA reconciler in `operator/pkg/gateway-api` migrated to use `operator/pkg/gateway-api/indexers`, added in #41232. * GRPCRoute support added to `operator/pkg/gateway-api` as well. * Tests in `opreator/pkg/gateway-api/testdata/gamma` updated to use `input/` and `output/` directories, as in `operator/pkg/gateway-api/testdata/gateway-api`. Signed-off-by: Nick Young <[email protected]>
This commit adds support for using GRPCRoutes for east/west traffic routing with GAMMA. It includes a small amount of refactoring of the Gateway API reconciler as well, to enable the HTTPRoute and GRPCRoute translation logic to share code across both north/south and east/west traffic paths more easily. Unfortunately, I also needed to restructure the GAMMA tests to use the same format as the north/south Gateway API tests, which has made this a _large_ change. The main changes: * Gateway API conformance test workflow now requires `kubectl --server-side`, as the HTTPRoute CustomResourceDefinition will fail to apply without it (the `last-applied-config` annotation is too large to fit in 256kb). Updated `Makefile.kind` and `.github/workflows/conformance-gateway-api.yaml` accordingly. * Added GRPCRoute support and small refactor to ingestion in `operator/pkg/mode/ingestion`, `gamma.go` and `gateway.go`. * GAMMA reconciler in `operator/pkg/gateway-api` migrated to use `operator/pkg/gateway-api/indexers`, added in #41232. * GRPCRoute support added to `operator/pkg/gateway-api` as well. * Tests in `opreator/pkg/gateway-api/testdata/gamma` updated to use `input/` and `output/` directories, as in `operator/pkg/gateway-api/testdata/gateway-api`. Signed-off-by: Nick Young <[email protected]>
This commit adds support for using GRPCRoutes for east/west traffic routing with GAMMA. It includes a small amount of refactoring of the Gateway API reconciler as well, to enable the HTTPRoute and GRPCRoute translation logic to share code across both north/south and east/west traffic paths more easily. Unfortunately, I also needed to restructure the GAMMA tests to use the same format as the north/south Gateway API tests, which has made this a _large_ change. The main changes: * Gateway API conformance test workflow now requires `kubectl --server-side`, as the HTTPRoute CustomResourceDefinition will fail to apply without it (the `last-applied-config` annotation is too large to fit in 256kb). Updated `Makefile.kind` and `.github/workflows/conformance-gateway-api.yaml` accordingly. * Added GRPCRoute support and small refactor to ingestion in `operator/pkg/mode/ingestion`, `gamma.go` and `gateway.go`. * GAMMA reconciler in `operator/pkg/gateway-api` migrated to use `operator/pkg/gateway-api/indexers`, added in #41232. * GRPCRoute support added to `operator/pkg/gateway-api` as well. * Tests in `opreator/pkg/gateway-api/testdata/gamma` updated to use `input/` and `output/` directories, as in `operator/pkg/gateway-api/testdata/gateway-api`. Signed-off-by: Nick Young <[email protected]>
This commit adds support for using GRPCRoutes for east/west traffic routing with GAMMA. It includes a small amount of refactoring of the Gateway API reconciler as well, to enable the HTTPRoute and GRPCRoute translation logic to share code across both north/south and east/west traffic paths more easily. Unfortunately, I also needed to restructure the GAMMA tests to use the same format as the north/south Gateway API tests, which has made this a _large_ change. The main changes: * Gateway API conformance test workflow now requires `kubectl --server-side`, as the HTTPRoute CustomResourceDefinition will fail to apply without it (the `last-applied-config` annotation is too large to fit in 256kb). Updated `Makefile.kind` and `.github/workflows/conformance-gateway-api.yaml` accordingly. * Added GRPCRoute support and small refactor to ingestion in `operator/pkg/mode/ingestion`, `gamma.go` and `gateway.go`. * GAMMA reconciler in `operator/pkg/gateway-api` migrated to use `operator/pkg/gateway-api/indexers`, added in #41232. * GRPCRoute support added to `operator/pkg/gateway-api` as well. * Tests in `opreator/pkg/gateway-api/testdata/gamma` updated to use `input/` and `output/` directories, as in `operator/pkg/gateway-api/testdata/gateway-api`. Signed-off-by: Nick Young <[email protected]>
This commit adds support for using GRPCRoutes for east/west traffic routing with GAMMA. It includes a small amount of refactoring of the Gateway API reconciler as well, to enable the HTTPRoute and GRPCRoute translation logic to share code across both north/south and east/west traffic paths more easily. Unfortunately, I also needed to restructure the GAMMA tests to use the same format as the north/south Gateway API tests, which has made this a _large_ change. The main changes: * Gateway API conformance test workflow now requires `kubectl --server-side`, as the HTTPRoute CustomResourceDefinition will fail to apply without it (the `last-applied-config` annotation is too large to fit in 256kb). Updated `Makefile.kind` and `.github/workflows/conformance-gateway-api.yaml` accordingly. * Added GRPCRoute support and small refactor to ingestion in `operator/pkg/mode/ingestion`, `gamma.go` and `gateway.go`. * GAMMA reconciler in `operator/pkg/gateway-api` migrated to use `operator/pkg/gateway-api/indexers`, added in #41232. * GRPCRoute support added to `operator/pkg/gateway-api` as well. * Tests in `opreator/pkg/gateway-api/testdata/gamma` updated to use `input/` and `output/` directories, as in `operator/pkg/gateway-api/testdata/gateway-api`. Signed-off-by: Nick Young <[email protected]>
This commit adds support for using GRPCRoutes for east/west traffic routing with GAMMA. It includes a small amount of refactoring of the Gateway API reconciler as well, to enable the HTTPRoute and GRPCRoute translation logic to share code across both north/south and east/west traffic paths more easily. Unfortunately, I also needed to restructure the GAMMA tests to use the same format as the north/south Gateway API tests, which has made this a _large_ change. The main changes: * Gateway API conformance test workflow now requires `kubectl --server-side`, as the HTTPRoute CustomResourceDefinition will fail to apply without it (the `last-applied-config` annotation is too large to fit in 256kb). Updated `Makefile.kind` and `.github/workflows/conformance-gateway-api.yaml` accordingly. * Added GRPCRoute support and small refactor to ingestion in `operator/pkg/mode/ingestion`, `gamma.go` and `gateway.go`. * GAMMA reconciler in `operator/pkg/gateway-api` migrated to use `operator/pkg/gateway-api/indexers`, added in #41232. * GRPCRoute support added to `operator/pkg/gateway-api` as well. * Tests in `opreator/pkg/gateway-api/testdata/gamma` updated to use `input/` and `output/` directories, as in `operator/pkg/gateway-api/testdata/gateway-api`. Signed-off-by: Nick Young <[email protected]>
This commit adds support for using GRPCRoutes for east/west traffic routing with GAMMA. It includes a small amount of refactoring of the Gateway API reconciler as well, to enable the HTTPRoute and GRPCRoute translation logic to share code across both north/south and east/west traffic paths more easily. Unfortunately, I also needed to restructure the GAMMA tests to use the same format as the north/south Gateway API tests, which has made this a _large_ change. The main changes: * Gateway API conformance test workflow now requires `kubectl --server-side`, as the HTTPRoute CustomResourceDefinition will fail to apply without it (the `last-applied-config` annotation is too large to fit in 256kb). Updated `Makefile.kind` and `.github/workflows/conformance-gateway-api.yaml` accordingly. * Added GRPCRoute support and small refactor to ingestion in `operator/pkg/mode/ingestion`, `gamma.go` and `gateway.go`. * GAMMA reconciler in `operator/pkg/gateway-api` migrated to use `operator/pkg/gateway-api/indexers`, added in #41232. * GRPCRoute support added to `operator/pkg/gateway-api` as well. * Tests in `opreator/pkg/gateway-api/testdata/gamma` updated to use `input/` and `output/` directories, as in `operator/pkg/gateway-api/testdata/gateway-api`. Signed-off-by: Nick Young <[email protected]>
This PR removes the separate reconcilers for each Route type in favor of updating status inside the Gateway
reconciler.
This also adds new indicies on the Gateway reconciler that should make reconciliation more efficient.
Migrates all tests that were handled by the various Route reconcilers to the Gateway reconciler.
Moves all indexers used in the Gateway controller-runtime Manager into a new
indexerspackage.It also fixes an existing issue with GRPCRoute reconciliation (#39021 and #40922), by adding correct
supportedKindshandling.While fixing this, also fixed some inconsistencies in Condition handling across all Gateway API objects, so this is a much bigger commit than expected.
Programmedis now added asPendingbefore addresses are added to the Gateway, and is updated toProgrammedwhen addresses are added.Tests have been updated to reflect this.
Also added a test that, when there is an address set on the Gateway, the Programmed Condition is correctly updated.
The address is set by taking it from the generated Loadbalancer Service, so this test supplies a preconfigured Loadbalancer Service to ensure an address gets added to the Gateway correctly.
Ordering of Conditions in status has also been made more consistent.
The PEM checking performed in
isValidPEMFormathas been loosened, and this function will now returntruefor all byte slices that contain at least one valid PEM-encoded certificate or key. Previous behavior was that it would only return if all bytes decoded successfully, which can cause issues if there are extra line feeds or extraneous material in the certificate - that don't matter to Envoy or to the eventual functionality.Removes the now-redundant ReferenceGrant reconciler, which was a placeholder in case we needed to update ReferenceGrant status at a later date.
If we do need to do that in the future, which is unlikely, we can use similar mechanisms to what we now use for Route status in the Gateway reconciler.
Fixes: #40809