From 0a2b4e67e146db0bd20e8f69240f61df8ddc9d90 Mon Sep 17 00:00:00 2001 From: XAMPPRocky <4464295+XAMPPRocky@users.noreply.github.com> Date: Wed, 1 Nov 2023 18:26:37 +0100 Subject: [PATCH] Update kubernetes watch configuration to prioritise performance (#844) --- src/config/providers/k8s.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/config/providers/k8s.rs b/src/config/providers/k8s.rs index 08789ed128..6522e6c9b0 100644 --- a/src/config/providers/k8s.rs +++ b/src/config/providers/k8s.rs @@ -82,7 +82,16 @@ fn gameserver_events( let gameservers_namespace = namespace.as_ref(); let gameservers: kube::Api = kube::Api::namespaced(client, gameservers_namespace); let gs_writer = kube::runtime::reflector::store::Writer::::default(); - let gameserver_stream = kube::runtime::watcher(gameservers, <_>::default()); + let mut config = kube::runtime::watcher::Config::default() + // Default timeout is 5 minutes, far too slow for us to react. + .timeout(15) + // Use `Any` as we care about speed more than consistency. + .any_semantic(); + + // Retreive unbounded results. + config.page_size = None; + + let gameserver_stream = kube::runtime::watcher(gameservers, config); kube::runtime::reflector(gs_writer, gameserver_stream) }