diff --git a/gateway/gke-gateway-controller/multi-cluster-gateway/external-http-gateway.yaml b/gateway/gke-gateway-controller/multi-cluster-gateway/external-http-gateway.yaml new file mode 100644 index 0000000000..e69de29bb2 diff --git a/gateway/gke-gateway-controller/multi-cluster-gateway/internal-http-gateway.yaml b/gateway/gke-gateway-controller/multi-cluster-gateway/internal-http-gateway.yaml new file mode 100644 index 0000000000..088586be8e --- /dev/null +++ b/gateway/gke-gateway-controller/multi-cluster-gateway/internal-http-gateway.yaml @@ -0,0 +1,15 @@ +kind: Gateway +apiVersion: networking.x-k8s.io/v1alpha1 +metadata: + name: internal-http + namespace: store +spec: + gatewayClassName: gke-l7-rilb-mc + listeners: + - protocol: HTTP + port: 80 + routes: + kind: HTTPRoute + selector: + matchLabels: + gateway: internal-http \ No newline at end of file diff --git a/gateway/gke-gateway-controller/multi-cluster-gateway/internal-route-stage-1.yaml b/gateway/gke-gateway-controller/multi-cluster-gateway/internal-route-stage-1.yaml new file mode 100644 index 0000000000..af695a3490 --- /dev/null +++ b/gateway/gke-gateway-controller/multi-cluster-gateway/internal-route-stage-1.yaml @@ -0,0 +1,29 @@ +kind: HTTPRoute +apiVersion: networking.x-k8s.io/v1alpha1 +metadata: + name: internal-store-route + namespace: store + labels: + gateway: internal-http +spec: + hostnames: + - "store.example.internal" + rules: +# Matches for env=canary and sends it to store-west-2 ServiceImport + - matches: + - headers: + values: + env: canary + forwardTo: + - backendRef: + group: net.gke.io + kind: ServiceImport + name: store-west-2 + port: 8080 +# All other traffic goes to store-west-1 ServiceImport + - forwardTo: + - backendRef: + group: net.gke.io + kind: ServiceImport + name: store-west-1 + port: 8080 \ No newline at end of file diff --git a/gateway/gke-gateway-controller/multi-cluster-gateway/internal-route-stage-2.yaml b/gateway/gke-gateway-controller/multi-cluster-gateway/internal-route-stage-2.yaml new file mode 100644 index 0000000000..9c1008d513 --- /dev/null +++ b/gateway/gke-gateway-controller/multi-cluster-gateway/internal-route-stage-2.yaml @@ -0,0 +1,27 @@ +kind: HTTPRoute +apiVersion: networking.x-k8s.io/v1alpha1 +metadata: + name: internal-store-route + namespace: store + labels: + gateway: internal-http +spec: + hostnames: + - "store.example.internal" + rules: +# Sends all traffic to store-west-1 ServiceImport + - forwardTo: + - backendRef: + group: net.gke.io + kind: ServiceImport + name: store-west-1 + port: 8080 +# Also mirrors all traffic to store-west-2 ServiceImport + filters: + - type: RequestMirror + requestMirror: + backendRef: + group: net.gke.io + kind: ServiceImport + name: store-west-2 + port: 8080 \ No newline at end of file diff --git a/gateway/gke-gateway-controller/multi-cluster-gateway/internal-route-stage-3.yaml b/gateway/gke-gateway-controller/multi-cluster-gateway/internal-route-stage-3.yaml new file mode 100644 index 0000000000..455c5085b1 --- /dev/null +++ b/gateway/gke-gateway-controller/multi-cluster-gateway/internal-route-stage-3.yaml @@ -0,0 +1,26 @@ +kind: HTTPRoute +apiVersion: networking.x-k8s.io/v1alpha1 +metadata: + name: internal-store-route + namespace: store + labels: + gateway: internal-http +spec: + hostnames: + - "store.example.internal" + rules: +# 90% of traffic to store-west-1 ServiceImport + - forwardTo: + - backendRef: + group: net.gke.io + kind: ServiceImport + name: store-west-1 + port: 8080 + weight: 90 +# 10% of traffic to store-west-2 ServiceImport + - backendRef: + group: net.gke.io + kind: ServiceImport + name: store-west-2 + port: 8080 + weight: 10 \ No newline at end of file diff --git a/gateway/gke-gateway-controller/multi-cluster-gateway/internal-route-stage-4.yaml b/gateway/gke-gateway-controller/multi-cluster-gateway/internal-route-stage-4.yaml new file mode 100644 index 0000000000..66e2112632 --- /dev/null +++ b/gateway/gke-gateway-controller/multi-cluster-gateway/internal-route-stage-4.yaml @@ -0,0 +1,26 @@ +kind: HTTPRoute +apiVersion: networking.x-k8s.io/v1alpha1 +metadata: + name: internal-store-route + namespace: store + labels: + gateway: internal-http +spec: + hostnames: + - "store.example.internal" + rules: +# No traffic to store-west-1 ServiceImport + - forwardTo: + - backendRef: + group: net.gke.io + kind: ServiceImport + name: store-west-1 + port: 8080 + weight: 0 +# All traffic to store-west-2 ServiceImport + - backendRef: + group: net.gke.io + kind: ServiceImport + name: store-west-2 + port: 8080 + weight: 100 \ No newline at end of file diff --git a/gateway/gke-gateway-controller/multi-cluster-gateway/private-store-route.yaml b/gateway/gke-gateway-controller/multi-cluster-gateway/private-store-route.yaml new file mode 100644 index 0000000000..088586be8e --- /dev/null +++ b/gateway/gke-gateway-controller/multi-cluster-gateway/private-store-route.yaml @@ -0,0 +1,15 @@ +kind: Gateway +apiVersion: networking.x-k8s.io/v1alpha1 +metadata: + name: internal-http + namespace: store +spec: + gatewayClassName: gke-l7-rilb-mc + listeners: + - protocol: HTTP + port: 80 + routes: + kind: HTTPRoute + selector: + matchLabels: + gateway: internal-http \ No newline at end of file diff --git a/gateway/gke-gateway-controller/multi-cluster-gateway/public-store-route.yaml b/gateway/gke-gateway-controller/multi-cluster-gateway/public-store-route.yaml new file mode 100644 index 0000000000..f1584b92bd --- /dev/null +++ b/gateway/gke-gateway-controller/multi-cluster-gateway/public-store-route.yaml @@ -0,0 +1,37 @@ +kind: HTTPRoute +apiVersion: networking.x-k8s.io/v1alpha1 +metadata: + name: public-store-route + namespace: store + labels: + gateway: external-http +spec: + hostnames: + - "store.example.com" + rules: + - forwardTo: + - backendRef: + group: net.gke.io + kind: ServiceImport + name: store + port: 8080 + - matches: + - path: + type: Prefix + value: /west + forwardTo: + - backendRef: + group: net.gke.io + kind: ServiceImport + name: store-west-1 + port: 8080 + - matches: + - path: + type: Prefix + value: /east + forwardTo: + - backendRef: + group: net.gke.io + kind: ServiceImport + name: store-east-1 + port: 8080 \ No newline at end of file diff --git a/gateway/gke-gateway-controller/multi-cluster-gateway/store-east-1-service.yaml b/gateway/gke-gateway-controller/multi-cluster-gateway/store-east-1-service.yaml new file mode 100644 index 0000000000..e69de29bb2 diff --git a/gateway/gke-gateway-controller/multi-cluster-gateway/store-west-1-service.yaml b/gateway/gke-gateway-controller/multi-cluster-gateway/store-west-1-service.yaml new file mode 100644 index 0000000000..9978d9a098 --- /dev/null +++ b/gateway/gke-gateway-controller/multi-cluster-gateway/store-west-1-service.yaml @@ -0,0 +1,35 @@ +apiVersion: v1 +kind: Service +metadata: + name: store + namespace: store +spec: + selector: + app: store + ports: + - port: 8080 + targetPort: 8080 +--- +kind: ServiceExport +apiVersion: net.gke.io/v1 +metadata: + name: store + namespace: store +--- +apiVersion: v1 +kind: Service +metadata: + name: store-west-1 + namespace: store +spec: + selector: + app: store + ports: + - port: 8080 + targetPort: 8080 +--- +kind: ServiceExport +apiVersion: net.gke.io/v1 +metadata: + name: store-west-1 + namespace: store \ No newline at end of file diff --git a/gateway/gke-gateway-controller/multi-cluster-gateway/store-west-2-service.yaml b/gateway/gke-gateway-controller/multi-cluster-gateway/store-west-2-service.yaml new file mode 100644 index 0000000000..d77badf8ba --- /dev/null +++ b/gateway/gke-gateway-controller/multi-cluster-gateway/store-west-2-service.yaml @@ -0,0 +1,35 @@ +apiVersion: v1 +kind: Service +metadata: + name: store + namespace: store +spec: + selector: + app: store + ports: + - port: 8080 + targetPort: 8080 +--- +kind: ServiceExport +apiVersion: net.gke.io/v1 +metadata: + name: store + namespace: store +--- +apiVersion: v1 +kind: Service +metadata: + name: store-west-2 + namespace: store +spec: + selector: + app: store + ports: + - port: 8080 + targetPort: 8080 +--- +kind: ServiceExport +apiVersion: net.gke.io/v1 +metadata: + name: store-west-2 + namespace: store \ No newline at end of file