From a687e91bedd6ac0899fd05fd72f9d29e8905b9f7 Mon Sep 17 00:00:00 2001 From: srteam2020 Date: Sat, 20 Mar 2021 16:25:19 -0500 Subject: [PATCH] list PVC with ZookeeperCluster uid --- pkg/controller/zookeepercluster/zookeepercluster_controller.go | 2 +- pkg/zk/generators.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/controller/zookeepercluster/zookeepercluster_controller.go b/pkg/controller/zookeepercluster/zookeepercluster_controller.go index 1a154aac4..f05f3ec73 100644 --- a/pkg/controller/zookeepercluster/zookeepercluster_controller.go +++ b/pkg/controller/zookeepercluster/zookeepercluster_controller.go @@ -722,7 +722,7 @@ func (r *ReconcileZookeeperCluster) cleanupOrphanPVCs(instance *zookeeperv1beta1 func (r *ReconcileZookeeperCluster) getPVCList(instance *zookeeperv1beta1.ZookeeperCluster) (pvList corev1.PersistentVolumeClaimList, err error) { selector, err := metav1.LabelSelectorAsSelector(&metav1.LabelSelector{ - MatchLabels: map[string]string{"app": instance.GetName()}, + MatchLabels: map[string]string{"app": instance.GetName(), "uid": string(instance.UID)}, }) pvclistOps := &client.ListOptions{ Namespace: instance.Namespace, diff --git a/pkg/zk/generators.go b/pkg/zk/generators.go index 3f6f8babc..b307ec517 100644 --- a/pkg/zk/generators.go +++ b/pkg/zk/generators.go @@ -57,7 +57,7 @@ func MakeStatefulSet(z *v1beta1.ZookeeperCluster) *appsv1.StatefulSet { Name: zkDataVolume, Labels: mergeLabels( z.Spec.Labels, - map[string]string{"app": z.GetName()}, + map[string]string{"app": z.GetName(), "uid": string(z.UID)}, ), Annotations: z.Spec.Persistence.Annotations, },