Skip to content

Support provisioning of Gateway(s) in helm chart #3399

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions charts/nginx-gateway-fabric/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,8 @@ being performed on NGF), you may need to configure delayed termination on the NG

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

Expand Down Expand Up @@ -258,6 +258,7 @@ The following table lists the configurable parameters of the NGINX Gateway Fabri
| `certGenerator.overwrite` | Overwrite existing TLS Secrets on startup. | bool | `false` |
| `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"` |
| `clusterDomain` | The DNS cluster domain of your Kubernetes cluster. | string | `"cluster.local"` |
| `gateways` | A list of Gateway objects. View https://gateway-api.sigs.k8s.io/reference/spec/#gateway for full Gateway reference. | list | `[]` |
| `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}}` |
| `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 | `{}` |
| `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 | `{}` |
Expand Down
4 changes: 2 additions & 2 deletions charts/nginx-gateway-fabric/README.md.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,8 @@ being performed on NGF), you may need to configure delayed termination on the NG

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

Expand Down
41 changes: 41 additions & 0 deletions charts/nginx-gateway-fabric/templates/gateway.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{{- range .Values.gateways }}
---
apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
name: {{ default "gateway" .name }}
{{- with .namespace }}
namespace: {{ .}}
{{- end }}
{{- with .labels }}
labels:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
gatewayClassName: {{ default "nginx" .spec.gatewayClassName }}
{{- with .spec.infrastructure }}
infrastructure:
{{- toYaml . | nindent 4 }}
{{- end }}
listeners:
{{- range $listener := .spec.listeners }}
- name: {{ $listener.name }}
{{- with $listener.hostname }}
hostname: {{ . | toYaml }}
{{- end }}
port: {{ $listener.port }}
protocol: {{ $listener.protocol }}
{{- with $listener.allowedRoutes }}
allowedRoutes:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with $listener.tls }}
tls:
{{- toYaml . | nindent 8 }}
{{- end}}
{{- end }}
{{- end }}
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 @@ -43,6 +43,15 @@
"title": "clusterDomain",
"type": "string"
},
"gateways": {
"description": "A list of Gateway objects. View https://gateway-api.sigs.k8s.io/reference/spec/#gateway for full Gateway reference.",
"items": {
"required": []
},
"required": [],
"title": "gateways",
"type": "array"
},
"global": {
"description": "Global values are values that can be accessed from any chart or subchart by exactly the same name.",
"required": [],
Expand Down
29 changes: 29 additions & 0 deletions charts/nginx-gateway-fabric/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -477,3 +477,32 @@ certGenerator:

# -- Overwrite existing TLS Secrets on startup.
overwrite: false

# -- A list of Gateway objects. View https://gateway-api.sigs.k8s.io/reference/spec/#gateway for full Gateway reference.
gateways: []

# Example gateway object:
# name: nginx-gateway
# namespace: default
# labels:
# key: value
# annotations:
# annotationKey: annotationValue
# spec:
# gatewayClassName: nginx
# infrastructure:
# annotations:
# service.annotations.networking.gke.io/load-balancer-type: Internal
# listeners:
# - name: https
# port: 80
# protocol: HTTPS
# tls:
# mode: Terminate
# certificateRefs:
# - kind: Secret
# name: my-secret
# namespace: certificate
# allowedRoutes:
# namespaces:
# from: Same
Loading