# istio_mesh.yaml
apiVersion: gateway.networking.k8s.io/v1
kind: GatewayClass
metadata:
  name: istio
spec:
  controllerName: istio.io/gateway-controller
---
apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
  name: gateway
  namespace: istio-system
spec:
  addresses:
  - value: istio-ingressgateway
    type: Hostname
  gatewayClassName: istio
  listeners:
  - name: default
    hostname: "*.example.com"
    port: 80
    protocol: HTTP
    allowedRoutes:
      namespaces:
        from: All
---
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
  name: echo
  namespace: default
spec:
  parentRefs:
  - group: ""
    kind: Service
    name: echo
  rules:
  - backendRefs:
    - name: echo
      port: 80
---
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
  name: dual # applies to mesh and explicit gateway
  namespace: default
spec:
  parentRefs:
  - group: ""
    kind: Service
    name: example
  - name: gateway
    namespace: istio-system
  hostnames: ["foo.example.com"]
  rules:
  - backendRefs:
    - name: example
      port: 80
---
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
  name: header
  namespace: default
spec:
  parentRefs:
  - group: ""
    kind: Service
    name: echo
  rules:
  - matches:
    - path:
        type: PathPrefix
        value: /path
    filters:
    - type: RequestHeaderModifier
      requestHeaderModifier:
        add:
        - name: my-added-header
          value: added-value
    backendRefs:
    - name: echo
      port: 80
---
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
  name: echo-port
  namespace: default
spec:
  parentRefs:
  - group: ""
    kind: Service
    name: echo-port
    port: 80
  rules:
  - backendRefs:
    - name: echo
      port: 80
---
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
  name: multi-service
  namespace: default
spec:
  parentRefs:
  - group: ""
    kind: Service
    name: echo-1
    port: 80
  - group: ""
    kind: Service
    name: echo-1
    port: 8080
  - group: ""
    kind: Service
    name: echo-2
  rules:
  - backendRefs:
    - name: echo
      port: 80
---
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
  name: consumer-override
  namespace: default
spec:
  parentRefs:
  - group: ""
    kind: Service
    name: httpbin-apple
    namespace: apple
    port: 80
  rules:
  - backendRefs:
    - name: httpbin-apple
      namespace: apple
      port: 80
---
apiVersion: gateway.networking.k8s.io/v1alpha2
kind: TCPRoute
metadata:
  name: tcp
  namespace: default
spec:
  parentRefs:
    - group: ""
      kind: Service
      name: echo-1
  rules:
    - backendRefs:
        - name: echo
          port: 80
---
apiVersion: gateway.networking.k8s.io/v1
kind: TLSRoute
metadata:
  name: tls
  namespace: default
spec:
  parentRefs:
    - group: ""
      kind: Service
      name: echo-1
  hostnames:
    - "*.example.com"
  rules:
    - backendRefs:
        - name: echo
          port: 80
---