-
Notifications
You must be signed in to change notification settings - Fork 368
feat: add secret/service resource checker for webhook #2583
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
Conversation
Signed-off-by: Ashing Zheng <[email protected]>
Signed-off-by: Ashing Zheng <[email protected]>
Signed-off-by: Ashing Zheng <[email protected]>
Signed-off-by: Ashing Zheng <[email protected]>
Signed-off-by: Ashing Zheng <[email protected]>
Signed-off-by: Ashing Zheng <[email protected]>
Signed-off-by: Ashing Zheng <[email protected]>
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.
Pull Request Overview
This PR adds webhook validation for secret and service resource references in HTTPRoute, GRPCRoute, TCPRoute, Gateway, and Ingress resources. The validation helps catch misconfigurations by warning users when referenced resources (Services/Secrets) don't exist in the cluster.
Key changes implemented:
- Webhook validators for Gateway API resources (HTTPRoute, GRPCRoute, TCPRoute) that check service references
- Enhanced Ingress webhook validator to check both service and secret references
- Enhanced Gateway webhook validator to check TLS certificate secret references
- Ownership checking logic to determine if resources are managed by the APISIX controller
Reviewed Changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| internal/webhook/v1/httproute_webhook.go | New HTTPRoute webhook validator with service reference checking |
| internal/webhook/v1/grpcroute_webhook.go | New GRPCRoute webhook validator with service reference checking |
| internal/webhook/v1/tcproute_webhook.go | New TCPRoute webhook validator with service reference checking |
| internal/webhook/v1/gateway_webhook.go | Enhanced Gateway validator with TLS secret reference checking |
| internal/webhook/v1/ingress_webhook.go | Enhanced Ingress validator with service/secret reference checking |
| internal/webhook/v1/ownership.go | New ownership checking logic for Gateway API resources |
| internal/manager/webhooks.go | Registration of new webhook validators |
| config/webhook/manifests.yaml | Webhook configuration manifests |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| } | ||
| if err := webhookv1.SetupTCPRouteWebhookWithManager(mgr); err != nil { | ||
| return err | ||
| } |
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.
Since UDPRoute PR is merged. Should we add that as well?
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.
Yes, but i think we can handle it in the next PR. This PR is getting more and more inflated.
Type of change:
What this PR does / why we need it:
This PR adds more webhook validations. The resources for adding validations are HTTPRoute, GRPCRoute, TCPRoute, Gateway, and Ingress.
This PR has also added corresponding unit tests, while e2e tests have not been supplemented yet.
ref: #2580
Pre-submission checklist: