From f9267286bdefae83f6ad28c62a588d5b4c2eb8d6 Mon Sep 17 00:00:00 2001 From: sp98 Date: Fri, 17 May 2024 18:55:01 +0530 Subject: [PATCH] core: fix missing env in svg cleanup job SVG cleanup job uses the cephSubvolumeGroup env name from spec.Name. But sometimes it can be empty. In that case rook should use the CR name. Signed-off-by: sp98 (cherry picked from commit 33ce8f0c8e31ba7f5acf24c7854465ff32eca437) --- pkg/operator/ceph/file/subvolumegroup/controller.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/operator/ceph/file/subvolumegroup/controller.go b/pkg/operator/ceph/file/subvolumegroup/controller.go index 78755fa55b9b..cee41f115fd4 100644 --- a/pkg/operator/ceph/file/subvolumegroup/controller.go +++ b/pkg/operator/ceph/file/subvolumegroup/controller.go @@ -395,8 +395,13 @@ func buildClusterID(cephFilesystemSubVolumeGroup *cephv1.CephFilesystemSubVolume func (r *ReconcileCephFilesystemSubVolumeGroup) cleanup(svg *cephv1.CephFilesystemSubVolumeGroup, cephCluster *cephv1.CephCluster) error { logger.Infof("starting cleanup of the ceph resources for subVolumeGroup %q in namespace %q", svg.Name, svg.Namespace) + svgName := svg.Spec.Name + // use resource name if `spec.Name` is empty in the subvolumeGroup CR. + if svgName == "" { + svgName = svg.Name + } cleanupConfig := map[string]string{ - opcontroller.CephFSSubVolumeGroupNameEnv: svg.Spec.Name, + opcontroller.CephFSSubVolumeGroupNameEnv: svgName, opcontroller.CephFSNameEnv: svg.Spec.FilesystemName, opcontroller.CSICephFSRadosNamesaceEnv: "csi", opcontroller.CephFSMetaDataPoolNameEnv: file.GenerateMetaDataPoolName(svg.Spec.FilesystemName),