RouteFilter to Set Load Balancing Policy
On this page
RouteFilter for Load Balancing Policy
route_filter_lb (policy: ring_hash_cookie)
Filter Config
apiVersion: enroute.saaras.io/v1
kind: RouteFilter
metadata:
name: ring-hash-cookie
namespace: httpbin
spec:
name: ring-hash-cookie
type: route_filter_lb
routeFilterConfig:
config: |
{
"policy" : "ring_hash_cookie",
"cookie_hash" : {"name": "x-sticky-cookie", "ttl": "60s", "path" : "/" }
}
route_filter_lb (ring_hash_request)
Filter config
apiVersion: enroute.saaras.io/v1
kind: RouteFilter
metadata:
name: ring-hash-cookie
namespace: httpbin
spec:
name: ring-hash-cookie
routeFilterConfig:
config: |
{
"policy" : "ring_hash_request",
"request_hash_policies" : [{"terminal": false, "source_ip" : true }]
}
type: route_filter_lb
An example Route in a GatewayHost
that utilizes this is shown below -
GatewayHost config
apiVersion: enroute.saaras.io/v1
kind: GatewayHost
metadata:
name: httpbin-9000-gatewayhost-httpbin-host
namespace: httpbin
spec:
routes:
- conditions:
- prefix: /
filters:
- name: regex-rewrite-filter
type: route_filter_regex_rewrite
- name: add-set-remove-request-response-headers
type: route_filter_headers
- name: ring-hash-cookie
type: route_filter_lb
services:
- name: httpbin
port: 9000
virtualhost:
fqdn: '*'