diff --git a/deployment/services/proxy.ts b/deployment/services/proxy.ts index 3112fc113..c08af7600 100644 --- a/deployment/services/proxy.ts +++ b/deployment/services/proxy.ts @@ -102,6 +102,7 @@ export function deployProxy({ path: '/usage', service: usage.service, retriable: true, + loadBalancerPolicy: 'WeightedLeastRequest', }, ]) .registerService({ record: environment.apiDns }, [ diff --git a/deployment/utils/reverse-proxy.ts b/deployment/utils/reverse-proxy.ts index 6599b2638..ad76da27d 100644 --- a/deployment/utils/reverse-proxy.ts +++ b/deployment/utils/reverse-proxy.ts @@ -84,6 +84,12 @@ export class Proxy { requestTimeout?: `${number}s` | 'infinity'; idleTimeout?: `${number}s`; retriable?: boolean; + loadBalancerPolicy?: + | 'WeightedLeastRequest' + | 'RoundRobin' + | 'Random' + | 'RequestHash' + | 'Cookie'; customRewrite?: string; virtualHost?: Output; httpsUpstream?: boolean; @@ -153,9 +159,9 @@ export class Proxy { port: route.service.spec.ports[0].port, }, ], - // https://projectcontour.io/docs/1.29/config/request-routing/#session-affinity + // https://projectcontour.io/docs/1.31/config/request-routing/ loadBalancerPolicy: { - strategy: 'Cookie', + strategy: route.loadBalancerPolicy ?? 'RoundRobin', }, // https://projectcontour.io/docs/1.29/config/rate-limiting/#local-rate-limiting rateLimitPolicy: route.rateLimit