diff --git a/apis/cassandra/v1beta1/cassandradatacenter_types.go b/apis/cassandra/v1beta1/cassandradatacenter_types.go index a1f878c2..a3d76313 100644 --- a/apis/cassandra/v1beta1/cassandradatacenter_types.go +++ b/apis/cassandra/v1beta1/cassandradatacenter_types.go @@ -24,6 +24,9 @@ const ( // DatacenterLabel is the operator's label for the datacenter name DatacenterLabel = "cassandra.datastax.com/datacenter" + // DatacenterUID is the operator's label for datacenter UID + DatacenterUID = "cassandra.datastax.com/datacenterUID" + // SeedNodeLabel is the operator's label for the seed node state SeedNodeLabel = "cassandra.datastax.com/seed-node" @@ -496,6 +499,7 @@ func (dc *CassandraDatacenter) SetCondition(condition DatacenterCondition) { func (dc *CassandraDatacenter) GetDatacenterLabels() map[string]string { labels := dc.GetClusterLabels() labels[DatacenterLabel] = dc.Name + labels[DatacenterUID] = string(dc.UID) return labels } diff --git a/pkg/reconciliation/reconcile_datacenter.go b/pkg/reconciliation/reconcile_datacenter.go index 67fd5497..b699688d 100644 --- a/pkg/reconciliation/reconcile_datacenter.go +++ b/pkg/reconciliation/reconcile_datacenter.go @@ -98,6 +98,7 @@ func (rc *ReconciliationContext) listPVCs() (*corev1.PersistentVolumeClaimList, selector := map[string]string{ api.DatacenterLabel: rc.Datacenter.Name, + api.DatacenterUID: string(rc.Datacenter.UID), } listOptions := &client.ListOptions{