Hi there. I have an app that uses two ports. And I need consistent hashing by http header between there instances with both ports. For now it looks like it is separated. For example I send request to sampleadress:4242/users with header sampleHeader:x and I need second request sampleadress:8080/something2 with header sampleHeader:x get routed to the same instance.
With my current setup consistent hashing is working but the buckets with hashes are separated for 4242 and 8080 ports. Below is my configuration. I hope someone could help.
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: {{ template "component.name" . }}
labels:
name: {{ template "component.name" . }}
spec:
exportTo:
{{- range .Values.component.infrastructure.istio.ingressGateway.exportTo }}
- {{ . }}
{{- end }}
gateways:
{{- if .Values.component.infrastructure.istio.ingressGateway.name }}
- {{ .Values.component.infrastructure.istio.ingressGateway.name }}
{{- end }}
- mesh
hosts:
- {{ printf "%s.%s.%s" $.Chart.Name $.Release.Namespace "svc.cluster.local" | lower }}
{{- range .Values.component.infrastructure.istio.ingressGateway.hosts }}
- {{ . }}
{{- end }}
http:
- name: {{ template "component.name" . }}-admin-routes
match:
- uri:
prefix: "/users"
- uri:
prefix: "/errors"
route:
- destination:
host: {{ printf "%s.%s.%s" .Chart.Name .Release.Namespace "svc.cluster.local" | lower }}
port:
number: 4242
- name: {{ template "component.name" . }}-routes
route:
- destination:
host: {{ printf "%s.%s.%s" .Chart.Name .Release.Namespace "svc.cluster.local" | lower }}
port:
number:8080
---
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
name: {{ template "component.name" . }}
labels:
name: {{ template "component.name" . }}
spec:
host: {{ printf "%s.%s.%s" .Chart.Name .Release.Namespace "svc.cluster.local" | lower }}
trafficPolicy:
loadBalancer:
consistentHash:
httpHeaderName: "sampleHeader"
exportTo:
- istio-system
- .