From 032e6b5d775cef82151b34f2d52bb02bbdea3ae0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Han?= Date: Thu, 29 Oct 2020 11:32:09 +0100 Subject: [PATCH] ceph: remove osd pvc when the cluster is gone MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Just like we do for the monitors, we set an ownerref to the OSD PVC so when the cluster is deleted we remove the PVC too. Signed-off-by: Sébastien Han --- pkg/operator/ceph/cluster/osd/deviceSet.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkg/operator/ceph/cluster/osd/deviceSet.go b/pkg/operator/ceph/cluster/osd/deviceSet.go index d5d1aa5d8..5d3cad431 100644 --- a/pkg/operator/ceph/cluster/osd/deviceSet.go +++ b/pkg/operator/ceph/cluster/osd/deviceSet.go @@ -25,6 +25,7 @@ import ( rookv1 "github.com/rook/rook/pkg/apis/rook.io/v1" "github.com/rook/rook/pkg/clusterd" "github.com/rook/rook/pkg/operator/ceph/controller" + "github.com/rook/rook/pkg/operator/k8sutil" v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -118,6 +119,7 @@ func (c *Cluster) createStorageClassDeviceSetPVC(existingPVCs map[string]*v1.Per existingPVC = existingPVCs[pvcStorageClassDeviceSetPVCId] } pvc := makeStorageClassDeviceSetPVC(storageClassDeviceSetName, pvcStorageClassDeviceSetPVCId, setIndex, pvcTemplate) + k8sutil.SetOwnerRef(&pvc.ObjectMeta, &c.clusterInfo.OwnerRef) if existingPVC != nil { logger.Infof("OSD PVC %q already exists", existingPVC.Name)