apiVersion: networking.istio.io/v1alpha3
kind: ServiceEntry
metadata:
  name: external-svc-extsvc
  namespace: testns
spec:
   hosts:
   - external.extsvc.com
   ports:
   - number: 1443
     name: extsvc-http
     protocol: HTTP # not HTTPS.
   resolution: DNS

---

apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
 name: external-service-1
 namespace: testns
spec:
 host: external.extsvc.com
# BUG: crash envoy
# trafficPolicy:
#   tls:
#     mode: SIMPLE # initiates HTTPS when talking to extsvc.com

---

apiVersion: networking.istio.io/v1alpha3
kind: ServiceEntry
metadata:
  name: external-svc-ports
  namespace: testns
spec:
   hosts:
   - ports.extsvc.com
   - ports1.extsvc.com
#   - *.ports2.extsvc.com
   ports:
   - number: 443
     name: extsvc-https
     protocol: HTTPS # not HTTPS.
   - number: 8443
     name: https-ports2
     protocol: HTTP
   resolution: DNS

---

apiVersion: networking.istio.io/v1alpha3
kind: ServiceEntry
metadata:
  name: external-svc-dst
  namespace: testns
spec:
   hosts:
   - dst.extsvc.com
#   - *.dst2.extsvc.com
   ports:
   - number: 8001
     name: extsvc-http
     protocol: HTTP
   resolution: NONE

---


apiVersion: networking.istio.io/v1alpha3
kind: ServiceEntry
metadata:
  name: external-svc-ep
  namespace: testns
spec:
   hosts:
   - ep.extsvc.com
   ports:
   - number: 8002
     name: extsvc-http
     protocol: HTTP
   resolution: STATIC
   endpoints:
    - address: 127.0.0.2
      ports:
        extsvc-http: 8080
    - address: 127.0.0.3
      ports:
        extsvc-http: 8002
#
#---
#
#apiVersion: networking.istio.io/v1alpha3
#kind: ServiceEntry
#metadata:
#  name: external-svc-dns-ep
#spec:
#   hosts:
#   - dnsep.extsvc.com
#   ports:
#   - number: 8003
#     name: extsvc-http
#     protocol: HTTP
#   resolution: DNS
#   endpoints:
#    - address: dnsep1.weekly.istio.io
#      ports:
#        http: 8080
#    - address: dnsep2.weekly.istio.io
#      ports:
#        http: 8082
#
#---
#
