gateway/gke-gateway-controller/ex3-multi-tenant-gw.yaml (58 lines of code) (raw):
kind: Gateway
apiVersion: networking.x-k8s.io/v1alpha1
metadata:
name: multi-tenant-gw
namespace: shared-infra-ns
spec:
class: internal
listeners:
- protocol: HTTP
port: 80
routes:
resource: httproutes
routeNamespaces:
onlySameNamespace: false
routeSelector:
matchLabels:
route: multi-tenant
---
apiVersion: networking.x-k8s.io/v1alpha1
kind: HTTPRoute
metadata:
name: foobar
namespace: foobar-ns
labels:
route: multi-tenant
spec:
hosts:
- hostnames:
- foo.com
rules:
- action:
forwardTo:
- targetRef:
name: foo-svc
- hostnames:
- bar.com
rules:
- action:
forwardTo:
- targetRef:
name: bar-svc
---
apiVersion: networking.x-k8s.io/v1alpha1
kind: HTTPRoute
metadata:
name: bam
namespace: bam-ns
labels:
route: multi-tenant
spec:
hosts:
- hostnames:
- bam.com
rules:
- action:
forwardTo:
- targetRef:
name: bam-svc