Skip to content

Commit f9fa98c

Browse files
authored
Support provisioning of Gateway(s) in helm chart (#3399)
Support provisioning of Gateway(s) in helm chart. Problem: Users would like to provision a Gateway through the helm chart. Solution: Support provisioning of Gateway(s) in helm chart. Testing: Manually tested templating and installation of an example values.yaml file.
1 parent 807ff92 commit f9fa98c

File tree

5 files changed

+84
-4
lines changed

5 files changed

+84
-4
lines changed

charts/nginx-gateway-fabric/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,8 @@ being performed on NGF), you may need to configure delayed termination on the NG
214214

215215
> [!NOTE]
216216
>
217-
> More information on container lifecycle hooks can be found
218-
> [here](https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks) and a detailed
217+
> More information on container lifecycle hooks can be found in the official
218+
> [kubernetes documentation](https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks) and a detailed
219219
> description of Pod termination behavior can be found in
220220
> [Termination of Pods](https://kubernetes.io/docs/concepts/workloads/Pods/Pod-lifecycle/#Pod-termination).
221221

@@ -258,6 +258,7 @@ The following table lists the configurable parameters of the NGINX Gateway Fabri
258258
| `certGenerator.overwrite` | Overwrite existing TLS Secrets on startup. | bool | `false` |
259259
| `certGenerator.serverTLSSecretName` | The name of the Secret containing TLS CA, certificate, and key for the NGINX Gateway Fabric control plane to securely communicate with the NGINX Agent. Must exist in the same namespace that the NGINX Gateway Fabric control plane is running in (default namespace: nginx-gateway). | string | `"server-tls"` |
260260
| `clusterDomain` | The DNS cluster domain of your Kubernetes cluster. | string | `"cluster.local"` |
261+
| `gateways` | A list of Gateway objects. View https://gateway-api.sigs.k8s.io/reference/spec/#gateway for full Gateway reference. | list | `[]` |
261262
| `nginx` | The nginx section contains the configuration for all NGINX data plane deployments installed by the NGINX Gateway Fabric control plane. | object | `{"config":{},"container":{},"debug":false,"image":{"pullPolicy":"Always","repository":"ghcr.io/nginx/nginx-gateway-fabric/nginx","tag":"edge"},"imagePullSecret":"","imagePullSecrets":[],"kind":"deployment","plus":false,"pod":{},"replicas":1,"service":{"externalTrafficPolicy":"Local","loadBalancerClass":"","loadBalancerIP":"","loadBalancerSourceRanges":[],"nodePorts":[],"type":"LoadBalancer"},"usage":{"caSecretName":"","clientSSLSecretName":"","endpoint":"","resolver":"","secretName":"nplus-license","skipVerify":false}}` |
262263
| `nginx.config` | The configuration for the data plane that is contained in the NginxProxy resource. This is applied globally to all Gateways managed by this instance of NGINX Gateway Fabric. | object | `{}` |
263264
| `nginx.container` | The container configuration for the NGINX container. This is applied globally to all Gateways managed by this instance of NGINX Gateway Fabric. | object | `{}` |

charts/nginx-gateway-fabric/README.md.gotmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,8 @@ being performed on NGF), you may need to configure delayed termination on the NG
212212

213213
> [!NOTE]
214214
>
215-
> More information on container lifecycle hooks can be found
216-
> [here](https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks) and a detailed
215+
> More information on container lifecycle hooks can be found in the official
216+
> [kubernetes documentation](https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks) and a detailed
217217
> description of Pod termination behavior can be found in
218218
> [Termination of Pods](https://kubernetes.io/docs/concepts/workloads/Pods/Pod-lifecycle/#Pod-termination).
219219

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{{- range .Values.gateways }}
2+
---
3+
apiVersion: gateway.networking.k8s.io/v1
4+
kind: Gateway
5+
metadata:
6+
name: {{ default "gateway" .name }}
7+
{{- with .namespace }}
8+
namespace: {{ .}}
9+
{{- end }}
10+
{{- with .labels }}
11+
labels:
12+
{{- toYaml . | nindent 4 }}
13+
{{- end }}
14+
{{- with .annotations }}
15+
annotations:
16+
{{- toYaml . | nindent 4 }}
17+
{{- end }}
18+
spec:
19+
gatewayClassName: {{ default "nginx" .spec.gatewayClassName }}
20+
{{- with .spec.infrastructure }}
21+
infrastructure:
22+
{{- toYaml . | nindent 4 }}
23+
{{- end }}
24+
listeners:
25+
{{- range $listener := .spec.listeners }}
26+
- name: {{ $listener.name }}
27+
{{- with $listener.hostname }}
28+
hostname: {{ . | toYaml }}
29+
{{- end }}
30+
port: {{ $listener.port }}
31+
protocol: {{ $listener.protocol }}
32+
{{- with $listener.allowedRoutes }}
33+
allowedRoutes:
34+
{{- toYaml . | nindent 8 }}
35+
{{- end }}
36+
{{- with $listener.tls }}
37+
tls:
38+
{{- toYaml . | nindent 8 }}
39+
{{- end}}
40+
{{- end }}
41+
{{- end }}

charts/nginx-gateway-fabric/values.schema.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,15 @@
4343
"title": "clusterDomain",
4444
"type": "string"
4545
},
46+
"gateways": {
47+
"description": "A list of Gateway objects. View https://gateway-api.sigs.k8s.io/reference/spec/#gateway for full Gateway reference.",
48+
"items": {
49+
"required": []
50+
},
51+
"required": [],
52+
"title": "gateways",
53+
"type": "array"
54+
},
4655
"global": {
4756
"description": "Global values are values that can be accessed from any chart or subchart by exactly the same name.",
4857
"required": [],

charts/nginx-gateway-fabric/values.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -477,3 +477,32 @@ certGenerator:
477477

478478
# -- Overwrite existing TLS Secrets on startup.
479479
overwrite: false
480+
481+
# -- A list of Gateway objects. View https://gateway-api.sigs.k8s.io/reference/spec/#gateway for full Gateway reference.
482+
gateways: []
483+
484+
# Example gateway object:
485+
# name: nginx-gateway
486+
# namespace: default
487+
# labels:
488+
# key: value
489+
# annotations:
490+
# annotationKey: annotationValue
491+
# spec:
492+
# gatewayClassName: nginx
493+
# infrastructure:
494+
# annotations:
495+
# service.annotations.networking.gke.io/load-balancer-type: Internal
496+
# listeners:
497+
# - name: https
498+
# port: 80
499+
# protocol: HTTPS
500+
# tls:
501+
# mode: Terminate
502+
# certificateRefs:
503+
# - kind: Secret
504+
# name: my-secret
505+
# namespace: certificate
506+
# allowedRoutes:
507+
# namespaces:
508+
# from: Same

0 commit comments

Comments
 (0)