Description
What would you like to be added:
Cross namespaces references in Route and BackendPolicy.
Examples:
A gateway may want to expose a route for a service in another namespace. For example, maybe we set up a dedicated gateway namespace a define a few routes to expose Services in other namespaces. This may sound like a security issue (a user can expose my secret Service externally without my permission), but it isn't inherently so - a user could already do this by manually configuring the proxy. If the user actually wants to restrict traffic from other namespaces, like our gateway
namespace here, they need to do that in NetworkPolicy or similar, not assume someone won't proxy external traffic to their service:
apiVersion: networking.x-k8s.io/v1alpha1
kind: BackendPolicy
metadata:
name: policy
namespace: gateway
spec:
backendRefs:
- name: foo
kind: service
namespace: bar # NEW: cross namespace reference
port: 80
---
apiVersion: networking.x-k8s.io/v1alpha1
kind: HTTPRoute
metadata:
name: foo-route
namespace: gateway
spec:
hostnames:
- foo.example.com
rules:
- forwardTo:
- serviceName: foo
namespace: bar
port: 80
A user may migrate to a new namespace and need to do a traffic split
apiVersion: networking.x-k8s.io/v1alpha1
kind: HTTPRoute
metadata:
name: foo-route
namespace: gateway
spec:
hostnames:
- foo.example.com
rules:
- forwardTo:
- serviceName: foo
namespace: bar
port: 80
weight: 2
- serviceName: foo-new
namespace: bar-new
port: 80
weight: 1