From 584a43dc2c1482c7f0d8cc23e2604f4205e9c4cc Mon Sep 17 00:00:00 2001 From: Madhu Rajanna Date: Thu, 28 Jan 2021 11:44:24 +0530 Subject: [PATCH] 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 --- internal/util/crypto.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/util/crypto.go b/internal/util/crypto.go index 787e79f78..44d3c1195 100644 --- a/internal/util/crypto.go +++ b/internal/util/crypto.go @@ -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 // the kubernetes. namespace := os.Getenv(podNamespace) - if namespace != "" { + if namespace == "" { return nil, fmt.Errorf("%q is not set", podNamespace) } name := os.Getenv(kmsConfigMapName) - if name != "" { + if name == "" { name = defaultConfigMapToRead } config, err = getVaultConfiguration(namespace, name)