From 13767d6f54f79e0b5c5edce7e9601628a379aa51 Mon Sep 17 00:00:00 2001 From: Niraj Yadav Date: Mon, 9 Dec 2024 17:51:58 +0530 Subject: [PATCH] cephfs: use userid and keys for provisioning This patch modifies the code to use userID and userKey for provisioning of both static and dynamic PVs. In case user credentials are not found admin credentials are used as a fallback and for backwards compatibility. Signed-off-by: Niraj Yadav --- internal/util/credentials.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/internal/util/credentials.go b/internal/util/credentials.go index fae403c23..091efe3e0 100644 --- a/internal/util/credentials.go +++ b/internal/util/credentials.go @@ -20,6 +20,8 @@ import ( "errors" "fmt" "os" + + "github.com/ceph/ceph-csi/internal/util/log" ) const ( @@ -110,6 +112,12 @@ func NewUserCredentials(secrets map[string]string) (*Credentials, error) { // NewAdminCredentials creates new admin credentials from secret. func NewAdminCredentials(secrets map[string]string) (*Credentials, error) { + // Use userID and userKey if found else fallback to adminID and adminKey + if cred, err := newCredentialsFromSecret(credUserID, credUserKey, secrets); err == nil { + return cred, nil + } + log.WarningLogMsg("adminID and adminKey are deprecated, please use userID and userKey instead") + return newCredentialsFromSecret(credAdminID, credAdminKey, secrets) }