-
Notifications
You must be signed in to change notification settings - Fork 98
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
Feature/dynamic upstreams #221
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kate-osborn please see my review
A few more things:
(1)
Could we update the api compatibility doc? The part about backendRefs in HTTPRoute
NGINX Kubernetes Gateway will use the IP of the Service as a backend, not the IPs of the corresponding Pods. Watching for Service updates is not supported.
(2) I noticed a bug:
(a) deploy cafe example
(b) confirm everything is deployed and working
(c) change tea svc port from 80 to 7777 in the service manifest
bug: config doesn’t get regenerated - keeps using the old endpoints.
9fcbfac
to
2936171
Compare
Thanks @pleshakov I fixed the bug you found and updated the docs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Previously, NKG used the cluster IP of the Service to route traffic to the backend Services specified by HTTPRoutes. With this commit, NKG will use the endpoints of the Pods corresponding to a Service as the upstream servers for a backend Service. This change adds the following components: * EndpointSlice controller for caching and listing EndpointSlices. * Relationship.Capturer for tracking and reporting on relationships between Gateway API resources and non-Gateway API resources (e.g. Services). * ServiceResolver replaces the ServiceStore and resolves Service:Port to a list * of endpoints. This commit also adds upstreams to the nginx config generator. One upstream is generated for each unique and valid Service:Port BackendRef. If a BackendRef cannot be resolved, a 502 is returned. Known Limitations: * Traffic cannot be routed to Headless Services that do not have a defined port. * If a user manually creates and EndpointSlice, they will need to populate the "kubernetes.io/service-name" label and set the ready condition of the endpoints to true. Otherwise, NKG will fail to resolve the Service endpoints.
52127a5
to
231937f
Compare
Adds support for dynamic upstreams.
Previously, NKG used the cluster IP of the Service to route traffic to the backend Services specified by HTTPRoutes. With this PR, NKG will use the endpoints of the Pods corresponding to a Service as the upstream servers for a backend Service.
This change adds the following components:
This PR also adds upstreams to the nginx config generator. One upstream is generated for each unique and valid Service:Port backend ref. If a backendRef cannot be resolved, an upstream is generated that returns a 502. In addition, a default upstream that returns a 502 is generated to handle the case where a backend ref is invalid.
Known limitations:
kubernetes.io/service-name
label, and set the ready condition of the endpoints to true. Otherwise, NKG will fail to resolve the Service endpoints.