Skip to content

Commit

Permalink
Adding keepalive for nginx to better handle backend connections (#58)
Browse files Browse the repository at this point in the history
* Updated with config for keepalive

* Updated to always enable keepalive

* Updated to always enable keepalive

* Updated minor chart version to 0.2.0
  • Loading branch information
oybed authored Aug 4, 2023
1 parent c3411d8 commit 35a0e65
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion charts/ocp-proxy-api/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: ocp-proxy-api
description: A Helm chart for Kubernetes to create and manage an nginx proxy for OCP API/Console
type: application
version: 0.1.3
version: 0.2.0
home: "https://rh-mobb.github.io/helm-charts/"
maintainers:
- name: rh-mobb
12 changes: 11 additions & 1 deletion charts/ocp-proxy-api/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,11 @@ data:
}
upstream api_backend {
server apiserver.openshift-kube-apiserver:443;
keepalive {{ .Values.keepalive.connections }};
}
upstream ingress_backend {
server {{ .Values.ocp.ingressLB }}:443;
keepalive {{ .Values.keepalive.connections }};
}
server {
Expand All @@ -64,6 +65,15 @@ data:
{{- end }}
proxy_pass $name;
# Setting these keepalive parameters based on official docs.
# This avoids closing each connection and hence avoids exhausting the available resources
# https://nginx.org/en/docs/http/ngx_http_upstream_module.html#keepalive
# and here:
# https://www.nginx.com/blog/avoiding-top-10-nginx-configuration-mistakes/#no-keepalives
proxy_http_version 1.1;
proxy_set_header Connection "";
ssl_preread on;
}
}
5 changes: 5 additions & 0 deletions charts/ocp-proxy-api/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,8 @@ nodeSelector: {}
tolerations: []

affinity: {}

keepalive:
# A good starting point for 'connections' is to set this to "(replicaCount * 2) + replicaCount"
# e.g.: (1 x 2) + 1 = 3
connections: 3

0 comments on commit 35a0e65

Please sign in to comment.