apiVersion: traefik.io/v1alpha1
kind: MiddlewareTCP
metadata:
  name: ipwhitelist
  namespace: default
spec:
  ipWhiteList:
    sourceRange:
      - 127.0.0.1/32

---
apiVersion: traefik.io/v1alpha1
kind: MiddlewareTCP
metadata:
  name: ipwhitelist
  namespace: cross-ns
spec:
  ipWhiteList:
    sourceRange:
      - 127.0.0.1/32
---
apiVersion: traefik.io/v1alpha1
kind: IngressRouteTCP
metadata:
  name: test.route
  namespace: default

spec:
  entryPoints:
    - foo

  routes:
    - match: HostSNI(`foo.com`)
      services:
        - name: whoamitcp
          port: 8000

      middlewares:
        - name: ipwhitelist

    - match: HostSNI(`bar.com`)
      services:
        - name: whoamitcp
          port: 8000

      middlewares:
        - name: ipwhitelist
          namespace: cross-ns
