diff --git a/pkg/volume/csi/csi_client.go b/pkg/volume/csi/csi_client.go index 1cff7b40ec..a712105b41 100644 --- a/pkg/volume/csi/csi_client.go +++ b/pkg/volume/csi/csi_client.go @@ -321,7 +321,10 @@ func newGrpcConn(driverName string) (*grpc.ClientConn, error) { addr := fmt.Sprintf(csiAddrTemplate, driverName) // TODO once KubeletPluginsWatcher graduates to beta, remove FeatureGate check if utilfeature.DefaultFeatureGate.Enabled(features.KubeletPluginsWatcher) { + csiDrivers.RLock() driver, ok := csiDrivers.driversMap[driverName] + csiDrivers.RUnlock() + if !ok { return nil, fmt.Errorf("driver name %s not found in the list of registered CSI drivers", driverName) }