[charts] Add support of loadBalancerSourceRanges for Services

Add support of loadBalancerSourceRanges for Services.
Can be useful for Services with the type of `loadBalancer` to limit access to the service.

Change-Id: Ide768cf15a8b4d0c9809295d131738b1b1995f07
diff --git a/helm-charts/gerrit-replica/README.md b/helm-charts/gerrit-replica/README.md
index c988875..31db83a 100644
--- a/helm-charts/gerrit-replica/README.md
+++ b/helm-charts/gerrit-replica/README.md
@@ -329,6 +329,7 @@
 | `gitBackend.readinessProbe` | Configuration of the readiness probe timings | `{initialDelaySeconds: 5, periodSeconds: 1}` |
 | `gitBackend.credentials.htpasswd` | `.htpasswd`-file containing username/password-credentials for accessing git | `git:$apr1$O/LbLKC7$Q60GWE7OcqSEMSfe/K8xU.` (user: git, password: secret) |
 | `gitBackend.service.additionalAnnotations` | Additional annotations for the Service | `{}` |
+| `gitBackend.service.loadBalancerSourceRanges` | The list of allowed IPs for the Service | `[]` |
 | `gitBackend.service.type` | Which kind of Service to deploy | `LoadBalancer` |
 | `gitBackend.service.externalTrafficPolicy` | Specify how traffic from external is handled | `Cluster` |
 | `gitBackend.service.http.enabled` | Whether to serve HTTP-requests (needed for Ingress) | `true` |
@@ -398,6 +399,7 @@
 | `gerritReplica.networkPolicy.ingress` | Custom ingress-network policy for gerrit-replica pods | `nil` |
 | `gerritReplica.networkPolicy.egress` | Custom egress-network policy for gerrit-replica pods | `nil` |
 | `gerritReplica.service.additionalAnnotations` | Additional annotations for the Service | `{}` |
+| `gerritReplica.service.loadBalancerSourceRanges` | The list of allowed IPs for the Service | `[]` |
 | `gerritReplica.service.type` | Which kind of Service to deploy | `NodePort` |
 | `gerritReplica.service.externalTrafficPolicy` | Specify how traffic from external is handled | `Cluster` |
 | `gerritReplica.service.http.port` | Port over which to expose HTTP | `80` |
diff --git a/helm-charts/gerrit-replica/templates/gerrit-replica.service.yaml b/helm-charts/gerrit-replica/templates/gerrit-replica.service.yaml
index e3c5ca0..c80cfae 100644
--- a/helm-charts/gerrit-replica/templates/gerrit-replica.service.yaml
+++ b/helm-charts/gerrit-replica/templates/gerrit-replica.service.yaml
@@ -14,6 +14,12 @@
   {{- end }}
 spec:
   {{ with .Values.gerritReplica.service }}
+  {{- if .loadBalancerSourceRanges -}}
+  loadBalancerSourceRanges:
+{{- range .loadBalancerSourceRanges }}
+    - {{ . | quote }}
+{{- end }}
+  {{- end }}
   ports:
   - name: http
     port: {{ .http.port }}
diff --git a/helm-charts/gerrit-replica/templates/git-backend.service.yaml b/helm-charts/gerrit-replica/templates/git-backend.service.yaml
index 8a8c7a4..503d777 100644
--- a/helm-charts/gerrit-replica/templates/git-backend.service.yaml
+++ b/helm-charts/gerrit-replica/templates/git-backend.service.yaml
@@ -14,6 +14,12 @@
   {{- end }}
 spec:
   {{ with .Values.gitBackend.service }}
+  {{- if .loadBalancerSourceRanges -}}
+  loadBalancerSourceRanges:
+{{- range .loadBalancerSourceRanges }}
+    - {{ . | quote }}
+{{- end }}
+  {{- end }}
   ports:
   - name: http
     port: {{ .http.port }}
diff --git a/helm-charts/gerrit-replica/values.yaml b/helm-charts/gerrit-replica/values.yaml
index 2ac7e6d..cf5c9fd 100644
--- a/helm-charts/gerrit-replica/values.yaml
+++ b/helm-charts/gerrit-replica/values.yaml
@@ -217,6 +217,7 @@
 
   service:
     additionalAnnotations: {}
+    loadBalancerSourceRanges: []
     type: NodePort
     externalTrafficPolicy: Cluster
     http:
@@ -308,6 +309,7 @@
 
   service:
     additionalAnnotations: {}
+    loadBalancerSourceRanges: []
     type: NodePort
     externalTrafficPolicy: Cluster
     http:
diff --git a/helm-charts/gerrit/README.md b/helm-charts/gerrit/README.md
index 5c7627f..c7ef97c 100644
--- a/helm-charts/gerrit/README.md
+++ b/helm-charts/gerrit/README.md
@@ -303,6 +303,7 @@
 | `gerrit.networkPolicy.ingress` | Custom ingress-network policy for gerrit pods | `nil` |
 | `gerrit.networkPolicy.egress` | Custom egress-network policy for gerrit pods | `nil` |
 | `gerrit.service.additionalAnnotations` | Additional annotations for the Service | `{}` |
+| `gerrit.service.loadBalancerSourceRanges` | The list of allowed IPs for the Service | `[]` |
 | `gerrit.service.type` | Which kind of Service to deploy | `NodePort` |
 | `gerrit.service.externalTrafficPolicy` | Specify how traffic from external is handled | `Cluster` |
 | `gerrit.service.http.port` | Port over which to expose HTTP | `80` |
diff --git a/helm-charts/gerrit/templates/gerrit.service.yaml b/helm-charts/gerrit/templates/gerrit.service.yaml
index b7c5819..11873ed 100644
--- a/helm-charts/gerrit/templates/gerrit.service.yaml
+++ b/helm-charts/gerrit/templates/gerrit.service.yaml
@@ -14,6 +14,12 @@
   {{- end }}
 spec:
   {{ with .Values.gerrit.service }}
+  {{- if .loadBalancerSourceRanges -}}
+  loadBalancerSourceRanges:
+{{- range .loadBalancerSourceRanges }}
+    - {{ . | quote }}
+{{- end }}
+  {{- end }}
   ports:
   - name: http
     port: {{ .http.port }}
diff --git a/helm-charts/gerrit/values.yaml b/helm-charts/gerrit/values.yaml
index 0397315..24992b1 100644
--- a/helm-charts/gerrit/values.yaml
+++ b/helm-charts/gerrit/values.yaml
@@ -198,6 +198,7 @@
 
   service:
     additionalAnnotations: {}
+    loadBalancerSourceRanges: []
     type: NodePort
     externalTrafficPolicy: Cluster
     http: