1
0
mirror of https://github.com/ceph/ceph-csi.git synced 2024-12-20 03:50:24 +00:00

rbd: fix issue in ENV variable check

Currently cephcsi is returning an error
if the ENV variable is set, but it should not.
This commit fixes the the POD_NAMESPACE env
variable issue and as well as the KMS_CONFIG_NAME
ENV variable.

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
Madhu Rajanna 2021-01-28 11:44:24 +05:30 committed by mergify[bot]
parent 0b7521162c
commit 584a43dc2c

View File

@ -133,11 +133,11 @@ func GetKMS(tenant, kmsID string, secrets map[string]string) (EncryptionKMS, err
// If the configmap is not mounted to the CSI pods read the configmap // If the configmap is not mounted to the CSI pods read the configmap
// the kubernetes. // the kubernetes.
namespace := os.Getenv(podNamespace) namespace := os.Getenv(podNamespace)
if namespace != "" { if namespace == "" {
return nil, fmt.Errorf("%q is not set", podNamespace) return nil, fmt.Errorf("%q is not set", podNamespace)
} }
name := os.Getenv(kmsConfigMapName) name := os.Getenv(kmsConfigMapName)
if name != "" { if name == "" {
name = defaultConfigMapToRead name = defaultConfigMapToRead
} }
config, err = getVaultConfiguration(namespace, name) config, err = getVaultConfiguration(namespace, name)