From b574dce834c12a0f089987d7521a28f10f297217 Mon Sep 17 00:00:00 2001 From: srteam2020 Date: Sun, 18 Apr 2021 17:46:34 -0700 Subject: [PATCH] fix-412 --- .../pkg/apis/cassandra/v1beta1/cassandradatacenter_types.go | 4 ++++ operator/pkg/reconciliation/reconcile_datacenter.go | 1 + 2 files changed, 5 insertions(+) diff --git a/operator/pkg/apis/cassandra/v1beta1/cassandradatacenter_types.go b/operator/pkg/apis/cassandra/v1beta1/cassandradatacenter_types.go index 6a380c6c4..98c2b20dd 100644 --- a/operator/pkg/apis/cassandra/v1beta1/cassandradatacenter_types.go +++ b/operator/pkg/apis/cassandra/v1beta1/cassandradatacenter_types.go @@ -25,6 +25,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" @@ -512,6 +515,7 @@ func (dc *CassandraDatacenter) SetCondition(condition DatacenterCondition) { func (dc *CassandraDatacenter) GetDatacenterLabels() map[string]string { labels := map[string]string{ DatacenterLabel: dc.Name, + DatacenterUID: string(dc.UID), } utils.MergeMap(labels, dc.GetClusterLabels()) diff --git a/operator/pkg/reconciliation/reconcile_datacenter.go b/operator/pkg/reconciliation/reconcile_datacenter.go index cefe3f280..c6c252021 100644 --- a/operator/pkg/reconciliation/reconcile_datacenter.go +++ b/operator/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{