Yuyanto
Yuyanto

Reputation: 121

istio virtual service route destination with context path

I have istio configuration on which the docker container runs jasperreports on tomcat(bitnami jasperreports). the application itself could be accessed with context path at http://IP:8080/jasperserver.

I am planning to use istio in my kubernetes configuration, expose the service using http gateway and virtual service. can I add context path of "jasperserver" in addition to destination host and port number in virtual service configuration?

here is my current virtualservice configuration

apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: http-gateway
spec:
  selector:
    istio: ingressgateway # use istio default controller
  servers:
  - port:
      number: 80
      name: http
      protocol: HTTP
    hosts:
    - "*"
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: jasper-virtual-services  
spec:
  hosts:
  - "*"
  gateways:
  - http-gateway
  http:
  - match:
    - uri:
        exact: /report
    
    route:
    - destination:
        host: jasperserver.reporting.svc.cluster.local
        port:
          number: 80

Upvotes: 1

Views: 2668

Answers (1)

user140547
user140547

Reputation: 8200

You are probably looking for rewrites

Something like

  http:
  - match:
    - uri:
        exact: /report
    rewrite:
      uri: /jasperserver

Upvotes: 2

Related Questions