apiVersion: gateway.networking.k8s.io/v1alpha2
kind: GatewayClass
metadata:
  name: istio
spec:
  controllerName: istio.io/gateway-controller
---
apiVersion: gateway.networking.k8s.io/v1alpha2
kind: Gateway
metadata:
  name: gateway
  namespace: istio-system
spec:
  addresses:
  - value: istio-ingressgateway
    type: Hostname
  gatewayClassName: istio
  listeners:
  - name: default
    hostname: "*.domain.example"
    port: 80
    protocol: HTTP
    allowedRoutes:
      namespaces:
        from: All
---
apiVersion: gateway.networking.k8s.io/v1alpha2
kind: Gateway
metadata:
  name: invalid-service
  namespace: istio-system
spec:
  gatewayClassName: istio
  listeners:
  - name: default
    hostname: "*.example"
    port: 80
    protocol: HTTP
  addresses:
  - value: fake-service.com
    type: Hostname
---
apiVersion: gateway.networking.k8s.io/v1alpha2
kind: Gateway
metadata:
  name: target-port-reference
  namespace: istio-system
spec:
  addresses:
  - value: istio-ingressgateway
    type: Hostname
  gatewayClassName: istio
  listeners:
  - name: default
    hostname: "*.example"
    port: 8080 # Test service has port 80 with targetPort 8080
    protocol: HTTP
---
apiVersion: gateway.networking.k8s.io/v1alpha2
kind: Gateway
metadata:
  name: invalid-gateway-address
  namespace: invalid-gateway-address
spec:
  gatewayClassName: istio
  addresses:
  - value: 1.2.3.4
    type: istio.io/FakeType
  listeners:
  - name: default
    hostname: "*.domain.example"
    port: 80
    protocol: HTTP
---
apiVersion: gateway.networking.k8s.io/v1alpha2
kind: Gateway
metadata:
  name: invalid-tls
  namespace: istio-system
spec:
  addresses:
  - value: istio-ingressgateway
    type: Hostname
  gatewayClassName: istio
  listeners:
  - name: default
    hostname: "domain.example"
    port: 34000
    protocol: HTTPS
    tls:
      mode: Terminate
      certificateRefs:
      - name: my-cert-http
        group: core
        kind: unknown
---
apiVersion: gateway.networking.k8s.io/v1alpha2
kind: HTTPRoute
metadata:
  name: invalid-filter
  namespace: default
spec:
  hostnames: ["first.domain.example"]
  parentRefs:
  - name: gateway
    namespace: istio-system
  rules:
  - filters:
    - type: ExtensionRef
    backendRefs:
    - name: httpbin
      port: 80
---
apiVersion: gateway.networking.k8s.io/v1alpha2
kind: HTTPRoute
metadata:
  name: invalid-backendRef-kind
  namespace: default
spec:
  parentRefs:
  - name: gateway
    namespace: istio-system
  hostnames: ["first.domain.example"]
  rules:
  - backendRefs:
    - name: httpbin
      kind: GcsBucket
---
apiVersion: gateway.networking.k8s.io/v1alpha2
kind: HTTPRoute
metadata:
  name: invalid-backendRef-notfound
  namespace: default
spec:
  parentRefs:
  - name: gateway
    namespace: istio-system
  hostnames: ["second.domain.example"]
  rules:
  - backendRefs:
    - name: nonexistent
      port: 80
---
apiVersion: gateway.networking.k8s.io/v1alpha2
kind: HTTPRoute
metadata:
  name: invalid-backendRef-mixed
  namespace: default
spec:
  parentRefs:
  - name: gateway
    namespace: istio-system
  hostnames: ["third.domain.example"]
  rules:
  - backendRefs:
    - name: nonexistent
      port: 80
      weight: 1
    - name: httpbin
      port: 80
      weight: 1
    - name: httpbin
      kind: GcsBucket
      weight: 1
---
apiVersion: gateway.networking.k8s.io/v1alpha2
kind: HTTPRoute
metadata:
  name: invalid-mirror
  namespace: default
spec:
  parentRefs:
  - name: gateway
    namespace: istio-system
  rules:
  - filters:
    - type: RequestMirror
      requestMirror:
        backendRef:
          kind: no-support
          name: httpbin-mirror
          port: 80
    backendRefs:
    - name: httpbin
      port: 80