Use LEAST_CONN load balancing for gerrit-replica

Istio provides multiple load balancing algorithms. The default is
round robin. For Gerrit this is not ideal, because requests can be
quite different in size, e.g. cloning a small repo or a large repo.
Istio also provides the LEAST_CONN algorithm, which randomly selects
two live targets and selects the one with less active connections.
This would mitigate the issue and distribute the traffic better.

Change-Id: Ia12a571fdfb354dae6a264f3dbcb7a203e6e0bc6
diff --git a/helm-charts/gerrit-replica/templates/istio.ingressgateway.yaml b/helm-charts/gerrit-replica/templates/istio.ingressgateway.yaml
index 21a1a7f..9a55e8b 100644
--- a/helm-charts/gerrit-replica/templates/istio.ingressgateway.yaml
+++ b/helm-charts/gerrit-replica/templates/istio.ingressgateway.yaml
@@ -106,4 +106,19 @@
         port:
           number: {{ .Values.gerritReplica.service.ssh.port }}
   {{- end }}
+---
+apiVersion: networking.istio.io/v1alpha3
+kind: DestinationRule
+metadata:
+  name: {{ .Release.Name }}-gerrit-destination-rule
+  labels:
+    app: gerrit-replica
+    chart: {{ template "gerrit-replica.chart" . }}
+    heritage: {{ .Release.Service }}
+    release: {{ .Release.Name }}
+spec:
+  host: {{ .Release.Name }}-gerrit-replica-service.{{ .Release.Namespace }}.svc.cluster.local
+  trafficPolicy:
+    loadBalancer:
+      simple: LEAST_CONN
 {{- end }}