---
kind: GatewayClass
apiVersion: gateway.networking.k8s.io/v1
metadata:
  name: my-gateway-class
spec:
  controllerName: traefik.io/gateway-controller

---
kind: Gateway
apiVersion: gateway.networking.k8s.io/v1
metadata:
  name: my-gateway
  namespace: default
spec:
  gatewayClassName: my-gateway-class
  listeners:
    - name: http
      protocol: HTTP
      port: 8180
      allowedRoutes:
        kinds:
          - kind: HTTPRoute

---
kind: Gateway
apiVersion: gateway.networking.k8s.io/v1
metadata:
  name: my-tcp-gateway
  namespace: default
spec:
  gatewayClassName: my-gateway-class
  listeners:
    - name: tcp
      protocol: TCP
      port: 8193
      allowedRoutes:
        kinds:
          - kind: TCPRoute

---
apiVersion: v1
kind: Secret
metadata:
  name: supersecret
  namespace: default

data:
  tls.crt: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUNJakNDQVl1Z0F3SUJBZ0lRS1F6S1hWV0duODRNNzk2QmhGUzV0VEFOQmdrcWhraUc5dzBCQVFzRkFEQVMKTVJBd0RnWURWUVFLRXdkQlkyMWxJRU52TUNBWERUY3dNREV3TVRBd01EQXdNRm9ZRHpJd09EUXdNVEk1TVRZdwpNREF3V2pBU01SQXdEZ1lEVlFRS0V3ZEJZMjFsSUVOdk1JR2ZNQTBHQ1NxR1NJYjNEUUVCQVFVQUE0R05BRENCCmlRS0JnUURsMHNndm5HSnJOMEt1NXVQanBVZjNwTkY2MTkyL0xSb1FjMmFCeENORkdtZW5XekhsZXpoS3Rnam4KZk0velRxeGU1Y3M5QzBvKzlpdFNrRTBzNEp0S0lob1R6NGEvbklCUmxRZ2hsWkRTQ2ZFVjdXdWxLZGVqbWE3Swp3MittUDVLYy9Qa0ozRkxPSCt0blJRSVZPakZmeDBhMllDS2VxTFJWRmhGOWlMSFBWd0lEQVFBQm8zY3dkVEFPCkJnTlZIUThCQWY4RUJBTUNBcVF3RXdZRFZSMGxCQXd3Q2dZSUt3WUJCUVVIQXdFd0R3WURWUjBUQVFIL0JBVXcKQXdFQi96QW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1l3NWFZaC8xOGgKZTBYRkhRYmpSKzRxNDM1MmJsMkduMVg5Z0hKUDFUQllPY3V0UUM4Qmt0M2pBa0VBL3dIL2JFejd0RCtaWFVjZgpnb21XZzVEU2xhUmRtb0xrSTdLZllvcDl4VlNPUElTSnU4SEFhdnBhWVhiM1NuN05KL25EcUdZM1BVeFpsdzBZCmJNaEMvUUpBZTI3UUt4S1J3YzZ5NXpXdkNxcGtOMk1zNFBOMkVNWERzT2xNQm1oUGh1UWlvYUF6N1Npd2ZQV1UKMU51YTRja2hBaXpUKzIzOUhWWmVaMlF0UWRSSExRSkJBTE40aUhlRVJyRzVBUXJ3LzNBenZVYWpLbEkrOTlIQwp4U1dLbFRvWkZpTkhPMFBFVTl0Y3BUdWxMdTdoZDNGcWhLRFoyNll0S2p0dC9LK2VlODR6czFFQ1FRQ3oyNWlEClpCY2ZrR0FURlhjdWVzeXgvUlcyL2c4QzhtYkN6RW5oSCtYbWVBak44UFRDREF2VDNLVXltRm5MRVB6amVVYU0KRGRuSlZqc3JaNW8xK1c5WgotLS0tLUVORCBQUklWQVRFIEtFWS0tLS0tCg==

---
kind: Gateway
apiVersion: gateway.networking.k8s.io/v1
metadata:
  name: my-tls-gateway
  namespace: default
spec:
  gatewayClassName: my-gateway-class
  listeners:
    - name: tls-9001
      protocol: TLS
      port: 9001
      tls:
        mode: Passthrough
      allowedRoutes:
        kinds:
          - kind: TLSRoute
        namespaces:
          from: Same

    - name: tls-9002
      protocol: TLS
      port: 9002
      tls:
        mode: Terminate
        certificateRefs:
          - kind: Secret
            name: supersecret
      allowedRoutes:
        kinds:
          - kind: TCPRoute

---
kind: Gateway
apiVersion: gateway.networking.k8s.io/v1
metadata:
  name: my-https-gateway
  namespace: default
spec:
  gatewayClassName: my-gateway-class
  listeners:
    - name: https
      protocol: HTTPS
      port: 8443
      tls:
        mode: Terminate
        certificateRefs:
          - kind: Secret
            name: supersecret
      allowedRoutes:
        kinds:
          - kind: HTTPRoute

---
kind: HTTPRoute
apiVersion: gateway.networking.k8s.io/v1
metadata:
  name: http-app-1
  namespace: default
spec:
  parentRefs:
    - name: my-gateway
    - name: my-https-gateway
  hostnames:
    - "foo.com"
  rules:
    - matches:
        - path:
            type: Exact
            value: /bar
      backendRefs:
        - name: whoami
          port: 80
          weight: 1

---
kind: TCPRoute
apiVersion: gateway.networking.k8s.io/v1alpha2
metadata:
  name: tcp-app-1
  namespace: default
spec:
  parentRefs:
    - name: my-tcp-gateway
    - name: my-tls-gateway
  rules:
    - backendRefs:
        - name: whoamitcp
          port: 8080
          weight: 1

---
kind: TLSRoute
apiVersion: gateway.networking.k8s.io/v1alpha2
metadata:
  name: tls-app-1
  namespace: default
spec:
  parentRefs:
    - name: my-tls-gateway
  hostnames:
    - foo.bar
  rules:
    - backendRefs:
        - name: whoamitcp
          port: 8080
          weight: 1
