haproxy.cfg.j2 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. # Global settings
  2. #---------------------------------------------------------------------
  3. global
  4. maxconn {{ openshift_loadbalancer_global_maxconn | default(20000) }}
  5. log /dev/log local0 info
  6. chroot /var/lib/haproxy
  7. pidfile /var/run/haproxy.pid
  8. user haproxy
  9. group haproxy
  10. daemon
  11. # turn on stats unix socket
  12. stats socket /var/lib/haproxy/stats
  13. #---------------------------------------------------------------------
  14. # common defaults that all the 'listen' and 'backend' sections will
  15. # use if not designated in their block
  16. #---------------------------------------------------------------------
  17. defaults
  18. mode http
  19. log global
  20. option httplog
  21. option dontlognull
  22. # option http-server-close
  23. option forwardfor except 127.0.0.0/8
  24. option redispatch
  25. retries 3
  26. timeout http-request 10s
  27. timeout queue 1m
  28. timeout connect 10s
  29. timeout client 300s
  30. timeout server 300s
  31. timeout http-keep-alive 10s
  32. timeout check 10s
  33. maxconn {{ openshift_loadbalancer_default_maxconn | default(20000) }}
  34. listen stats
  35. bind :9000
  36. mode http
  37. stats enable
  38. stats uri /
  39. {% for frontend in openshift_loadbalancer_frontends %}
  40. frontend {{ frontend.name }}
  41. {% for bind in frontend.binds %}
  42. bind {{ bind }}
  43. {% endfor %}
  44. default_backend {{ frontend.default_backend }}
  45. {% if 'mode' in frontend %}
  46. mode {{ frontend.mode }}
  47. {% endif %}
  48. {% if 'options' in frontend %}
  49. {% for option in frontend.options %}
  50. option {{ option }}
  51. {% endfor %}
  52. {% endif %}
  53. {% if 'redirects' in frontend %}
  54. {% for redirect in frontend.redirects %}
  55. redirect {{ redirect }}
  56. {% endfor %}
  57. {% endif %}
  58. {% endfor %}
  59. {% for backend in openshift_loadbalancer_backends %}
  60. backend {{ backend.name }}
  61. balance {{ backend.balance }}
  62. {% if 'mode' in backend %}
  63. mode {{ backend.mode }}
  64. {% endif %}
  65. {% if 'options' in backend %}
  66. {% for option in backend.options %}
  67. option {{ option }}
  68. {% endfor %}
  69. {% endif %}
  70. {% for server in backend.servers %}
  71. server {{ server.name }} {{ server.address }} {{ server.opts }}
  72. {% endfor %}
  73. {% endfor %}