From 333a126f63038d52fad1e306eff6ee4ef7f53948 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?p=C3=BDrus?= Date: Tue, 1 Oct 2024 15:39:50 +0200 Subject: [PATCH] [cinder-csi-plugin]: fix global config requirement for node-service (#2678) --- pkg/csi/cinder/openstack/openstack.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/csi/cinder/openstack/openstack.go b/pkg/csi/cinder/openstack/openstack.go index 6bcfe43762..4cccd2fb98 100644 --- a/pkg/csi/cinder/openstack/openstack.go +++ b/pkg/csi/cinder/openstack/openstack.go @@ -176,8 +176,8 @@ func CreateOpenStackProvider(cloudName string, noClient bool) (IOpenStack, error return nil, err } logcfg(cfg) - _, cloudNameDefined := cfg.Global[cloudName] - if !cloudNameDefined { + global := cfg.Global[cloudName] + if global == nil && !noClient { return nil, fmt.Errorf("GetConfigFromFiles cloud name \"%s\" not found in configuration files: %s", cloudName, configFiles) } @@ -196,14 +196,14 @@ func CreateOpenStackProvider(cloudName string, noClient bool) (IOpenStack, error return NoopInstances[cloudName], nil } - provider, err := client.NewOpenStackClient(cfg.Global[cloudName], "cinder-csi-plugin", userAgentData...) + provider, err := client.NewOpenStackClient(global, "cinder-csi-plugin", userAgentData...) if err != nil { return nil, err } epOpts := gophercloud.EndpointOpts{ - Region: cfg.Global[cloudName].Region, - Availability: cfg.Global[cloudName].EndpointType, + Region: global.Region, + Availability: global.EndpointType, } // Init Nova ServiceClient