From 2f38dace1e25d1ddf1a53d769c8757045091feb0 Mon Sep 17 00:00:00 2001 From: Kaustav Majumder Date: Mon, 22 Jul 2024 22:21:50 +0530 Subject: [PATCH] generated changes Signed-off-by: Kaustav Majumder --- controllers/storageconsumer/consumer_test.go | 27 ++++- .../storageconsumer_controller.go | 32 ++++++ .../ocs-operator/manifests/provider-role.yaml | 16 +++ services/provider/server/consumer.go | 47 -------- services/provider/server/server.go | 59 ++++------- services/provider/server/server_test.go | 100 ++++++++++-------- 6 files changed, 151 insertions(+), 130 deletions(-) diff --git a/controllers/storageconsumer/consumer_test.go b/controllers/storageconsumer/consumer_test.go index 51abe8391c..1da4055f30 100644 --- a/controllers/storageconsumer/consumer_test.go +++ b/controllers/storageconsumer/consumer_test.go @@ -19,6 +19,9 @@ package controllers import ( "testing" + noobaaApis "github.com/noobaa/noobaa-operator/v5/pkg/apis" + "github.com/noobaa/noobaa-operator/v5/pkg/apis/noobaa/v1alpha1" + routev1 "github.com/openshift/api/route/v1" v1 "github.com/red-hat-storage/ocs-operator/api/v4/v1" ocsv1alpha1 "github.com/red-hat-storage/ocs-operator/api/v4/v1alpha1" "github.com/red-hat-storage/ocs-operator/v4/controllers/util" @@ -46,7 +49,15 @@ func createFakeScheme(t *testing.T) *runtime.Scheme { err = rookCephv1.AddToScheme(scheme) if err != nil { - assert.Fail(t, "failed to add rookCephv1scheme") + assert.Fail(t, "failed to add rookCephv1 scheme") + } + err = routev1.AddToScheme(scheme) + if err != nil { + assert.Fail(t, "failed to add routev1 scheme") + } + err = noobaaApis.AddToScheme(scheme) + if err != nil { + assert.Fail(t, "failed to add nbapis scheme") } return scheme @@ -91,6 +102,14 @@ func TestCephName(t *testing.T) { Phase: "Ready", }, }, + Client: ocsv1alpha1.ClientStatus{ + ClusterID: "consumer", + }, + }, + } + r.noobaaAccount = &v1alpha1.NooBaaAccount{ + ObjectMeta: metav1.ObjectMeta{ + Name: "consumer-acc", }, } _, err := r.reconcilePhases() @@ -141,6 +160,12 @@ func TestCephName(t *testing.T) { }, }, } + r.noobaaAccount = &v1alpha1.NooBaaAccount{ + ObjectMeta: metav1.ObjectMeta{ + Name: "consumer-acc", + }, + } + _, err = r.reconcilePhases() assert.NoError(t, err) diff --git a/controllers/storageconsumer/storageconsumer_controller.go b/controllers/storageconsumer/storageconsumer_controller.go index 97de086029..7237466f2e 100644 --- a/controllers/storageconsumer/storageconsumer_controller.go +++ b/controllers/storageconsumer/storageconsumer_controller.go @@ -21,9 +21,11 @@ import ( "crypto/md5" "encoding/hex" "encoding/json" + "fmt" "github.com/go-logr/logr" "github.com/red-hat-storage/ocs-operator/api/v4/v1alpha1" + "github.com/red-hat-storage/ocs-operator/v4/controllers/util" rookCephv1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -36,6 +38,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/handler" "sigs.k8s.io/controller-runtime/pkg/predicate" + nbv1 "github.com/noobaa/noobaa-operator/v5/pkg/apis/noobaa/v1alpha1" ocsv1alpha1 "github.com/red-hat-storage/ocs-operator/api/v4/v1alpha1" "sigs.k8s.io/controller-runtime/pkg/reconcile" ) @@ -59,12 +62,14 @@ type StorageConsumerReconciler struct { storageConsumer *ocsv1alpha1.StorageConsumer cephClientHealthChecker *rookCephv1.CephClient namespace string + noobaaAccount *nbv1.NooBaaAccount } //+kubebuilder:rbac:groups=ocs.openshift.io,resources=storageconsumers,verbs=get;list;watch;create;update;patch;delete //+kubebuilder:rbac:groups=ceph.rook.io,resources=cephclients,verbs=get;list;watch;create;update;delete //+kubebuilder:rbac:groups=ocs.openshift.io,resources=storageconsumers/status,verbs=get;update;patch // +kubebuilder:rbac:groups=ocs.openshift.io,resources=storagerequests,verbs=get;list; +// +kubebuilder:rbac:groups=noobaa.io,resources=noobaaaccounts,verbs=get;list;watch;create;update;delete // Reconcile reads that state of the cluster for a StorageConsumer object and makes changes based on the state read // and what is in the StorageConsumer.Spec @@ -127,6 +132,10 @@ func (r *StorageConsumerReconciler) initReconciler(request reconcile.Request) { r.cephClientHealthChecker = &rookCephv1.CephClient{} r.cephClientHealthChecker.Name = GenerateHashForCephClient(r.storageConsumer.Name, "global") r.cephClientHealthChecker.Namespace = r.namespace + + r.noobaaAccount = &nbv1.NooBaaAccount{} + r.noobaaAccount.Name = "noobaa-remote-" + r.storageConsumer.Name + r.noobaaAccount.Namespace = r.storageConsumer.Namespace } func (r *StorageConsumerReconciler) reconcilePhases() (reconcile.Result, error) { @@ -145,6 +154,10 @@ func (r *StorageConsumerReconciler) reconcilePhases() (reconcile.Result, error) return reconcile.Result{}, err } + if err := r.reconcileNoobaaAccount(); err != nil { + return reconcile.Result{}, err + } + cephResourcesReady := true for _, cephResource := range r.storageConsumer.Status.CephResources { if cephResource.Phase != "Ready" { @@ -205,6 +218,25 @@ func (r *StorageConsumerReconciler) reconcileCephClientHealthChecker() error { return nil } +func (r *StorageConsumerReconciler) reconcileNoobaaAccount() error { + _, err := ctrl.CreateOrUpdate(r.ctx, r.Client, r.noobaaAccount, func() error { + if err := r.own(r.noobaaAccount); err != nil { + return err + } + // the following annotation will enable noobaa-operator to create a auth_token secret based on this account + util.AddAnnotation(r.noobaaAccount, "remote-operator", "true") + return nil + }) + if err != nil { + return fmt.Errorf("failed to create noobaa account for storageConsumer %v: %v", r.storageConsumer.Name, err) + } + + phase := string(r.noobaaAccount.Status.Phase) + r.setCephResourceStatus(r.noobaaAccount.Name, "NooBaaAccount", phase, nil) + + return nil +} + func (r *StorageConsumerReconciler) setCephResourceStatus(name string, kind string, phase string, cephClients map[string]string) { cephResourceSpec := ocsv1alpha1.CephResourcesSpec{ Name: name, diff --git a/deploy/ocs-operator/manifests/provider-role.yaml b/deploy/ocs-operator/manifests/provider-role.yaml index aea3ada2e5..260b5d135a 100644 --- a/deploy/ocs-operator/manifests/provider-role.yaml +++ b/deploy/ocs-operator/manifests/provider-role.yaml @@ -68,3 +68,19 @@ rules: verbs: - get - list +- apiGroups: + - noobaa.io + resources: + - noobaaaccounts + verbs: + - get + - list + - create + - delete +- apiGroups: + - route.openshift.io + resources: + - routes + verbs: + - get + - list diff --git a/services/provider/server/consumer.go b/services/provider/server/consumer.go index 9415b8f014..6e050257fd 100644 --- a/services/provider/server/consumer.go +++ b/services/provider/server/consumer.go @@ -4,12 +4,9 @@ import ( "context" "errors" "fmt" - "strings" "sync" - nbv1 "github.com/noobaa/noobaa-operator/v5/pkg/apis/noobaa/v1alpha1" ocsv1alpha1 "github.com/red-hat-storage/ocs-operator/api/v4/v1alpha1" - "github.com/red-hat-storage/ocs-operator/v4/controllers/util" ifaces "github.com/red-hat-storage/ocs-operator/v4/services/provider/interfaces" kerrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -229,47 +226,3 @@ func (c *ocsConsumerManager) UpdateConsumerStatus(ctx context.Context, id string klog.Infof("successfully updated Status for StorageConsumer %v", consumerObj.Name) return nil } - -func (c *ocsConsumerManager) CreateNoobaaAccount(ctx context.Context, id string) error { - - consumerObj, err := c.Get(ctx, id) - if err != nil { - return err - } - consumerClusterID := strings.TrimPrefix(consumerObj.Name, "storageconsumer-") - if consumerClusterID != "" && len(consumerClusterID) == 0 { - return fmt.Errorf("failed to get clusterID from consumerResource Name: %s %v", consumerObj.Name, err) - } - - noobaaAccountName := fmt.Sprintf("noobaa-remote-%s", consumerClusterID) - nbAccountObj := &nbv1.NooBaaAccount{} - nbAccountObj.Name = noobaaAccountName - nbAccountObj.Namespace = consumerObj.Namespace - // the following annotation will enable noobaa-operator to create a auth_token secret based on this account - util.AddAnnotation(nbAccountObj, "remote-operator", "true") - - err = c.client.Create(ctx, nbAccountObj) - if err != nil { - return fmt.Errorf("failed to create noobaa account for storageConsumer %v: %v", consumerObj.Name, err) - } - return nil -} - -func (c *ocsConsumerManager) DeleteNoobaaAccount(ctx context.Context, id string) error { - consumerObj, err := c.Get(ctx, id) - if err != nil { - return err - } - clusterID := strings.TrimPrefix(consumerObj.Name, "storageconsumer-") - if clusterID != "" && len(clusterID) == 0 { - return fmt.Errorf("failed to get clusterID from consumerResource Name: %s %v", consumerObj.Name, err) - } - noobaaAccountName := fmt.Sprintf("noobaa-remote-%s", clusterID) - nbAccountObj := &nbv1.NooBaaAccount{} - nbAccountObj.Name = noobaaAccountName - nbAccountObj.Namespace = consumerObj.Namespace - if err := c.client.Delete(ctx, nbAccountObj); err != nil { - return fmt.Errorf("failed to delete Noobaa account %q. %v", nbAccountObj.Name, err) - } - return nil -} diff --git a/services/provider/server/server.go b/services/provider/server/server.go index 620fd59013..f9ac3f3009 100644 --- a/services/provider/server/server.go +++ b/services/provider/server/server.go @@ -19,7 +19,6 @@ import ( "time" "github.com/blang/semver/v4" - nbapis "github.com/noobaa/noobaa-operator/v5/pkg/apis" nbv1 "github.com/noobaa/noobaa-operator/v5/pkg/apis/noobaa/v1alpha1" quotav1 "github.com/openshift/api/quota/v1" routev1 "github.com/openshift/api/route/v1" @@ -151,10 +150,6 @@ func (s *OCSProviderServer) AcknowledgeOnboarding(ctx context.Context, req *pb.A } return nil, status.Errorf(codes.Internal, "Failed to update the storageConsumer. %v", err) } - // create noobaa account CR - if err := s.consumerManager.CreateNoobaaAccount(ctx, req.StorageConsumerUUID); err != nil { - return nil, status.Errorf(codes.Internal, "Failed to create noobaa account for storageconsumer. %v", err) - } return &pb.AcknowledgeOnboardingResponse{}, nil } @@ -194,12 +189,7 @@ func (s *OCSProviderServer) GetStorageConfig(ctx context.Context, req *pb.Storag // OffboardConsumer RPC call to delete the StorageConsumer CR func (s *OCSProviderServer) OffboardConsumer(ctx context.Context, req *pb.OffboardConsumerRequest) (*pb.OffboardConsumerResponse, error) { - // remove noobaa account - err := s.consumerManager.DeleteNoobaaAccount(ctx, req.StorageConsumerUUID) - if err != nil { - return nil, status.Errorf(codes.Internal, "failed to delete noobaaAccount resource with the provided UUID. %v", err) - } - err = s.consumerManager.Delete(ctx, req.StorageConsumerUUID) + err := s.consumerManager.Delete(ctx, req.StorageConsumerUUID) if err != nil { return nil, status.Errorf(codes.Internal, "failed to delete storageConsumer resource with the provided UUID. %v", err) } @@ -257,10 +247,6 @@ func newClient() (client.Client, error) { if err != nil { return nil, fmt.Errorf("failed to add routev1 to scheme. %v", err) } - err = nbapis.AddToScheme(scheme) - if err != nil { - return nil, fmt.Errorf("failed to add nbapis to scheme. %v", err) - } config, err := config.GetConfig() if err != nil { @@ -435,26 +421,25 @@ func (s *OCSProviderServer) getExternalResources(ctx context.Context, consumerRe } // Fetch noobaa remote secret and management address and append to extResources + consumerName := consumerResource.Name noobaaOperatorSecret := &v1.Secret{} - clusterID := strings.TrimPrefix(consumerResource.Name, "storageconsumer-") - if clusterID != "" && len(clusterID) == 0 { - return nil, fmt.Errorf("failed to get clusterID from consumerResource Name: %s %v", consumerResource.Name, err) - } + noobaaOperatorSecret.Name = fmt.Sprintf("noobaa-account-%s", consumerName) + noobaaOperatorSecret.Namespace = s.namespace - noobaaOperatorSecretName := fmt.Sprintf("noobaa-remote-join-secret-%s", clusterID) - err = s.client.Get(ctx, types.NamespacedName{Name: noobaaOperatorSecretName, Namespace: s.namespace}, noobaaOperatorSecret) - if err != nil { - return nil, fmt.Errorf("failed to get %s secret. %v", noobaaOperatorSecretName, err) + if err := s.client.Get(ctx, client.ObjectKeyFromObject(noobaaOperatorSecret), noobaaOperatorSecret); err != nil { + return nil, fmt.Errorf("failed to get %s secret. %v", noobaaOperatorSecret.Name, err) } authToken, ok := noobaaOperatorSecret.Data["auth_token"] if !ok || len(authToken) == 0 { - return nil, fmt.Errorf("auth_token not found in %s secret", noobaaOperatorSecretName) + return nil, fmt.Errorf("auth_token not found in %s secret", noobaaOperatorSecret.Name) } noobaMgmtRoute := &routev1.Route{} - err = s.client.Get(ctx, types.NamespacedName{Name: "noobaa-mgmt", Namespace: s.namespace}, noobaMgmtRoute) - if err != nil { + noobaMgmtRoute.Name = "noobaa-mgmt" + noobaMgmtRoute.Namespace = s.namespace + + if err = s.client.Get(ctx, client.ObjectKeyFromObject(noobaMgmtRoute), noobaMgmtRoute); err != nil { return nil, fmt.Errorf("failed to get noobaa-mgmt route. %v", err) } if noobaMgmtRoute.Status.Ingress == nil || len(noobaMgmtRoute.Status.Ingress) == 0 { @@ -465,27 +450,23 @@ func (s *OCSProviderServer) getExternalResources(ctx context.Context, consumerRe if noobaaMgmtAddress == "" { return nil, fmt.Errorf("no Host found in noobaa-mgmt route Ingress") } - joinSecret := &corev1.Secret{ - Data: map[string][]byte{ - "auth_token": authToken, - "mgmt_addr": []byte(noobaaMgmtAddress), - }, - } extR = append(extR, &pb.ExternalResource{ Name: "noobaa-remote-join-secret", Kind: "Secret", - Data: mustMarshal(joinSecret), + Data: mustMarshal(map[string][]byte{ + "auth_token": authToken, + "mgmt_addr": []byte(noobaaMgmtAddress), + }), }) - noobaaSpec := &nbv1.NooBaaSpec{ - JoinSecret: &v1.SecretReference{ - Name: "noobaa-remote-join-secret", - }, - } extR = append(extR, &pb.ExternalResource{ Name: "noobaa-remote", Kind: "Noobaa", - Data: mustMarshal(noobaaSpec), + Data: mustMarshal(&nbv1.NooBaaSpec{ + JoinSecret: &v1.SecretReference{ + Name: "noobaa-remote-join-secret", + }, + }), }) return extR, nil } diff --git a/services/provider/server/server_test.go b/services/provider/server/server_test.go index 7259304337..097cd39344 100644 --- a/services/provider/server/server_test.go +++ b/services/provider/server/server_test.go @@ -59,65 +59,63 @@ var noobaaSpec = &nbv1.NooBaaSpec{ }, } -var joinSecret = &v1.Secret{ - Data: map[string][]byte{ - "auth_token": []byte("authToken"), - "mgmt_addr": []byte("noobaaMgmtAddress"), - }, +var joinSecret = map[string][]byte{ + "auth_token": []byte("authToken"), + "mgmt_addr": []byte("noobaaMgmtAddress"), } var mockExtR = map[string]*externalResource{ "rook-ceph-mon-endpoints": { Name: "rook-ceph-mon-endpoints", Kind: "ConfigMap", - Data: mustMarshal(map[string]string{ + Data: map[string]string{ "data": "a=10.99.45.27:6789", "maxMonId": "0", "mapping": "{}", - }), + }, }, "rook-ceph-mon": { Name: "rook-ceph-mon", Kind: "Secret", - Data: mustMarshal(map[string]string{ + Data: map[string]string{ "ceph-username": "client.995e66248ad3e8642de868f461cdd827", "fsid": "b88c2d78-9de9-4227-9313-a63f62f78743", "mon-secret": "mon-secret", "ceph-secret": "AQADw/hhqBOcORAAJY3fKIvte++L/zYhASjYPQ==", - }), + }, }, "monitoring-endpoint": { Name: "monitoring-endpoint", Kind: "CephCluster", - Data: mustMarshal(map[string]string{ + Data: map[string]string{ "MonitoringEndpoint": "10.105.164.231", "MonitoringPort": "9283", - }), + }, }, "rook-ceph-client-995e66248ad3e8642de868f461cdd827": { Name: "rook-ceph-client-995e66248ad3e8642de868f461cdd827", Kind: "Secret", - Data: mustMarshal(map[string]string{ + Data: map[string]string{ "userID": "995e66248ad3e8642de868f461cdd827", "userKey": "AQADw/hhqBOcORAAJY3fKIvte++L/zYhASjYPQ==", - }), + }, }, "QuotaForConsumer": { Name: "QuotaForConsumer", Kind: "ClusterResourceQuota", - Data: mustMarshal(map[string]string{ + Data: map[string]string{ "QuotaForConsumer": fmt.Sprintf("%+v\n", clusterResourceQuotaSpec), - }), + }, }, "noobaa-remote-join-secret": { Name: "noobaa-remote-join-secret", Kind: "Secret", - Data: mustMarshal(joinSecret), + Data: joinSecret, }, "noobaa-remote": { Name: "noobaa-remote", Kind: "Noobaa", - Data: mustMarshal(noobaaSpec), + Data: noobaaSpec, }, "monitor-endpoints": { Name: "monitor-endpoints", @@ -284,14 +282,14 @@ func TestGetExternalResources(t *testing.T) { } noobaaRemoteJoinSecretConsumer := &v1.Secret{ - ObjectMeta: metav1.ObjectMeta{Name: "noobaa-remote-join-secret-consumer", Namespace: server.namespace}, + ObjectMeta: metav1.ObjectMeta{Name: "noobaa-account-consumer", Namespace: server.namespace}, Data: map[string][]byte{ "auth_token": []byte("authToken"), }, } noobaaRemoteJoinSecretConsumer6 := &v1.Secret{ - ObjectMeta: metav1.ObjectMeta{Name: "noobaa-remote-join-secret-consumer6", Namespace: server.namespace}, + ObjectMeta: metav1.ObjectMeta{Name: "noobaa-account-consumer6", Namespace: server.namespace}, Data: map[string][]byte{ "auth_token": []byte("authToken"), }, @@ -333,7 +331,15 @@ func TestGetExternalResources(t *testing.T) { var extNoobaaSpec, mockNoobaaSpec nbv1.NooBaaSpec err = json.Unmarshal(extResource.Data, &extNoobaaSpec) assert.NoError(t, err) - err = json.Unmarshal([]byte(mockResoruce.Data), &mockNoobaaSpec) + var specData []byte + if rawData, ok := mockResoruce.Data.(string); ok { + specData = []byte(rawData) + } else if rawData, ok := mockResoruce.Data.([]byte); ok { + specData = rawData + } else { + assert.FailNow(t, "invalid type for JSON unmarshal") + } + err = json.Unmarshal(specData, &mockNoobaaSpec) assert.NoError(t, err) assert.Equal(t, mockNoobaaSpec.JoinSecret, extNoobaaSpec.JoinSecret) @@ -368,7 +374,15 @@ func TestGetExternalResources(t *testing.T) { var extNoobaaSpec, mockNoobaaSpec nbv1.NooBaaSpec err = json.Unmarshal(extResource.Data, &extNoobaaSpec) assert.NoError(t, err) - err = json.Unmarshal([]byte(mockResoruce.Data), &mockNoobaaSpec) + var specData []byte + if rawData, ok := mockResoruce.Data.(string); ok { + specData = []byte(rawData) + } else if rawData, ok := mockResoruce.Data.([]byte); ok { + specData = rawData + } else { + assert.FailNow(t, "invalid type for JSON unmarshal") + } + err = json.Unmarshal(specData, &mockNoobaaSpec) assert.NoError(t, err) assert.Equal(t, mockNoobaaSpec.JoinSecret, extNoobaaSpec.JoinSecret) @@ -642,7 +656,7 @@ func TestOCSProviderServerGetStorageClaimConfig(t *testing.T) { "ceph-rbd-storageclass": { Name: "ceph-rbd", Kind: "StorageClass", - Data: mustMarshal(map[string]string{ + Data: map[string]string{ "clusterID": serverNamespace, "pool": "cephblockpool", "radosnamespace": "cephradosnamespace", @@ -652,37 +666,37 @@ func TestOCSProviderServerGetStorageClaimConfig(t *testing.T) { "csi.storage.k8s.io/provisioner-secret-name": "ceph-client-provisioner-8d40b6be71600457b5dec219d2ce2d4c", "csi.storage.k8s.io/node-stage-secret-name": "ceph-client-node-8d40b6be71600457b5dec219d2ce2d4c", "csi.storage.k8s.io/controller-expand-secret-name": "ceph-client-provisioner-8d40b6be71600457b5dec219d2ce2d4c", - }), + }, }, "ceph-rbd-volumesnapshotclass": { Name: "ceph-rbd", Kind: "VolumeSnapshotClass", - Data: mustMarshal(map[string]string{ + Data: map[string]string{ "csi.storage.k8s.io/snapshotter-secret-name": "ceph-client-provisioner-8d40b6be71600457b5dec219d2ce2d4c", - }), + }, }, "ceph-rbd-volumegroupsnapshotclass": { Name: "ceph-rbd", Kind: "VolumeGroupSnapshotClass", - Data: mustMarshal(map[string]string{ + Data: map[string]string{ "csi.storage.k8s.io/group-snapshotter-secret-name": "ceph-client-provisioner-8d40b6be71600457b5dec219d2ce2d4c", - }), + }, }, "ceph-client-provisioner-8d40b6be71600457b5dec219d2ce2d4c": { Name: "ceph-client-provisioner-8d40b6be71600457b5dec219d2ce2d4c", Kind: "Secret", - Data: mustMarshal(map[string]string{ + Data: map[string]string{ "userID": "3de200d5c23524a4612bde1fdbeb717e", "userKey": "AQADw/hhqBOcORAAJY3fKIvte++L/zYhASjYPQ==", - }), + }, }, "ceph-client-node-8d40b6be71600457b5dec219d2ce2d4c": { Name: "ceph-client-node-8d40b6be71600457b5dec219d2ce2d4c", Kind: "Secret", - Data: mustMarshal(map[string]string{ + Data: map[string]string{ "userID": "995e66248ad3e8642de868f461cdd827", "userKey": "AQADw/hhqBOcORAAJY3fKIvte++L/zYhASjYPQ==", - }), + }, }, "ceph-rbd-clientprofile": { Name: "ceph-rbd", @@ -699,7 +713,7 @@ func TestOCSProviderServerGetStorageClaimConfig(t *testing.T) { "cephfs-storageclass": { Name: "cephfs", Kind: "StorageClass", - Data: mustMarshal(map[string]string{ + Data: map[string]string{ "clusterID": "8d26c7378c1b0ec9c2455d1c3601c4cd", "fsName": "myfs", "subvolumegroupname": "cephFilesystemSubVolumeGroup", @@ -707,46 +721,46 @@ func TestOCSProviderServerGetStorageClaimConfig(t *testing.T) { "csi.storage.k8s.io/provisioner-secret-name": "ceph-client-provisioner-0e8555e6556f70d23a61675af44e880c", "csi.storage.k8s.io/node-stage-secret-name": "ceph-client-node-0e8555e6556f70d23a61675af44e880c", "csi.storage.k8s.io/controller-expand-secret-name": "ceph-client-provisioner-0e8555e6556f70d23a61675af44e880c", - }), + }, }, "cephfs-volumesnapshotclass": { Name: "cephfs", Kind: "VolumeSnapshotClass", - Data: mustMarshal(map[string]string{ + Data: map[string]string{ "csi.storage.k8s.io/snapshotter-secret-name": "ceph-client-provisioner-0e8555e6556f70d23a61675af44e880c", - }), + }, }, "cephfs-volumegroupsnapshotclass": { Name: "cephfs", Kind: "VolumeGroupSnapshotClass", - Data: mustMarshal(map[string]string{ + Data: map[string]string{ "csi.storage.k8s.io/group-snapshotter-secret-name": "ceph-client-provisioner-0e8555e6556f70d23a61675af44e880c", - }), + }, }, "ceph-client-provisioner-0e8555e6556f70d23a61675af44e880c": { Name: "ceph-client-provisioner-0e8555e6556f70d23a61675af44e880c", Kind: "Secret", - Data: mustMarshal(map[string]string{ + Data: map[string]string{ "adminID": "4ffcb503ff8044c8699dac415f82d604", "adminKey": "AQADw/hhqBOcORAAJY3fKIvte++L/zYhASjYPQ==", - }), + }, }, "ceph-client-node-0e8555e6556f70d23a61675af44e880c": { Name: "ceph-client-node-0e8555e6556f70d23a61675af44e880c", Kind: "Secret", - Data: mustMarshal(map[string]string{ + Data: map[string]string{ "adminID": "1b042fcc8812fe4203689eec38fdfbfa", "adminKey": "AQADw/hhqBOcORAAJY3fKIvte++L/zYhASjYPQ==", - }), + }, }, "cephFilesystemSubVolumeGroup": { Name: "cephFilesystemSubVolumeGroup", Kind: "CephFilesystemSubVolumeGroup", - Data: mustMarshal(map[string]string{ + Data: map[string]string{ "filesystemName": "myfs", - }), + }, }, "cephfs-clientprofile": {