Skip to content

Commit 4e261e3

Browse files
committed
entrypoint: Set a flag to add local gateway IP to LOADBALANCER_IPS.
This is helpful for Kubernetes, where the health checks will be NAT'd to come from the local network gateway.
1 parent c236084 commit 4e261e3

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

entrypoint.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ DISABLE_HTTPS="${DISABLE_HTTPS:-false}"
3030
NGINX_WORKERS="${NGINX_WORKERS:-2}"
3131
NGINX_PROXY_BUFFERING="${NGINX_PROXY_BUFFERING:-off}"
3232
NGINX_MAX_UPLOAD_SIZE="${NGINX_MAX_UPLOAD_SIZE:-80m}"
33+
TRUST_GATEWAY_IP="${TRUST_GATEWAY_IP:-False}"
3334
# Zulip certificate parameters
3435
SSL_CERTIFICATE_GENERATION="${SSL_CERTIFICATE_GENERATION:self-signed}"
3536
# Zulip related settings
@@ -141,6 +142,11 @@ puppetConfiguration() {
141142
crudini --set /etc/zulip/zulip.conf application_server queue_workers_multiprocess false
142143
fi
143144

145+
if [ "$TRUST_GATEWAY_IP" == "True" ] || [ "$TRUST_GATEWAY_IP" == "true" ]; then
146+
GATEWAY_IP=$(ip route | grep default | awk '{print $3}')
147+
echo "Trusting local network gateway $GATEWAY_IP"
148+
LOADBALANCER_IPS="${LOADBALANCER_IPS:+$LOADBALANCER_IPS,}$GATEWAY_IP"
149+
fi
144150
if [ -n "$LOADBALANCER_IPS" ]; then
145151
echo "Setting IPs for load balancer"
146152
crudini --set /etc/zulip/zulip.conf loadbalancer ips "${LOADBALANCER_IPS}"

0 commit comments

Comments
 (0)