# 2 services will get istio injected
---
apiVersion: v1
kind: Service
metadata:
  name: echosrv1
spec:
  ports:
  - port: 8080
    name: http-echo
  - port: 8079
    name: grpc-ping
  selector:
    app: echosrv1
---
apiVersion: apps/v1beta1
kind: Deployment
metadata:
  name: echo-svc-deployment1
spec:
  replicas: 1 # tells deployment to run 1 pods matching the template
  template: # create pods using pod definition in this template
    metadata:
      # a unique name is generated from the deployment name
      labels:
        app: echosrv1
    spec:
      containers:
      - name: echosrv
        image: istio/fortio:latest_release
        imagePullPolicy: Always # needed despite what is documented to really get latest
        ports:
        - containerPort: 8080
---
apiVersion: v1
kind: Service
metadata:
  name: echosrv2
spec:
  ports:
  - port: 8080
    name: http-echo
  - port: 8079
    name: grpc-ping
  selector:
    app: echosrv2
---
apiVersion: apps/v1beta1
kind: Deployment
metadata:
  name: echo-svc-deployment2
spec:
  replicas: 1 # tells deployment to run 1 pods matching the template
  template: # create pods using pod definition in this template
    metadata:
      # a unique name is generated from the deployment name
      labels:
        app: echosrv2
    spec:
      containers:
      - name: echosrv
        image: istio/fortio:latest_release
        imagePullPolicy: Always # needed despite what is documented to really get latest
        ports:
        - containerPort: 8080
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  annotations:
    kubernetes.io/ingress.class: istio
  name: istio-ingress
spec:
  rules:
    - http:
        paths:
          - path: /fortio1/.*
            backend:
              serviceName: echosrv1
              servicePort: http-echo
          - path: /fortio2/.*
            backend:
              serviceName: echosrv2
              servicePort: http-echo
---
