{{- if .Values.istio.enabled }}
---
apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
  name: {{ include "redis-commander.fullname" . }}
  labels:
    {{- include "redis-commander.labels" . | nindent 4 }}
  {{- with .Values.ingress.annotations }}
  annotations:
    {{- toYaml . | nindent 4 }}
  {{- end }}
spec:
  gateways:
  - {{ .Values.istio.gateway }}
  hosts:
  - {{ .Values.istio.host }}
  http:
  - match:
    - uri:
        prefix: {{ .Values.istio.hostPrefix }}
    route:
    - destination:
        host: {{ include "redis-commander.fullname" . }}
        port:
          number: {{ .Values.service.port }}
  {{- end}}
