-
Notifications
You must be signed in to change notification settings - Fork 105
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
adding support for secrets for backendtlspolicy #3084
base: main
Are you sure you want to change the base?
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.
Overall I think the approach looks good here! Haven't yet tested it myself, but will get around to that. Thanks for this.
Steps used to test the PR
The cert matches but running into Any insights - @sjberman |
@salonichf5 I don't think you need to use this Secret at all at the Gateway layer. This is just for securing traffic to the backend, so you should just be able to use http for client -> nginx traffic. https://docs.nginx.com/nginx-gateway-fabric/how-to/traffic-security/securing-backend-traffic/ |
Verifies that the PR is working as expected. Nginx config for
Verified that the certificate contents in |
Looks good to me once we have issues with the linter fixed! |
Linter still fails, you can verify what's happening locally by running |
@salonichf5 It may be related to a recent fix in the linter which has been merged to main. Rebasing could help fix the issue. |
Proposed changes
The proposed changes here adds the support for Secrets to be used according to the BackednTLSPolicy Custom Resource. This helps further the implementation of nginx-gateway-fabric to support the Gateway API more.
Problem
Currently BackendTLSPolicy only supports readying in tls certifications and ca certifications via a config map. This does not work when you are using cert-manager for instance since it puts this information into a kubernetes secret rather then a config map.
Solution
The Solution here is to hook into the existing Configuration structure that builds the dataplane nginx configuration that is served in the pod. Allowing for secrets and configmaps to be read into this array of CertBundles.
Testing
Did some end to end testing here and built 2 packages that can be used with this code.
https://github.com/porthorian/nginx-gateway-fabric/pkgs/container/nginx-gateway-fabric%2Fnginx
https://github.com/porthorian/nginx-gateway-fabric/pkgs/container/nginx-gateway-fabric
These were then deployed and made a BackendTLSPolicy with the secret that was created with cert-manager.
Reviewer Focus
Since this is a working draft here - places that should be focused on is making sure I am inline with the current standards and everyone is statisified with how this was structurally laid out before moving onto polishing it up and writing some additional tests.
Issues
Closes #2629
Checklist
Before creating a PR, run through this checklist and mark each as complete.
Release notes