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
  • Loading branch information
mdallaire committed Sep 30, 2024
1 parent 27577c8 commit e4c6e18
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion charts/nextcloud/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +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.ipFamily` | Customize container to listen on IPv4, IPv6 or both | `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
8 changes: 4 additions & 4 deletions charts/nextcloud/files/nginx.config.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ upstream php-handler {
}

server {
{{- if and (not (has "IPv4" .Values.nginx.ipFamily)) (has "IPv6" .Values.nginx.ipFamily) }}
# Only IPv6 is enabled
listen [::]:{{ .Values.nginx.containerPort }};
{{- else if and (has "IPv4" .Values.nginx.ipFamily) (has "IPv6" .Values.nginx.ipFamily) }}
{{- 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 }};
Expand Down
2 changes: 1 addition & 1 deletion charts/nextcloud/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ nginx:

containerPort: 80
# This configures nginx to listen on either IPv4, IPv6 or both
ipFamily:
ipFamilies:
- IPv4
# - IPv6
config:
Expand Down

0 comments on commit e4c6e18

Please sign in to comment.