Skip to content

Commit

Permalink
Merge pull request #5 from zerotier/proxy-timeout
Browse files Browse the repository at this point in the history
set proxy & send timeouts
  • Loading branch information
glimberg authored Jan 31, 2024
2 parents dc834ab + e8f4f4f commit 49640f6
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion charts/zerotier-ingress-helm/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.1
version: 0.1.2

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
1 change: 1 addition & 0 deletions charts/zerotier-ingress-helm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Create your values.yaml file. The following fields are required:
| ---------- | ----------- |
| nginx.listenPort | The port Nginx is configured to listen on (default 8000) |
| nginx.proxyAddress | The URL of the upstream service. (ex: `http://my-service.my-namespace.svc.cluster.local:1234`) |
| nginx.proxyTimeout | The timeout (in seconds) for prosied requests (default 60) |
| zerotier.identity.public | The public ZeroTier identity. Use `zerotier-idtool` to generate an identity on a per-ingress basis.|
| zerotier.identity.secret | The secret ZeroTier identity. Use `zerotier-idtool` to generate an identity on a per-ingress basis.|
| zerotier.networkID | The network ID the ZeroTier instance will connect to. |
Expand Down
2 changes: 2 additions & 0 deletions charts/zerotier-ingress-helm/docker/default.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@ server {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout $NGINX_PROXY_READ_TIMEOUT;
send_timeout $NGINX_PROXY_READ_TIMEOUT;
}
}
4 changes: 3 additions & 1 deletion charts/zerotier-ingress-helm/docker/entrypoint-ztnginx.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
#!/usr/bin/env bash

NGINX_LISTEN_PORT="${NGINX_LISTEN_PORT:-8000}"
NGINX_PROXY_READ_TIMEOUT=${NGINX_PROXY_READ_TIMEOUT:-60}


if [ -z "$NGINX_PROXY_ADDRESS" ]; then
echo "Error: NGINX_PROXY_ADDRESS environment variable is not set"
exit 1
fi

envsubst '$NGINX_LISTEN_PORT,$NGINX_PROXY_ADDRESS' < /default.conf.template > /etc/nginx/conf.d/default.conf
envsubst '$NGINX_LISTEN_PORT,$NGINX_PROXY_ADDRESS,$NGINX_PROXY_READ_TIMEOUT' < /default.conf.template > /etc/nginx/conf.d/default.conf

cat /etc/nginx/conf.d/default.conf

Expand Down
2 changes: 2 additions & 0 deletions charts/zerotier-ingress-helm/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ spec:
value: "{{ .Values.nginx.listenPort | default 8000 }}"
- name: NGINX_PROXY_ADDRESS
value: {{ .Values.nginx.proxyAddress }}
- name: NGINX_PROXY_READ_TIMEOUT
value: "{{ .Values.nginx.proxyTimeout | default 60 }}"
ports:
- name: http
containerPort: {{ .Values.nginx.listenPort }}
Expand Down
1 change: 1 addition & 0 deletions charts/zerotier-ingress-helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ nginx:
# Set the proxy address
# this should be the full host/port combination: http://someservice.mynamespace.svc.cluster.local:1234
proxyAddress: ""
proxyTimeout: 60

resources:
{}
Expand Down

0 comments on commit 49640f6

Please sign in to comment.