From f513b40670dffd7f9579cbb0aaac35460e412f99 Mon Sep 17 00:00:00 2001 From: Jan Safranek Date: Tue, 9 Jul 2024 13:21:30 +0200 Subject: [PATCH] Fix registrar timeout Use a background context for the registrar main function and not the context for GetDriverName that has 1 second timeout by default. The registrar should run forever and not for 1 second. --- cmd/csi-node-driver-registrar/main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/csi-node-driver-registrar/main.go b/cmd/csi-node-driver-registrar/main.go index be2b331d6..f50a6c0a0 100644 --- a/cmd/csi-node-driver-registrar/main.go +++ b/cmd/csi-node-driver-registrar/main.go @@ -178,10 +178,10 @@ func main() { } logger.V(1).Info("Calling CSI driver to discover driver name") - ctx, cancel := context.WithTimeout(ctx, *operationTimeout) + getNameCtx, cancel := context.WithTimeout(ctx, *operationTimeout) defer cancel() - csiDriverName, err := csirpc.GetDriverName(ctx, csiConn) + csiDriverName, err := csirpc.GetDriverName(getNameCtx, csiConn) if err != nil { logger.Error(err, "Error retreiving CSI driver name") klog.FlushAndExit(klog.ExitFlushTimeout, 1)