apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: helloworld-gateway
spec:
  selector:
    istio: ingressgateway
  servers:
    - port:
        number: 80
        name: http
        protocol: HTTP
      hosts:
        - "*"
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: helloworld-vs
spec:
  hosts:
    - "*"
  gateways:
    - helloworld-gateway
  http:
    - name: http-mTLS
      match:
        - port: 80
          uri:
            exact: "/http"
      route:
        - destination:
            host: helloworld.default.svc.cluster.local
            port:
              number: 8080
      rewrite:
        uri: "/"
    - name: https-mTLS
      match:
        - port: 80
          uri:
           exact: "/https"
      route:
        - destination:
            host: helloworld.default.svc.cluster.local
            port:
              number: 8443
      rewrite:
        uri: "/"
---
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
  name: helloworld.default.svc.cluster.local
spec:
  host: helloworld.default.svc.cluster.local
  trafficPolicy:
    portLevelSettings:
      - port:
          number: 8443
        tls:
          mode: SIMPLE # Required for https backend