@@ -58,12 +58,14 @@ userlist {{ group.group }}
5858 {% endfor %}
5959{% endfor %}
6060
61+ {% if haproxy_lb_cache_enabled | default (false ) %}
6162cache global_cache
6263 total-max-size 512 # 512 MB
6364 max-object-size 102400 # 100 KB
6465 max-age 600 # Stay in cache for 10 minutes
6566 process-vary on
6667 max-secondary-entries 12
68+ {% endif %}
6769
6870listen stats
6971 bind 127.0.0.1:32700
@@ -216,7 +218,7 @@ frontend http
216218 {% if haproxy_lb_sites [site ].path is defined %}
217219 acl path_{{ site }} path -i -m beg {{ haproxy_lb_sites[site] .path }}
218220 {% endif %}
219- {% if haproxy_lb_sites [site ].use_cache is defined and haproxy_lb_sites [site ].use_cache == 'true' %}
221+ {% if ( haproxy_lb_cache_enabled | default ( false )) and haproxy_lb_sites [site ].use_cache is defined and haproxy_lb_sites [site ].use_cache == 'true' %}
220222 http-request cache-use global_cache if host_{{ site }}
221223 http-response cache-store global_cache if host_{{ site }}
222224 {% endif %}
@@ -263,7 +265,7 @@ frontend http
263265 {% if svc .metadata .annotations ["ethquokkaops.io/internal-only" ] is defined %}
264266 http-request deny if host_{{ cluster.item }}_{{ svc.metadata.namespace }}_{{ svc.metadata.name }}_{{ portname }} !{ src 10.128.0.0/9 }
265267 {% endif %}
266- {% if svc .metadata .annotations ["ethquokkaops.io/use_cache" ] is defined and svc .metadata .annotations ["ethquokkaops.io/use_cache" ] == 'true' %}
268+ {% if ( haproxy_lb_cache_enabled | default ( false )) and svc .metadata .annotations ["ethquokkaops.io/use_cache" ] is defined and svc .metadata .annotations ["ethquokkaops.io/use_cache" ] == 'true' %}
267269 http-request cache-use global_cache if host_{{ cluster.item }}_{{ svc.metadata.namespace }}_{{ svc.metadata.name }}_{{ portname }}
268270 http-response cache-store global_cache if host_{{ cluster.item }}_{{ svc.metadata.namespace }}_{{ svc.metadata.name }}_{{ portname }}
269271 {% endif %}
@@ -298,7 +300,7 @@ frontend http
298300 {% if svc .metadata .annotations ["ethquokkaops.io/internal-only" ] is defined %}
299301 http-request deny if { hdr(host) -i {{ domain }} } !{ src 10.128.0.0/9 }
300302 {% endif %}
301- {% if svc .metadata .annotations ["ethquokkaops.io/use_cache" ] is defined and svc .metadata .annotations ["ethquokkaops.io/use_cache" ] == 'true' %}
303+ {% if ( haproxy_lb_cache_enabled | default ( false )) and svc .metadata .annotations ["ethquokkaops.io/use_cache" ] is defined and svc .metadata .annotations ["ethquokkaops.io/use_cache" ] == 'true' %}
302304 http-request cache-use global_cache if host_{{ cluster.item }}_{{ svc.metadata.namespace }}_{{ svc.metadata.name }}
303305 http-response cache-store global_cache if host_{{ cluster.item }}_{{ svc.metadata.namespace }}_{{ svc.metadata.name }}
304306 {% endif %}
0 commit comments