From 91316d46d657138f698f96f9798b08d9cdfe50aa Mon Sep 17 00:00:00 2001 From: Kaustav Majumder Date: Mon, 30 Sep 2024 16:57:03 +0530 Subject: [PATCH] Ignore sending healthchecker & rook-ceph-mon secrets via storageconfig Signed-off-by: Kaustav Majumder --- services/provider/server/server.go | 45 ------------------------- services/provider/server/server_test.go | 4 +-- 2 files changed, 2 insertions(+), 47 deletions(-) diff --git a/services/provider/server/server.go b/services/provider/server/server.go index 48c4b1586f..3c17af6534 100644 --- a/services/provider/server/server.go +++ b/services/provider/server/server.go @@ -363,51 +363,6 @@ func (s *OCSProviderServer) getExternalResources(ctx context.Context, consumerRe "MonitoringPort": strconv.Itoa(int(port)), })}) - healthCheckerSecretName := "" - healthCheckerName := "" - for _, cephRes := range consumerResource.Status.CephResources { - if cephRes.Kind == "CephClient" { - clientSecretName, cephUserType, err := s.getCephClientInformation(ctx, cephRes.Name) - if err != nil { - return nil, err - } else if cephUserType == "healthchecker" { - healthCheckerSecretName = clientSecretName - healthCheckerName = cephRes.Name - break - } - } - } - - if healthCheckerSecretName == "" { - return nil, fmt.Errorf("no healthchecker secret found") - } - - cephUserSecret := &v1.Secret{} - err = s.client.Get(ctx, types.NamespacedName{Name: healthCheckerSecretName, Namespace: s.namespace}, cephUserSecret) - if err != nil { - return nil, fmt.Errorf("failed to get %s secret. %v", healthCheckerSecretName, err) - } - - extR = append(extR, &pb.ExternalResource{ - Name: healthCheckerSecretName, - Kind: "Secret", - Data: mustMarshal(map[string]string{ - "userID": healthCheckerName, - "userKey": string(cephUserSecret.Data[healthCheckerName]), - }), - }) - - extR = append(extR, &pb.ExternalResource{ - Name: monSecret, - Kind: "Secret", - Data: mustMarshal(map[string]string{ - "fsid": fsid, - "mon-secret": "mon-secret", - "ceph-username": fmt.Sprintf("client.%s", healthCheckerName), - "ceph-secret": string(cephUserSecret.Data[healthCheckerName]), - }), - }) - if consumerResource.Spec.StorageQuotaInGiB > 0 { clusterResourceQuotaSpec := "av1.ClusterResourceQuotaSpec{ Selector: quotav1.ClusterResourceQuotaSelector{ diff --git a/services/provider/server/server_test.go b/services/provider/server/server_test.go index 704b9b27fd..4026da1592 100644 --- a/services/provider/server/server_test.go +++ b/services/provider/server/server_test.go @@ -396,8 +396,8 @@ func TestGetExternalResources(t *testing.T) { // When ocsv1alpha1.StorageConsumerStateReady but ceph resources is empty req.StorageConsumerUUID = string(consumerResource5.UID) storageConRes, err = server.GetStorageConfig(ctx, &req) - assert.Error(t, err) - assert.Nil(t, storageConRes) + assert.NoError(t, err) + assert.NotNil(t, storageConRes) // When ocsv1alpha1.StorageConsumerStateReady but secret is not ready for _, i := range consumerResource.Status.CephResources {