Skip to content

Commit

Permalink
Merge pull request #2661 from raaizik/RHSTOR-5795
Browse files Browse the repository at this point in the history
Sends `VolumeGroupSnapshotClass` to client
  • Loading branch information
openshift-merge-bot[bot] authored Jul 15, 2024
2 parents 01bfbf8 + e418764 commit fbe323d
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 35 deletions.
75 changes: 42 additions & 33 deletions services/provider/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -611,19 +611,24 @@ func (s *OCSProviderServer) GetStorageClaimConfig(ctx context.Context, req *pb.S
rbdStorageClassData["encryptionKMSID"] = storageRequest.Spec.EncryptionMethod
}

extR = append(extR, &pb.ExternalResource{
Name: "ceph-rbd",
Kind: "StorageClass",
Data: mustMarshal(rbdStorageClassData),
})

extR = append(extR, &pb.ExternalResource{
Name: "ceph-rbd",
Kind: "VolumeSnapshotClass",
Data: mustMarshal(map[string]string{
"clusterID": rbdStorageClassData["clusterID"],
"csi.storage.k8s.io/snapshotter-secret-name": provisionerSecretName,
})})
extR = append(extR,
&pb.ExternalResource{
Name: "ceph-rbd",
Kind: "StorageClass",
Data: mustMarshal(rbdStorageClassData),
},
&pb.ExternalResource{
Name: "ceph-rbd",
Kind: "VolumeSnapshotClass",
Data: mustMarshal(map[string]string{
"csi.storage.k8s.io/snapshotter-secret-name": provisionerSecretName,
})},
&pb.ExternalResource{
Name: "ceph-rbd",
Kind: "VolumeGroupSnapshotClass",
Data: mustMarshal(map[string]string{
"csi.storage.k8s.io/group-snapshotter-secret-name": provisionerSecretName,
})})

case "CephFilesystemSubVolumeGroup":
subVolumeGroup := &rookCephv1.CephFilesystemSubVolumeGroup{}
Expand All @@ -644,26 +649,30 @@ func (s *OCSProviderServer) GetStorageClaimConfig(ctx context.Context, req *pb.S
"csi.storage.k8s.io/controller-expand-secret-name": provisionerSecretName,
}

extR = append(extR, &pb.ExternalResource{
Name: "cephfs",
Kind: "StorageClass",
Data: mustMarshal(cephfsStorageClassData),
})

extR = append(extR, &pb.ExternalResource{
Name: cephRes.Name,
Kind: cephRes.Kind,
Data: mustMarshal(map[string]string{
"filesystemName": subVolumeGroup.Spec.FilesystemName,
})})

extR = append(extR, &pb.ExternalResource{
Name: "cephfs",
Kind: "VolumeSnapshotClass",
Data: mustMarshal(map[string]string{
"clusterID": getSubVolumeGroupClusterID(subVolumeGroup),
"csi.storage.k8s.io/snapshotter-secret-name": provisionerSecretName,
})})
extR = append(extR,
&pb.ExternalResource{
Name: "cephfs",
Kind: "StorageClass",
Data: mustMarshal(cephfsStorageClassData),
},
&pb.ExternalResource{
Name: cephRes.Name,
Kind: cephRes.Kind,
Data: mustMarshal(map[string]string{
"filesystemName": subVolumeGroup.Spec.FilesystemName,
})},
&pb.ExternalResource{
Name: "cephfs",
Kind: "VolumeSnapshotClass",
Data: mustMarshal(map[string]string{
"csi.storage.k8s.io/snapshotter-secret-name": provisionerSecretName,
})},
&pb.ExternalResource{
Name: "cephfs",
Kind: "VolumeGroupSnapshotClass",
Data: mustMarshal(map[string]string{
"csi.storage.k8s.io/group-snapshotter-secret-name": provisionerSecretName,
})})
}
}

Expand Down
21 changes: 19 additions & 2 deletions services/provider/server/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -507,10 +507,16 @@ func TestOCSProviderServerGetStorageClaimConfig(t *testing.T) {
Name: "ceph-rbd",
Kind: "VolumeSnapshotClass",
Data: map[string]string{
"clusterID": serverNamespace,
"csi.storage.k8s.io/snapshotter-secret-name": "ceph-client-provisioner-8d40b6be71600457b5dec219d2ce2d4c",
},
},
"ceph-rbd-volumegroupsnapshotclass": {
Name: "ceph-rbd",
Kind: "VolumeGroupSnapshotClass",
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",
Expand Down Expand Up @@ -547,10 +553,17 @@ func TestOCSProviderServerGetStorageClaimConfig(t *testing.T) {
Name: "cephfs",
Kind: "VolumeSnapshotClass",
Data: map[string]string{
"clusterID": "8d26c7378c1b0ec9c2455d1c3601c4cd",
"csi.storage.k8s.io/snapshotter-secret-name": "ceph-client-provisioner-0e8555e6556f70d23a61675af44e880c",
},
},

"cephfs-volumegroupsnapshotclass": {
Name: "cephfs",
Kind: "VolumeGroupSnapshotClass",
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",
Expand Down Expand Up @@ -853,6 +866,8 @@ func TestOCSProviderServerGetStorageClaimConfig(t *testing.T) {
name = fmt.Sprintf("%s-volumesnapshotclass", name)
} else if extResource.Kind == "StorageClass" {
name = fmt.Sprintf("%s-storageclass", name)
} else if extResource.Kind == "VolumeGroupSnapshotClass" {
name = fmt.Sprintf("%s-volumegroupsnapshotclass", name)
}
mockResoruce, ok := mockBlockPoolClaimExtR[name]
assert.True(t, ok)
Expand Down Expand Up @@ -880,6 +895,8 @@ func TestOCSProviderServerGetStorageClaimConfig(t *testing.T) {
name = fmt.Sprintf("%s-volumesnapshotclass", name)
} else if extResource.Kind == "StorageClass" {
name = fmt.Sprintf("%s-storageclass", name)
} else if extResource.Kind == "VolumeGroupSnapshotClass" {
name = fmt.Sprintf("%s-volumegroupsnapshotclass", name)
}
mockResoruce, ok := mockShareFilesystemClaimExtR[name]
assert.True(t, ok)
Expand Down

0 comments on commit fbe323d

Please sign in to comment.