Skip to content
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

feat(nginx): add ipFamilies option for IPv4 and IPv6 #639

Merged
merged 1 commit into from
Oct 1, 2024
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
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