Skip to content

Commit

Permalink
Add loadBalancerSourceRanges to helm parameters (#2773)
Browse files Browse the repository at this point in the history
Add loadBalancerSourceRanges to helm parameters

Problem: Users need a way to provide the loadBalancerSourceRanges to restrict IPs that can access the load balancer.

Solution: Added a helm parameter to specify loadBalancerSourceRanges during helm install/upgrade
  • Loading branch information
salonichf5 authored Nov 15, 2024
1 parent e7d217a commit 1f60f9e
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
1 change: 1 addition & 0 deletions charts/nginx-gateway-fabric/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ The following table lists the configurable parameters of the NGINX Gateway Fabri
| `service.create` | Creates a service to expose the NGINX Gateway Fabric pods. | bool | `true` |
| `service.externalTrafficPolicy` | The externalTrafficPolicy of the service. The value Local preserves the client source IP. | string | `"Local"` |
| `service.loadBalancerIP` | The static IP address for the load balancer. Requires service.type set to LoadBalancer. | string | `""` |
| `service.loadBalancerSourceRanges` | The IP ranges (CIDR) that are allowed to access the load balancer. Requires service.type set to LoadBalancer. | list | `[]` |
| `service.ports` | A list of ports to expose through the NGINX Gateway Fabric service. Update it to match the listener ports from your Gateway resource. Follows the conventional Kubernetes yaml syntax for service ports. | list | `[{"name":"http","port":80,"protocol":"TCP","targetPort":80},{"name":"https","port":443,"protocol":"TCP","targetPort":443}]` |
| `service.type` | The type of service to create for the NGINX Gateway Fabric. | string | `"LoadBalancer"` |
| `serviceAccount.annotations` | Set of custom annotations for the NGINX Gateway Fabric service account. | object | `{}` |
Expand Down
8 changes: 7 additions & 1 deletion charts/nginx-gateway-fabric/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,14 @@ spec:
{{- end }}
{{- end }}
type: {{ .Values.service.type }}
{{- if and (eq .Values.service.type "LoadBalancer") .Values.service.loadBalancerIP }}
{{- if eq .Values.service.type "LoadBalancer" }}
{{- if .Values.service.loadBalancerIP }}
loadBalancerIP: {{ .Values.service.loadBalancerIP }}
{{- end }}
{{- if .Values.service.loadBalancerSourceRanges }}
loadBalancerSourceRanges:
{{ toYaml .Values.service.loadBalancerSourceRanges | nindent 2 }}
{{- end }}
{{- end}}
selector:
{{- include "nginx-gateway.selectorLabels" . | nindent 4 }}
Expand Down
9 changes: 9 additions & 0 deletions charts/nginx-gateway-fabric/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,15 @@
"title": "loadBalancerIP",
"type": "string"
},
"loadBalancerSourceRanges": {
"description": "The IP ranges (CIDR) that are allowed to access the load balancer. Requires service.type set to LoadBalancer.",
"items": {
"required": []
},
"required": [],
"title": "loadBalancerSourceRanges",
"type": "array"
},
"ports": {
"description": "A list of ports to expose through the NGINX Gateway Fabric service. Update it to match the listener ports from\nyour Gateway resource. Follows the conventional Kubernetes yaml syntax for service ports.",
"items": {
Expand Down
3 changes: 3 additions & 0 deletions charts/nginx-gateway-fabric/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,9 @@ service:
# -- The static IP address for the load balancer. Requires service.type set to LoadBalancer.
loadBalancerIP: ""

# -- The IP ranges (CIDR) that are allowed to access the load balancer. Requires service.type set to LoadBalancer.
loadBalancerSourceRanges: []

# @schema
# type: array
# items:
Expand Down

0 comments on commit 1f60f9e

Please sign in to comment.