forked from hpi-schul-cloud/jitsi-deployment
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathhaproxy-configmap.yaml
More file actions
70 lines (64 loc) · 2.36 KB
/
haproxy-configmap.yaml
File metadata and controls
70 lines (64 loc) · 2.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# This ConfigMaps defines the configuration of HAProxy. It enables
# 1. sticky tables using URL parameter room for load-balancing (backend jitsi-meet)
# 2. DNS resolving of web containers for all shards (resolvers kube-dns)
# 3. peering between the HAProxy instances using the environment variables exported at start of container
# (see command of haproxy pod) (peers mypeers)
# 4. exporting of metrics usable by Prometheus and reachable stats frontend on port 9090 (frontend stats)
kind: ConfigMap
apiVersion: v1
metadata:
namespace: jitsi
name: haproxy-config
data:
haproxy.cfg: |
global
# log to stdout
log stdout format raw local0 info
# enable stats socket for dynamic configuration and status retrieval
stats socket ipv4@127.0.0.1:9999 level admin
stats socket /var/run/hapee-lb.sock mode 666 level admin
stats timeout 2m
defaults
log global
option httplog
retries 3
maxconn 2000
timeout connect 5s
timeout client 50s
timeout server 50s
resolvers kube-dns
# kubernetes DNS is defined in resolv.conf
parse-resolv-conf
hold valid 10s
frontend http_in
bind *:80
mode http
option forwardfor
option http-keep-alive
default_backend jitsi-meet
# expose statistics in Prometheus format
frontend stats
mode http
bind *:9090
option http-use-htx
http-request use-service prometheus-exporter if { path /metrics }
stats enable
stats uri /stats
stats refresh 10s
peers mypeers
log stdout format raw local0 info
peer "${HOSTNAME}" "${MY_POD_IP}:1024"
peer "${OTHER_HOSTNAME}" "${OTHER_IP}:1024"
backend jitsi-meet
balance roundrobin
mode http
option forwardfor
http-reuse safe
http-request set-header Room %[urlp(room)]
acl room_found urlp(room) -m found
stick-table type string len 128 size 2k expire 1d peers mypeers
stick on hdr(Room) if room_found
# _http._tcp.web.jitsi.svc.cluster.local:80 is a SRV DNS record
# A records don't work here because their order might change between calls and would result in different
# shard IDs for each peered HAproxy
server-template shard 0-5 _http._tcp.web.jitsi.svc.cluster.local:80 check resolvers kube-dns init-addr none