Skip to content

Commit 0ee87a5

Browse files
ixxeL2097Frederic Spiers
andauthored
feat(helm): add upstream nginx fine tuning configuration for fails and timeout (#53)
Co-authored-by: Frederic Spiers <[email protected]>
1 parent 44eba4b commit 0ee87a5

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

helm/ggbridge/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,9 @@ A Helm chart for installing ggbridge
178178
| proxy.updateStrategy.rollingUpdate.maxSurge | int | `1` | |
179179
| proxy.updateStrategy.rollingUpdate.maxUnavailable | int | `0` | |
180180
| proxy.updateStrategy.type | string | `"RollingUpdate"` | Customize updateStrategy |
181+
| proxy.upstream | object | `{"failTimeout":"5s","maxFails":1}` | Nginx upstream configuration |
182+
| proxy.upstream.failTimeout | string | `"5s"` | Time during which the specified number of unsuccessful attempts must happen to mark the server as unavailable |
183+
| proxy.upstream.maxFails | int | `1` | Maximum number of unsuccessful attempts to communicate with the server |
181184
| proxyProtocol.enabled | bool | `true` | When true, enables proxy protocol v2 for web/tls tunnels |
182185
| replicaCount | int | `1` | Number of pods for each deployment |
183186
| resources.limits | object | `{}` | Set container limits |

helm/ggbridge/files/proxy/nginx.conf

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
{{- $fullname := ternary (include "ggbridge.server.fullname" $context) (include "ggbridge.client.fullname" $context) (eq $context.Values.mode "server") -}}
77
{{- $ports := $context.Values.proxy.service.ports -}}
88
{{- $logLevel := $context.Values.proxy.logLevel -}}
9+
{{- $maxFails := $context.Values.proxy.upstream.maxFails | default 1 -}}
10+
{{- $failTimeout := $context.Values.proxy.upstream.failTimeout | default "5s" -}}
911

1012
load_module "/usr/lib/nginx/modules/ngx_stream_module.so";
1113

@@ -34,7 +36,7 @@ stream {
3436
{{- range $idx := until ($context.Values.deploymentCount | int) }}
3537
{{- $indexProxyFullname := printf "%s-proxy-%d" $fullname ($idx | int) }}
3638
{{- $weight := ternary 100 1 (eq $idx $index) }}
37-
{{ printf "server %s:%d weight=%d;" (printf "%s.%s.svc.%s" $indexProxyFullname $releaseNamespace $clusterDomain) ($config.port | int) $weight }}
39+
{{ printf "server %s:%d weight=%d max_fails=%v fail_timeout=%s;" (printf "%s.%s.svc.%s" $indexProxyFullname $releaseNamespace $clusterDomain) ($config.port | int) $weight $maxFails $failTimeout }}
3840
{{- end }}
3941
}
4042
{{ end }}

helm/ggbridge/values.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,13 @@ proxy:
395395
# -- Set proxy labels
396396
labels: {}
397397

398+
# -- Nginx upstream configuration
399+
upstream:
400+
# -- Maximum number of unsuccessful attempts to communicate with the server
401+
maxFails: 1
402+
# -- Time during which the specified number of unsuccessful attempts must happen to mark the server as unavailable
403+
failTimeout: 5s
404+
398405
# -- Set the Proxy DNS resolver
399406
resolver: kube-dns.kube-system.svc.cluster.local
400407

0 commit comments

Comments
 (0)