Skip to content

Commit

Permalink
Ignore sending healthchecker & rook-ceph-mon secrets via storageconfig
Browse files Browse the repository at this point in the history
Signed-off-by: Kaustav Majumder <[email protected]>
  • Loading branch information
Kaustav Majumder committed Sep 30, 2024
1 parent bed3551 commit 91316d4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 47 deletions.
45 changes: 0 additions & 45 deletions services/provider/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 := &quotav1.ClusterResourceQuotaSpec{
Selector: quotav1.ClusterResourceQuotaSelector{
Expand Down
4 changes: 2 additions & 2 deletions services/provider/server/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 91316d4

Please sign in to comment.