Skip to content

Commit

Permalink
feat(nginx): add ipFamilies option for IPv4 and IPv6
Browse files Browse the repository at this point in the history
Signed-off-by: Mathieu Dallaire <[email protected]>
  • Loading branch information
mdallaire committed Sep 30, 2024
1 parent feaf104 commit 0bb4fbc
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion charts/nextcloud/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
name: nextcloud
version: 6.0.3
version: 6.1.0
appVersion: 30.0.0
description: A file sharing server that puts the control and security of your own data back into your hands.
keywords:
Expand Down
1 change: 1 addition & 0 deletions charts/nextcloud/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ The following table lists the configurable parameters of the nextcloud chart and
| `nginx.image.pullPolicy` | nginx Image pull policy | `IfNotPresent` |
| `nginx.image.pullPolicy` | nginx Image pull policy | `IfNotPresent` |
| `nginx.containerPort` | Customize container port e.g. when not running as root | `IfNotPresent` |
| `nginx.ipFamilies` | Customize container to listen on IPv4, IPv6 or both | `["IPv4"]` |
| `nginx.config.default` | Whether to use nextcloud's recommended nginx config | `true` |
| `nginx.config.custom` | Specify a custom config for nginx | `{}` |
| `nginx.resources` | nginx resources | `{}` |
Expand Down
11 changes: 10 additions & 1 deletion charts/nextcloud/files/nginx.config.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,16 @@ upstream php-handler {
}

server {
{{- if and (has "IPv4" .Values.nginx.ipFamilies) (has "IPv6" .Values.nginx.ipFamilies) }}
# Both IPv4 and IPv6 are enabled
listen [::]:{{ .Values.nginx.containerPort }} ipv6only=off;
{{- else if and (not (has "IPv4" .Values.nginx.ipFamilies)) (has "IPv6" .Values.nginx.ipFamilies) }}
# Only IPv6 is enabled
listen [::]:{{ .Values.nginx.containerPort }};
{{- else }}
# Default, IPv4 only
listen {{ .Values.nginx.containerPort }};
{{- end }}

# HSTS settings
# WARNING: Only add the preload option once you read about
Expand Down Expand Up @@ -48,7 +57,7 @@ server {
include mime.types;
types {
text/javascript js mjs;
}
}

# Path to the root of your installation
root /var/www/html;
Expand Down
5 changes: 4 additions & 1 deletion charts/nextcloud/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,10 @@ nginx:
pullPolicy: IfNotPresent

containerPort: 80

# This configures nginx to listen on either IPv4, IPv6 or both
ipFamilies:
- IPv4
# - IPv6
config:
# This generates the default nginx config as per the nextcloud documentation
default: true
Expand Down

0 comments on commit 0bb4fbc

Please sign in to comment.