Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix-118: Check UID before deleting PVC #122

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions apis/cassandra/v1beta1/cassandradatacenter_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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
}

Expand Down
1 change: 1 addition & 0 deletions pkg/reconciliation/reconcile_datacenter.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down