From b599fb63b860163ff70866b2c58ea041a15ac741 Mon Sep 17 00:00:00 2001 From: Christian Artin Date: Thu, 30 Apr 2026 18:28:57 -0400 Subject: [PATCH] feat: expose configurable gRPC max receive message size Adds a --max-recv-message-size CLI flag (in MB, default 4) so users can raise the gRPC server limit when the function emits enough desired resources to exceed the default 4 MB cap, which otherwise causes XR reconciliation to fail with ResourceExhausted. Fixes #135 Signed-off-by: Christian Artin --- main.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/main.go b/main.go index 88db7c2..cb9204f 100644 --- a/main.go +++ b/main.go @@ -11,10 +11,11 @@ import ( type CLI struct { Debug bool `help:"Emit debug logs in addition to info logs." short:"d"` - Network string `default:"tcp" help:"Network on which to listen for gRPC connections."` - Address string `default:":9443" help:"Address at which to listen for gRPC connections."` - TLSCertsDir string `env:"TLS_SERVER_CERTS_DIR" help:"Directory containing server certs (tls.key, tls.crt) and the CA used to verify client certificates (ca.crt)"` - Insecure bool `help:"Run without mTLS credentials. If you supply this flag --tls-server-certs-dir will be ignored."` + Network string `default:"tcp" help:"Network on which to listen for gRPC connections."` + Address string `default:":9443" help:"Address at which to listen for gRPC connections."` + TLSCertsDir string `env:"TLS_SERVER_CERTS_DIR" help:"Directory containing server certs (tls.key, tls.crt) and the CA used to verify client certificates (ca.crt)"` + Insecure bool `help:"Run without mTLS credentials. If you supply this flag --tls-server-certs-dir will be ignored."` + MaxRecvMessageSize int `default:"4" help:"Maximum size of received messages in MB."` } // Run this Function. @@ -27,7 +28,8 @@ func (c *CLI) Run() error { return function.Serve(&Function{log: log}, function.Listen(c.Network, c.Address), function.MTLSCertificates(c.TLSCertsDir), - function.Insecure(c.Insecure)) + function.Insecure(c.Insecure), + function.MaxRecvMessageSize(c.MaxRecvMessageSize*1024*1024)) } func main() {