Skip to content
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

Core API: Report proper HTTPRoute and Gateway Condition when GatewayClass is invalid or doesn't exist #307

Closed
pleshakov opened this issue Nov 16, 2022 · 1 comment · Fixed by #576
Assignees
Labels
area/gateway/core Relates to all Core features of Gateway area/httproute/core Relates to all Core features of HTTPRoute enhancement New feature or request refined Requirements are refined and the issue is ready to be implemented.
Milestone

Comments

@pleshakov
Copy link
Contributor

pleshakov commented Nov 16, 2022

Background
There is one to one mapping between NKG and GatewayClass resource.

The GatewayClass might be invalid (ex, its controllerName doesn't match NKG controller name). The GatewayClass might not even exist.

For those cases NGK doesn't generate any NGINX configuration and as a result, NGINX will not accept any traffic.
However, NKG still processes Gateways and HTTPRoutes.

Requirements

When GatewayClass is invalid or it is doesn't exist, NGK must report Accepted (false) and appropriate reasons in the statuses of HTTPRoute resources and Gateway resources.

Figure out an appropriate Reason. Check the Gateway API first. If necessary, introduce NKG-specific reasons.

Acceptance Criteria

Aha! Link: https://nginx.aha.io/features/NKG-17

@pleshakov pleshakov added the enhancement New feature or request label Nov 16, 2022
@pleshakov pleshakov changed the title Report proper Condition and Reasons in HTTPRoute status when GatewayClass is invalid or doesn't exist Report proper Condition and Reasons in HTTPRoute and Gateway statuses when GatewayClass is invalid or doesn't exist Feb 2, 2023
@kate-osborn kate-osborn changed the title Report proper Condition and Reasons in HTTPRoute and Gateway statuses when GatewayClass is invalid or doesn't exist Core API: Report proper HTTPRoute Condition when GatewayClass is invalid or doesn't exist Mar 17, 2023
@pleshakov pleshakov changed the title Core API: Report proper HTTPRoute Condition when GatewayClass is invalid or doesn't exist Core API: Report proper Gateway and HTTPRoute Condition when GatewayClass is invalid or doesn't exist Mar 20, 2023
@pleshakov pleshakov changed the title Core API: Report proper Gateway and HTTPRoute Condition when GatewayClass is invalid or doesn't exist Core API: Report proper HTTPRoute Condition when GatewayClass is invalid or doesn't exist Mar 20, 2023
@pleshakov pleshakov changed the title Core API: Report proper HTTPRoute Condition when GatewayClass is invalid or doesn't exist Core API: Report proper HTTPRoute and Gateway Condition when GatewayClass is invalid or doesn't exist Mar 21, 2023
@kate-osborn kate-osborn added area/httproute/core Relates to all Core features of HTTPRoute area/gateway/core Relates to all Core features of Gateway labels Mar 21, 2023
@kate-osborn kate-osborn added this to the v0.3.0 milestone Mar 21, 2023
@kate-osborn kate-osborn self-assigned this Mar 21, 2023
@pleshakov
Copy link
Contributor Author

Discussed with @kate-osborn implementation approach:

  • if the GatewayClass doesn't exist or invalid, NKG will invalidate any listeners of the Gateway resource and report the error about the GatewayClass in the Gateway status.
  • As a result of invalid listeners, HTTPRoutes will not be able to attach to listeners. NKG will report already implemented invalid listener condition in the HTTPRoute statuses.

@kate-osborn kate-osborn removed their assignment Mar 24, 2023
@kate-osborn kate-osborn added the refined Requirements are refined and the issue is ready to be implemented. label Mar 24, 2023
@kate-osborn kate-osborn moved this from 🆕 New to 🔖 To Do in NGINX Gateway Fabric Mar 24, 2023
@pleshakov pleshakov moved this from 🔖 To Do to 🏗 In Progress in NGINX Gateway Fabric Apr 10, 2023
@ja20222 ja20222 assigned ja20222 and pleshakov and unassigned ja20222 Apr 12, 2023
pleshakov added a commit that referenced this issue Apr 13, 2023
If GatewayClass is invalid or doesn't exist:
- For Gateway Listeners: NKG will make every listener invalid and
report Accepted condition with status False and reason
NoValidGatewayClass in every listener status.
- For HTTPRoutes: An HTTPRoute will not be able to attach to any
listener, because they will be invalid. This is already handled: NKG
will report Accepted condition with status False and reason
InvalidListener.

Fixes #307
@pleshakov pleshakov moved this from 🏗 In Progress to 👀 In Review in NGINX Gateway Fabric Apr 13, 2023
pleshakov added a commit that referenced this issue Apr 17, 2023
#576)

* Refactor listener validation

* Report proper conditions when GatewayClass is invalid or doesn't exist

If GatewayClass is invalid or doesn't exist:
- For Gateway Listeners: NKG will make every listener invalid and
report Accepted condition with status False and reason
NoValidGatewayClass in every listener status.
- For HTTPRoutes: An HTTPRoute will not be able to attach to any
listener, because they will be invalid. This is already handled: NKG
will report Accepted condition with status False and reason
InvalidListener.

Fixes #307

* Introduce gateway_listener.go - move all listener-related code there
@github-project-automation github-project-automation bot moved this from 👀 In Review to ✅ Done in NGINX Gateway Fabric Apr 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/gateway/core Relates to all Core features of Gateway area/httproute/core Relates to all Core features of HTTPRoute enhancement New feature or request refined Requirements are refined and the issue is ready to be implemented.
Projects
Archived in project
3 participants