-
|
Hello. I used to use the nginx-ingress. (Thank you NGINX for being so reliable for so long btw). An annotation I used to use quite often on ingresses was nginx.ingress.kubernetes.io/whitelist-source-range I am looking to port to Gateway Fabric. Is there a similar configuration or annotation available? Thank you |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
|
Hi @JFrandon! Thanks so much for your kind words and your interest in our project! NGINX Gateway Fabric does not have a built-in equivalent to the ingress-nginx Route-Level IP Whitelisting1. Create the SnippetsFilterapiVersion: gateway.nginx.org/v1alpha1
kind: SnippetsFilter
metadata:
name: ip-whitelist
spec:
snippets:
- context: http.server.location
value: |
allow 10.0.0.0/8;
allow 192.168.1.0/24;
deny all;2. Reference it in your HTTPRouteapiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: my-route
spec:
parentRefs:
- name: gateway
rules:
- matches:
- path:
type: PathPrefix
value: /
filters:
- type: ExtensionRef
extensionRef:
group: gateway.nginx.org
kind: SnippetsFilter
name: ip-whitelist
backendRefs:
- name: my-service
port: 80Context OptionsYou can place
Gateway-Wide IP Whitelisting (Coming in v2.4.0)If you want to apply IP restrictions across an entire Gateway rather than individual routes, you can use SnippetsPolicy instead: apiVersion: gateway.nginx.org/v1alpha1
kind: SnippetsPolicy
metadata:
name: gateway-ip-whitelist
spec:
targetRefs:
- group: gateway.networking.k8s.io
kind: Gateway
name: my-gateway
snippets:
- context: http.server
value: |
allow 10.0.0.0/8;
deny all;Notes
|
Beta Was this translation helpful? Give feedback.
-
|
Thank you so much. Really looking forward to v2.6.0 then 😄 |
Beta Was this translation helpful? Give feedback.
Hi @JFrandon!
Thanks so much for your kind words and your interest in our project!
NGINX Gateway Fabric does not have a built-in equivalent to the ingress-nginx
nginx.ingress.kubernetes.io/whitelist-source-rangeannotation. However, the same functionality can be achieved using SnippetsFilter (or, as of our 2.4 release, SnippetsPolicy), which allows you to inject raw NGINX configuration directives (such asallowanddeny) into the generated NGINX config.Route-Level IP Whitelisting
1. Create the SnippetsFilter